5 #include "src/compiler/backend/arm64/unwinding-info-writer-arm64.h" 6 #include "src/compiler/backend/instruction.h" 12 void UnwindingInfoWriter::BeginInstructionBlock(
int pc_offset,
13 const InstructionBlock* block) {
14 if (!enabled())
return;
16 block_will_exit_ =
false;
18 DCHECK_LT(block->rpo_number().ToInt(),
19 static_cast<int>(block_initial_states_.size()));
20 const BlockInitialState* initial_state =
21 block_initial_states_[block->rpo_number().ToInt()];
23 if (initial_state->saved_lr_ != saved_lr_) {
24 eh_frame_writer_.AdvanceLocation(pc_offset);
25 if (initial_state->saved_lr_) {
26 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize);
27 eh_frame_writer_.RecordRegisterSavedToStack(fp, 0);
29 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);
31 saved_lr_ = initial_state->saved_lr_;
38 DCHECK(block->predecessors().empty() || block->successors().empty());
42 void UnwindingInfoWriter::EndInstructionBlock(
const InstructionBlock* block) {
43 if (!enabled() || block_will_exit_)
return;
45 for (
const RpoNumber& successor : block->successors()) {
46 int successor_index = successor.ToInt();
47 DCHECK_LT(successor_index, static_cast<int>(block_initial_states_.size()));
48 const BlockInitialState* existing_state =
49 block_initial_states_[successor_index];
54 DCHECK_EQ(existing_state->saved_lr_, saved_lr_);
56 block_initial_states_[successor_index] =
57 new (zone_) BlockInitialState(saved_lr_);
62 void UnwindingInfoWriter::MarkFrameConstructed(
int at_pc) {
63 if (!enabled())
return;
78 eh_frame_writer_.AdvanceLocation(at_pc);
79 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize);
80 eh_frame_writer_.RecordRegisterSavedToStack(fp, 0);
84 void UnwindingInfoWriter::MarkFrameDeconstructed(
int at_pc) {
85 if (!enabled())
return;
88 eh_frame_writer_.AdvanceLocation(at_pc);
89 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);
93 void UnwindingInfoWriter::MarkLinkRegisterOnTopOfStack(
int pc_offset,
95 if (!enabled())
return;
97 eh_frame_writer_.AdvanceLocation(pc_offset);
98 eh_frame_writer_.SetBaseAddressRegisterAndOffset(sp, 0);
99 eh_frame_writer_.RecordRegisterSavedToStack(lr, 0);
102 void UnwindingInfoWriter::MarkPopLinkRegisterFromTopOfStack(
int pc_offset) {
103 if (!enabled())
return;
105 eh_frame_writer_.AdvanceLocation(pc_offset);
106 eh_frame_writer_.SetBaseAddressRegisterAndOffset(fp, 0);
107 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);