Chromium Code Reviews| 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/greedy-allocator.h" | 5 #include "src/compiler/greedy-allocator.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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 EnsureValidRangeWeight(fixed_range); | 171 EnsureValidRangeWeight(fixed_range); |
| 172 AllocateRegisterToRange(reg_nr, fixed_range); | 172 AllocateRegisterToRange(reg_nr, fixed_range); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| 178 void GreedyAllocator::GroupLiveRanges() { | 178 void GreedyAllocator::GroupLiveRanges() { |
| 179 CoalescedLiveRanges groupper(local_zone()); | 179 CoalescedLiveRanges groupper(local_zone()); |
| 180 for (TopLevelLiveRange* range : data()->live_ranges()) { | 180 for (TopLevelLiveRange* range : data()->live_ranges()) { |
| 181 groupper.clear(); | |
|
Jarin
2015/09/16 21:28:00
nit: groupper should be with single p.
| |
| 181 // Skip splinters, because we do not want to optimize for them, and moves | 182 // Skip splinters, because we do not want to optimize for them, and moves |
| 182 // due to assigning them to different registers occur in deferred blocks. | 183 // due to assigning them to different registers occur in deferred blocks. |
| 183 if (!CanProcessRange(range) || range->IsSplinter() || !range->is_phi()) { | 184 if (!CanProcessRange(range) || range->IsSplinter() || !range->is_phi()) { |
| 184 continue; | 185 continue; |
| 185 } | 186 } |
| 186 | 187 |
| 187 // A phi can't be a memory operand, so it couldn't have been split. | 188 // A phi can't be a memory operand, so it couldn't have been split. |
| 188 DCHECK(!range->spilled()); | 189 DCHECK(!range->spilled()); |
| 189 | 190 |
| 190 // Maybe this phi range is itself an input to another phi which was already | 191 // Maybe this phi range is itself an input to another phi which was already |
| 191 // processed. | 192 // processed. |
| 192 LiveRangeGroup* latest_grp = range->group() != nullptr | 193 LiveRangeGroup* latest_grp = range->group() != nullptr |
| 193 ? range->group() | 194 ? range->group() |
| 194 : new (local_zone()) | 195 : new (local_zone()) |
| 195 LiveRangeGroup(local_zone()); | 196 LiveRangeGroup(local_zone()); |
| 196 | 197 |
| 197 // Populate the groupper. | 198 // Populate the groupper. |
| 198 if (range->group() == nullptr) { | 199 if (range->group() == nullptr) { |
| 199 groupper.clear(); | |
| 200 groupper.AllocateRange(range); | 200 groupper.AllocateRange(range); |
| 201 } else { | 201 } else { |
| 202 for (LiveRange* member : range->group()->ranges()) { | 202 for (LiveRange* member : range->group()->ranges()) { |
| 203 groupper.AllocateRange(member); | 203 groupper.AllocateRange(member); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 for (int j : data()->GetPhiMapValueFor(range)->phi()->operands()) { | 206 for (int j : data()->GetPhiMapValueFor(range)->phi()->operands()) { |
| 207 // skip output also in input, which may happen for loops. | 207 // skip output also in input, which may happen for loops. |
| 208 if (j == range->vreg()) continue; | 208 if (j == range->vreg()) continue; |
| 209 | 209 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 scheduler().Schedule(range); | 659 scheduler().Schedule(range); |
| 660 return; | 660 return; |
| 661 } | 661 } |
| 662 SpillRangeAsLastResort(range); | 662 SpillRangeAsLastResort(range); |
| 663 } | 663 } |
| 664 | 664 |
| 665 | 665 |
| 666 } // namespace compiler | 666 } // namespace compiler |
| 667 } // namespace internal | 667 } // namespace internal |
| 668 } // namespace v8 | 668 } // namespace v8 |
| OLD | NEW |