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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 int first_instr = range->first_interval()->FirstGapIndex(); | 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 const InstructionSequence *code = data()->code(); |
122 for (TopLevelLiveRange *top : data()->live_ranges()) { | 123 for (TopLevelLiveRange *top : data()->live_ranges()) { |
123 if (top == nullptr || top->IsEmpty() || top->splinter() == nullptr || | 124 if (top == nullptr || top->IsEmpty() || top->splinter() == nullptr || |
124 top->HasSpillOperand() || !top->splinter()->HasSpillRange()) { | 125 top->HasSpillOperand() || !top->splinter()->HasSpillRange()) { |
125 continue; | 126 continue; |
126 } | 127 } |
127 | 128 |
128 LiveRange *child = top; | 129 LiveRange *child = top; |
129 for (; child != nullptr; child = child->next()) { | 130 for (; child != nullptr; child = child->next()) { |
130 if (child->spilled() || | 131 if (child->spilled() || |
131 child->NextSlotPosition(child->Start()) != nullptr) { | 132 child->NextSlotPosition(child->Start()) != nullptr) { |
132 break; | 133 break; |
133 } | 134 } |
134 } | 135 } |
135 if (child == nullptr) top->MarkSpilledInDeferredBlock(); | 136 if (child == nullptr) { |
| 137 top->TreatAsSpilledInDeferredBlock(data()->allocation_zone(), |
| 138 code->InstructionBlockCount()); |
| 139 } |
136 } | 140 } |
137 } | 141 } |
138 | 142 |
139 | 143 |
140 void LiveRangeMerger::Merge() { | 144 void LiveRangeMerger::Merge() { |
141 MarkRangesSpilledInDeferredBlocks(); | 145 MarkRangesSpilledInDeferredBlocks(); |
142 | 146 |
143 int live_range_count = static_cast<int>(data()->live_ranges().size()); | 147 int live_range_count = static_cast<int>(data()->live_ranges().size()); |
144 for (int i = 0; i < live_range_count; ++i) { | 148 for (int i = 0; i < live_range_count; ++i) { |
145 TopLevelLiveRange *range = data()->live_ranges()[i]; | 149 TopLevelLiveRange *range = data()->live_ranges()[i]; |
146 if (range == nullptr || range->IsEmpty() || !range->IsSplinter()) { | 150 if (range == nullptr || range->IsEmpty() || !range->IsSplinter()) { |
147 continue; | 151 continue; |
148 } | 152 } |
149 TopLevelLiveRange *splinter_parent = range->splintered_from(); | 153 TopLevelLiveRange *splinter_parent = range->splintered_from(); |
150 | 154 |
151 int to_remove = range->vreg(); | 155 int to_remove = range->vreg(); |
152 splinter_parent->Merge(range, data()->allocation_zone()); | 156 splinter_parent->Merge(range, data()->allocation_zone()); |
153 data()->live_ranges()[to_remove] = nullptr; | 157 data()->live_ranges()[to_remove] = nullptr; |
154 } | 158 } |
155 } | 159 } |
156 | 160 |
157 | 161 |
158 } // namespace compiler | 162 } // namespace compiler |
159 } // namespace internal | 163 } // namespace internal |
160 } // namespace v8 | 164 } // namespace v8 |
OLD | NEW |