v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
unwinding-info-writer-ppc.cc
Go to the documentation of this file.
1// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
7
8namespace v8 {
9namespace internal {
10namespace compiler {
12 const InstructionBlock* block) {
13 if (!enabled()) return;
14
15 block_will_exit_ = false;
16
17 DCHECK_LT(block->rpo_number().ToInt(),
18 static_cast<int>(block_initial_states_.size()));
19 const BlockInitialState* initial_state =
20 block_initial_states_[block->rpo_number().ToInt()];
21 if (!initial_state) return;
22 if (initial_state->saved_lr_ != saved_lr_) {
24 if (initial_state->saved_lr_) {
28 } else {
30 }
31 saved_lr_ = initial_state->saved_lr_;
32 }
33}
34
35void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
36 if (!enabled() || block_will_exit_) return;
37
38 for (const RpoNumber& successor : block->successors()) {
39 int successor_index = successor.ToInt();
40 DCHECK_LT(successor_index, static_cast<int>(block_initial_states_.size()));
41 const BlockInitialState* existing_state =
42 block_initial_states_[successor_index];
43
44 // If we already had an entry for this BB, check that the values are the
45 // same we are trying to insert.
46 if (existing_state) {
47 DCHECK_EQ(existing_state->saved_lr_, saved_lr_);
48 } else {
49 block_initial_states_[successor_index] =
50 zone_->New<BlockInitialState>(saved_lr_);
51 }
52 }
53}
54
56 if (!enabled()) return;
57
58 // Regardless of the type of frame constructed, the relevant part of the
59 // layout is always the one in the diagram:
60 //
61 // | .... | higher addresses
62 // +----------+ ^
63 // | LR | | |
64 // +----------+ | |
65 // | saved FP | | |
66 // +----------+ <-- FP v
67 // | .... | stack growth
68 //
69 // The LR is pushed on the stack, and we can record this fact at the end of
70 // the construction, since the LR itself is not modified in the process.
75 saved_lr_ = true;
76}
77
79 if (!enabled()) return;
80
81 // The lr is restored by the last operation in LeaveFrame().
84 saved_lr_ = false;
85}
86
88 if (!enabled()) return;
89
93}
94
96 if (!enabled()) return;
97
101}
102
103} // namespace compiler
104} // namespace internal
105} // namespace v8
void SetBaseAddressRegisterAndOffset(Register base_register, int base_offset)
Definition eh-frame.cc:293
void AdvanceLocation(int pc_offset)
Definition eh-frame.cc:251
void RecordRegisterSavedToStack(Register name, int offset)
Definition eh-frame.h:104
void RecordRegisterFollowsInitialRule(Register name)
Definition eh-frame.cc:333
T * New(Args &&... args)
Definition zone.h:114
ZoneVector< const BlockInitialState * > block_initial_states_
void BeginInstructionBlock(int pc_offset, const InstructionBlock *block)
void EndInstructionBlock(const InstructionBlock *block)
int pc_offset
constexpr int kSystemPointerSize
Definition globals.h:410
static const int kLrDwarfCode
#define DCHECK_LT(v1, v2)
Definition logging.h:489
#define DCHECK_EQ(v1, v2)
Definition logging.h:485