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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 LifetimePosition end = Min(last_cut, range->End()); | 71 LifetimePosition end = Min(last_cut, range->End()); |
72 | 72 |
73 if (start < end) { | 73 if (start < end) { |
74 // Ensure the original range has a spill range associated, before it gets | 74 // Ensure the original range has a spill range associated, before it gets |
75 // splintered. Splinters will point to it. This way, when attempting to | 75 // splintered. Splinters will point to it. This way, when attempting to |
76 // reuse spill slots of splinters, during allocation, we avoid clobbering | 76 // reuse spill slots of splinters, during allocation, we avoid clobbering |
77 // such slots. | 77 // such slots. |
78 if (range->MayRequireSpillRange()) { | 78 if (range->MayRequireSpillRange()) { |
79 data->CreateSpillRangeForLiveRange(range); | 79 data->CreateSpillRangeForLiveRange(range); |
80 } | 80 } |
81 if (range->splinter() == nullptr) { | 81 TopLevelLiveRange *result = data->NextLiveRange(range->machine_type()); |
82 TopLevelLiveRange *splinter = data->NextLiveRange(range->machine_type()); | 82 DCHECK_NULL(data->live_ranges()[result->vreg()]); |
83 DCHECK_NULL(data->live_ranges()[splinter->vreg()]); | 83 data->live_ranges()[result->vreg()] = result; |
84 data->live_ranges()[splinter->vreg()] = splinter; | 84 |
85 range->SetSplinter(splinter); | |
86 } | |
87 Zone *zone = data->allocation_zone(); | 85 Zone *zone = data->allocation_zone(); |
88 range->Splinter(start, end, zone); | 86 range->Splinter(start, end, result, zone); |
89 } | 87 } |
90 } | 88 } |
91 | 89 |
92 | 90 |
93 // Splinter all ranges live inside successive deferred blocks. | 91 // Splinter all ranges live inside successive deferred blocks. |
94 // No control flow analysis is performed. After the register allocation, we will | 92 // No control flow analysis is performed. After the register allocation, we will |
95 // merge the splinters back into the original ranges, and then rely on the | 93 // merge the splinters back into the original ranges, and then rely on the |
96 // range connector to properly connect them. | 94 // range connector to properly connect them. |
97 void SplinterRangesInDeferredBlocks(RegisterAllocationData *data) { | 95 void SplinterRangesInDeferredBlocks(RegisterAllocationData *data) { |
98 InstructionSequence *code = data->code(); | 96 InstructionSequence *code = data->code(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 int to_remove = range->vreg(); | 163 int to_remove = range->vreg(); |
166 splinter_parent->Merge(range, data()->allocation_zone()); | 164 splinter_parent->Merge(range, data()->allocation_zone()); |
167 data()->live_ranges()[to_remove] = nullptr; | 165 data()->live_ranges()[to_remove] = nullptr; |
168 } | 166 } |
169 } | 167 } |
170 | 168 |
171 | 169 |
172 } // namespace compiler | 170 } // namespace compiler |
173 } // namespace internal | 171 } // namespace internal |
174 } // namespace v8 | 172 } // namespace v8 |
OLD | NEW |