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/x64/unwinding-info-writer-x64.h" | 5 #include "src/compiler/x64/unwinding-info-writer-x64.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->register_.is(eh_frame_writer_.base_register()) && | 23 if (!initial_state->register_.is(eh_frame_writer_.base_register()) && |
23 initial_state->offset_ != eh_frame_writer_.base_offset()) { | 24 initial_state->offset_ != eh_frame_writer_.base_offset()) { |
24 eh_frame_writer_.AdvanceLocation(pc_offset); | 25 eh_frame_writer_.AdvanceLocation(pc_offset); |
25 eh_frame_writer_.SetBaseAddressRegisterAndOffset(initial_state->register_, | 26 eh_frame_writer_.SetBaseAddressRegisterAndOffset(initial_state->register_, |
26 initial_state->offset_); | 27 initial_state->offset_); |
27 } else if (!initial_state->register_.is(eh_frame_writer_.base_register())) { | 28 } else if (!initial_state->register_.is(eh_frame_writer_.base_register())) { |
28 eh_frame_writer_.AdvanceLocation(pc_offset); | 29 eh_frame_writer_.AdvanceLocation(pc_offset); |
(...skipping 11 matching lines...) Expand all Loading... |
40 // All the other blocks must have an explicit initial state. | 41 // All the other blocks must have an explicit initial state. |
41 DCHECK(block->predecessors().empty() || block->successors().empty()); | 42 DCHECK(block->predecessors().empty() || block->successors().empty()); |
42 } | 43 } |
43 } | 44 } |
44 | 45 |
45 void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) { | 46 void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) { |
46 if (!enabled() || block_will_exit_) return; | 47 if (!enabled() || block_will_exit_) return; |
47 | 48 |
48 for (const RpoNumber& successor : block->successors()) { | 49 for (const RpoNumber& successor : block->successors()) { |
49 int successor_index = successor.ToInt(); | 50 int successor_index = successor.ToInt(); |
50 DCHECK_LT(successor_index, block_initial_states_.size()); | 51 DCHECK_LT(successor_index, static_cast<int>(block_initial_states_.size())); |
51 const BlockInitialState* existing_state = | 52 const BlockInitialState* existing_state = |
52 block_initial_states_[successor_index]; | 53 block_initial_states_[successor_index]; |
53 // If we already had an entry for this BB, check that the values are the | 54 // If we already had an entry for this BB, check that the values are the |
54 // same we are trying to insert. | 55 // same we are trying to insert. |
55 if (existing_state) { | 56 if (existing_state) { |
56 DCHECK(existing_state->register_.is(eh_frame_writer_.base_register())); | 57 DCHECK(existing_state->register_.is(eh_frame_writer_.base_register())); |
57 DCHECK_EQ(existing_state->offset_, eh_frame_writer_.base_offset()); | 58 DCHECK_EQ(existing_state->offset_, eh_frame_writer_.base_offset()); |
58 DCHECK_EQ(existing_state->tracking_fp_, tracking_fp_); | 59 DCHECK_EQ(existing_state->tracking_fp_, tracking_fp_); |
59 } else { | 60 } else { |
60 block_initial_states_[successor_index] = new (zone_) | 61 block_initial_states_[successor_index] = new (zone_) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // pop rbp | 94 // pop rbp |
94 eh_frame_writer_.AdvanceLocation(pc_base + 4); | 95 eh_frame_writer_.AdvanceLocation(pc_base + 4); |
95 eh_frame_writer_.IncreaseBaseAddressOffset(-kInt64Size); | 96 eh_frame_writer_.IncreaseBaseAddressOffset(-kInt64Size); |
96 | 97 |
97 tracking_fp_ = false; | 98 tracking_fp_ = false; |
98 } | 99 } |
99 | 100 |
100 } // namespace compiler | 101 } // namespace compiler |
101 } // namespace internal | 102 } // namespace internal |
102 } // namespace v8 | 103 } // namespace v8 |
OLD | NEW |