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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 if (range->MayRequireSpillRange()) { | 44 if (range->MayRequireSpillRange()) { |
45 data->CreateSpillRangeForLiveRange(range); | 45 data->CreateSpillRangeForLiveRange(range); |
46 } | 46 } |
47 if (range->splinter() == nullptr) { | 47 if (range->splinter() == nullptr) { |
48 TopLevelLiveRange *splinter = data->NextLiveRange(range->machine_type()); | 48 TopLevelLiveRange *splinter = data->NextLiveRange(range->machine_type()); |
49 DCHECK_NULL(data->live_ranges()[splinter->vreg()]); | 49 DCHECK_NULL(data->live_ranges()[splinter->vreg()]); |
50 data->live_ranges()[splinter->vreg()] = splinter; | 50 data->live_ranges()[splinter->vreg()] = splinter; |
51 range->SetSplinter(splinter); | 51 range->SetSplinter(splinter); |
52 } | 52 } |
53 Zone *zone = data->allocation_zone(); | 53 Zone *zone = data->allocation_zone(); |
54 TRACE("creating splinter for range %d between %d and %d\n", range->vreg(), | |
55 start.ToInstructionIndex(), end.ToInstructionIndex()); | |
56 range->Splinter(start, end, zone); | 54 range->Splinter(start, end, zone); |
57 } | 55 } |
58 } | 56 } |
59 | 57 |
60 | 58 |
61 int FirstInstruction(const UseInterval *interval) { | 59 int FirstInstruction(const UseInterval *interval) { |
62 LifetimePosition start = interval->start(); | 60 LifetimePosition start = interval->start(); |
63 int ret = start.ToInstructionIndex(); | 61 int ret = start.ToInstructionIndex(); |
64 if (start.IsInstructionPosition() && start.IsEnd()) { | 62 if (start.IsInstructionPosition() && start.IsEnd()) { |
65 ++ret; | 63 ++ret; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (first_cut.IsValid()) { | 105 if (first_cut.IsValid()) { |
108 CreateSplinter(range, data, first_cut, last_cut); | 106 CreateSplinter(range, data, first_cut, last_cut); |
109 first_cut = LifetimePosition::Invalid(); | 107 first_cut = LifetimePosition::Invalid(); |
110 last_cut = LifetimePosition::Invalid(); | 108 last_cut = LifetimePosition::Invalid(); |
111 } | 109 } |
112 } | 110 } |
113 } | 111 } |
114 interval = next_interval; | 112 interval = next_interval; |
115 } | 113 } |
116 // When the range ends in deferred blocks, first_cut will be valid here. | 114 // When the range ends in deferred blocks, first_cut will be valid here. |
117 // Splinter from there to the last instruction that was in a deferred block. | |
118 if (first_cut.IsValid()) { | 115 if (first_cut.IsValid()) { |
119 CreateSplinter(range, data, first_cut, last_cut); | 116 CreateSplinter(range, data, first_cut, range->End()); |
120 } | 117 } |
121 } | 118 } |
122 } // namespace | 119 } // namespace |
123 | 120 |
124 | 121 |
125 void LiveRangeSeparator::Splinter() { | 122 void LiveRangeSeparator::Splinter() { |
126 size_t virt_reg_count = data()->live_ranges().size(); | 123 size_t virt_reg_count = data()->live_ranges().size(); |
127 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { | 124 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { |
128 TopLevelLiveRange *range = data()->live_ranges()[vreg]; | 125 TopLevelLiveRange *range = data()->live_ranges()[vreg]; |
129 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { | 126 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { |
(...skipping 16 matching lines...) Expand all Loading... |
146 int to_remove = range->vreg(); | 143 int to_remove = range->vreg(); |
147 splinter_parent->Merge(range, data()->allocation_zone()); | 144 splinter_parent->Merge(range, data()->allocation_zone()); |
148 data()->live_ranges()[to_remove] = nullptr; | 145 data()->live_ranges()[to_remove] = nullptr; |
149 } | 146 } |
150 } | 147 } |
151 | 148 |
152 | 149 |
153 } // namespace compiler | 150 } // namespace compiler |
154 } // namespace internal | 151 } // namespace internal |
155 } // namespace v8 | 152 } // namespace v8 |
OLD | NEW |