OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/arm64/unwinding-info-writer-arm64.h" | 5 #include "src/compiler/arm64/unwinding-info-writer-arm64.h" |
6 #include "src/compiler/instruction.h" | 6 #include "src/compiler/instruction.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
11 | 11 |
12 void UnwindingInfoWriter::BeginInstructionBlock(int pc_offset, | 12 void UnwindingInfoWriter::BeginInstructionBlock(int pc_offset, |
13 const InstructionBlock* block) { | 13 const InstructionBlock* block) { |
14 if (!enabled()) return; | 14 if (!enabled()) return; |
15 | 15 |
16 block_will_exit_ = false; | 16 block_will_exit_ = false; |
17 | 17 |
18 DCHECK_LT(block->rpo_number().ToInt(), | 18 DCHECK_LT(block->rpo_number().ToInt(), |
19 static_cast<int>(block_initial_states_.size())); | 19 static_cast<int>(block_initial_states_.size())); |
20 const BlockInitialState* initial_state = | 20 const BlockInitialState* initial_state = |
21 block_initial_states_[block->rpo_number().ToInt()]; | 21 block_initial_states_[block->rpo_number().ToInt()]; |
22 if (initial_state) { | 22 if (initial_state) { |
23 if (initial_state->saved_lr_ != saved_lr_) { | 23 if (initial_state->saved_lr_ != saved_lr_) { |
24 eh_frame_writer_.AdvanceLocation(pc_offset); | 24 eh_frame_writer_.AdvanceLocation(pc_offset); |
25 if (initial_state->saved_lr_) { | 25 if (initial_state->saved_lr_) { |
26 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize); | 26 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize); |
| 27 eh_frame_writer_.RecordRegisterSavedToStack(fp, 0); |
27 } else { | 28 } else { |
28 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); | 29 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); |
29 } | 30 } |
30 saved_lr_ = initial_state->saved_lr_; | 31 saved_lr_ = initial_state->saved_lr_; |
31 } | 32 } |
32 } else { | 33 } else { |
33 // The entry block always lacks an explicit initial state. | 34 // The entry block always lacks an explicit initial state. |
34 // The exit block may lack an explicit state, if it is only reached by | 35 // The exit block may lack an explicit state, if it is only reached by |
35 // the block ending in a ret. | 36 // the block ending in a ret. |
36 // All the other blocks must have an explicit initial state. | 37 // All the other blocks must have an explicit initial state. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // | LR | | | | 70 // | LR | | | |
70 // +----------+ | | | 71 // +----------+ | | |
71 // | saved FP | | | | 72 // | saved FP | | | |
72 // +----------+ <-- FP v | 73 // +----------+ <-- FP v |
73 // | .... | stack growth | 74 // | .... | stack growth |
74 // | 75 // |
75 // The LR is pushed on the stack, and we can record this fact at the end of | 76 // The LR is pushed on the stack, and we can record this fact at the end of |
76 // the construction, since the LR itself is not modified in the process. | 77 // the construction, since the LR itself is not modified in the process. |
77 eh_frame_writer_.AdvanceLocation(at_pc); | 78 eh_frame_writer_.AdvanceLocation(at_pc); |
78 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize); | 79 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize); |
| 80 eh_frame_writer_.RecordRegisterSavedToStack(fp, 0); |
79 saved_lr_ = true; | 81 saved_lr_ = true; |
80 } | 82 } |
81 | 83 |
82 void UnwindingInfoWriter::MarkFrameDeconstructed(int at_pc) { | 84 void UnwindingInfoWriter::MarkFrameDeconstructed(int at_pc) { |
83 if (!enabled()) return; | 85 if (!enabled()) return; |
84 | 86 |
85 // The lr is restored by the last operation in LeaveFrame(). | 87 // The lr is restored by the last operation in LeaveFrame(). |
86 eh_frame_writer_.AdvanceLocation(at_pc); | 88 eh_frame_writer_.AdvanceLocation(at_pc); |
87 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); | 89 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); |
88 saved_lr_ = false; | 90 saved_lr_ = false; |
(...skipping 12 matching lines...) Expand all Loading... |
101 if (!enabled()) return; | 103 if (!enabled()) return; |
102 | 104 |
103 eh_frame_writer_.AdvanceLocation(pc_offset); | 105 eh_frame_writer_.AdvanceLocation(pc_offset); |
104 eh_frame_writer_.SetBaseAddressRegisterAndOffset(fp, 0); | 106 eh_frame_writer_.SetBaseAddressRegisterAndOffset(fp, 0); |
105 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); | 107 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); |
106 } | 108 } |
107 | 109 |
108 } // namespace compiler | 110 } // namespace compiler |
109 } // namespace internal | 111 } // namespace internal |
110 } // namespace v8 | 112 } // namespace v8 |
OLD | NEW |