| 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(), block_initial_states_.size()); | 18 DCHECK_LT(block->rpo_number().ToInt(), |
| 19 static_cast<int>(block_initial_states_.size())); |
| 19 const BlockInitialState* initial_state = | 20 const BlockInitialState* initial_state = |
| 20 block_initial_states_[block->rpo_number().ToInt()]; | 21 block_initial_states_[block->rpo_number().ToInt()]; |
| 21 if (initial_state) { | 22 if (initial_state) { |
| 22 if (initial_state->saved_lr_ != saved_lr_) { | 23 if (initial_state->saved_lr_ != saved_lr_) { |
| 23 eh_frame_writer_.AdvanceLocation(pc_offset); | 24 eh_frame_writer_.AdvanceLocation(pc_offset); |
| 24 if (initial_state->saved_lr_) { | 25 if (initial_state->saved_lr_) { |
| 25 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize); | 26 eh_frame_writer_.RecordRegisterSavedToStack(lr, kPointerSize); |
| 26 } else { | 27 } else { |
| 27 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); | 28 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); |
| 28 } | 29 } |
| 29 saved_lr_ = initial_state->saved_lr_; | 30 saved_lr_ = initial_state->saved_lr_; |
| 30 } | 31 } |
| 31 } else { | 32 } else { |
| 32 // The entry block always lacks an explicit initial state. | 33 // The entry block always lacks an explicit initial state. |
| 33 // The exit block may lack an explicit state, if it is only reached by | 34 // The exit block may lack an explicit state, if it is only reached by |
| 34 // the block ending in a ret. | 35 // the block ending in a ret. |
| 35 // All the other blocks must have an explicit initial state. | 36 // All the other blocks must have an explicit initial state. |
| 36 DCHECK(block->predecessors().empty() || block->successors().empty()); | 37 DCHECK(block->predecessors().empty() || block->successors().empty()); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) { | 41 void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) { |
| 41 if (!enabled() || block_will_exit_) return; | 42 if (!enabled() || block_will_exit_) return; |
| 42 | 43 |
| 43 for (const RpoNumber& successor : block->successors()) { | 44 for (const RpoNumber& successor : block->successors()) { |
| 44 int successor_index = successor.ToInt(); | 45 int successor_index = successor.ToInt(); |
| 45 DCHECK_LT(successor_index, block_initial_states_.size()); | 46 DCHECK_LT(successor_index, static_cast<int>(block_initial_states_.size())); |
| 46 const BlockInitialState* existing_state = | 47 const BlockInitialState* existing_state = |
| 47 block_initial_states_[successor_index]; | 48 block_initial_states_[successor_index]; |
| 48 | 49 |
| 49 // If we already had an entry for this BB, check that the values are the | 50 // If we already had an entry for this BB, check that the values are the |
| 50 // same we are trying to insert. | 51 // same we are trying to insert. |
| 51 if (existing_state) { | 52 if (existing_state) { |
| 52 DCHECK_EQ(existing_state->saved_lr_, saved_lr_); | 53 DCHECK_EQ(existing_state->saved_lr_, saved_lr_); |
| 53 } else { | 54 } else { |
| 54 block_initial_states_[successor_index] = | 55 block_initial_states_[successor_index] = |
| 55 new (zone_) BlockInitialState(saved_lr_); | 56 new (zone_) BlockInitialState(saved_lr_); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (!enabled()) return; | 101 if (!enabled()) return; |
| 101 | 102 |
| 102 eh_frame_writer_.AdvanceLocation(pc_offset); | 103 eh_frame_writer_.AdvanceLocation(pc_offset); |
| 103 eh_frame_writer_.SetBaseAddressRegisterAndOffset(fp, 0); | 104 eh_frame_writer_.SetBaseAddressRegisterAndOffset(fp, 0); |
| 104 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); | 105 eh_frame_writer_.RecordRegisterFollowsInitialRule(lr); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace compiler | 108 } // namespace compiler |
| 108 } // namespace internal | 109 } // namespace internal |
| 109 } // namespace v8 | 110 } // namespace v8 |
| OLD | NEW |