OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/live-range-separator.h" | 5 #include "src/compiler/live-range-separator.h" |
6 #include "src/compiler/register-allocator.h" | 6 #include "src/compiler/register-allocator.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void SplinterLiveRange(TopLevelLiveRange *range, RegisterAllocationData *data) { | 62 void SplinterLiveRange(TopLevelLiveRange *range, RegisterAllocationData *data) { |
63 const InstructionSequence *code = data->code(); | 63 const InstructionSequence *code = data->code(); |
64 UseInterval *interval = range->first_interval(); | 64 UseInterval *interval = range->first_interval(); |
65 | 65 |
66 LifetimePosition first_cut = LifetimePosition::Invalid(); | 66 LifetimePosition first_cut = LifetimePosition::Invalid(); |
67 LifetimePosition last_cut = LifetimePosition::Invalid(); | 67 LifetimePosition last_cut = LifetimePosition::Invalid(); |
68 | 68 |
69 while (interval != nullptr) { | 69 while (interval != nullptr) { |
70 UseInterval *next_interval = interval->next(); | 70 UseInterval *next_interval = interval->next(); |
71 const InstructionBlock *first_block = | 71 const InstructionBlock *first_block = |
72 code->GetInstructionBlock(interval->FirstInstructionIndex()); | 72 code->GetInstructionBlock(interval->FirstGapIndex()); |
73 const InstructionBlock *last_block = | 73 const InstructionBlock *last_block = |
74 code->GetInstructionBlock(interval->LastInstructionIndex()); | 74 code->GetInstructionBlock(interval->LastGapIndex()); |
75 int first_block_nr = first_block->rpo_number().ToInt(); | 75 int first_block_nr = first_block->rpo_number().ToInt(); |
76 int last_block_nr = last_block->rpo_number().ToInt(); | 76 int last_block_nr = last_block->rpo_number().ToInt(); |
77 for (int block_id = first_block_nr; block_id <= last_block_nr; ++block_id) { | 77 for (int block_id = first_block_nr; block_id <= last_block_nr; ++block_id) { |
78 const InstructionBlock *current_block = | 78 const InstructionBlock *current_block = |
79 code->InstructionBlockAt(RpoNumber::FromInt(block_id)); | 79 code->InstructionBlockAt(RpoNumber::FromInt(block_id)); |
80 if (current_block->IsDeferred()) { | 80 if (current_block->IsDeferred()) { |
81 if (!first_cut.IsValid()) { | 81 if (!first_cut.IsValid()) { |
82 first_cut = LifetimePosition::GapFromInstructionIndex( | 82 first_cut = LifetimePosition::GapFromInstructionIndex( |
83 current_block->first_instruction_index()); | 83 current_block->first_instruction_index()); |
84 } | 84 } |
(...skipping 18 matching lines...) Expand all Loading... |
103 } // namespace | 103 } // namespace |
104 | 104 |
105 | 105 |
106 void LiveRangeSeparator::Splinter() { | 106 void LiveRangeSeparator::Splinter() { |
107 size_t virt_reg_count = data()->live_ranges().size(); | 107 size_t virt_reg_count = data()->live_ranges().size(); |
108 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { | 108 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { |
109 TopLevelLiveRange *range = data()->live_ranges()[vreg]; | 109 TopLevelLiveRange *range = data()->live_ranges()[vreg]; |
110 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { | 110 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { |
111 continue; | 111 continue; |
112 } | 112 } |
113 int first_instr = range->first_interval()->FirstInstructionIndex(); | 113 int first_instr = range->first_interval()->FirstGapIndex(); |
114 if (!data()->code()->GetInstructionBlock(first_instr)->IsDeferred()) { | 114 if (!data()->code()->GetInstructionBlock(first_instr)->IsDeferred()) { |
115 SplinterLiveRange(range, data()); | 115 SplinterLiveRange(range, data()); |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 void LiveRangeMerger::MarkRangesSpilledInDeferredBlocks() { | 121 void LiveRangeMerger::MarkRangesSpilledInDeferredBlocks() { |
122 for (TopLevelLiveRange *top : data()->live_ranges()) { | 122 for (TopLevelLiveRange *top : data()->live_ranges()) { |
123 if (top == nullptr || top->IsEmpty() || top->splinter() == nullptr) { | 123 if (top == nullptr || top->IsEmpty() || top->splinter() == nullptr) { |
(...skipping 26 matching lines...) Expand all Loading... |
150 int to_remove = range->vreg(); | 150 int to_remove = range->vreg(); |
151 splinter_parent->Merge(range, data()->allocation_zone()); | 151 splinter_parent->Merge(range, data()->allocation_zone()); |
152 data()->live_ranges()[to_remove] = nullptr; | 152 data()->live_ranges()[to_remove] = nullptr; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 } // namespace compiler | 157 } // namespace compiler |
158 } // namespace internal | 158 } // namespace internal |
159 } // namespace v8 | 159 } // namespace v8 |
OLD | NEW |