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()); |
54 range->Splinter(start, end, zone); | 56 range->Splinter(start, end, zone); |
55 } | 57 } |
56 } | 58 } |
57 | 59 |
58 | 60 |
59 int FirstInstruction(const UseInterval *interval) { | 61 int FirstInstruction(const UseInterval *interval) { |
60 LifetimePosition start = interval->start(); | 62 LifetimePosition start = interval->start(); |
61 int ret = start.ToInstructionIndex(); | 63 int ret = start.ToInstructionIndex(); |
62 if (start.IsInstructionPosition() && start.IsEnd()) { | 64 if (start.IsInstructionPosition() && start.IsEnd()) { |
63 ++ret; | 65 ++ret; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 if (first_cut.IsValid()) { | 107 if (first_cut.IsValid()) { |
106 CreateSplinter(range, data, first_cut, last_cut); | 108 CreateSplinter(range, data, first_cut, last_cut); |
107 first_cut = LifetimePosition::Invalid(); | 109 first_cut = LifetimePosition::Invalid(); |
108 last_cut = LifetimePosition::Invalid(); | 110 last_cut = LifetimePosition::Invalid(); |
109 } | 111 } |
110 } | 112 } |
111 } | 113 } |
112 interval = next_interval; | 114 interval = next_interval; |
113 } | 115 } |
114 // When the range ends in deferred blocks, first_cut will be valid here. | 116 // 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. |
115 if (first_cut.IsValid()) { | 118 if (first_cut.IsValid()) { |
116 CreateSplinter(range, data, first_cut, range->End()); | 119 CreateSplinter(range, data, first_cut, last_cut); |
117 } | 120 } |
118 } | 121 } |
119 } // namespace | 122 } // namespace |
120 | 123 |
121 | 124 |
122 void LiveRangeSeparator::Splinter() { | 125 void LiveRangeSeparator::Splinter() { |
123 size_t virt_reg_count = data()->live_ranges().size(); | 126 size_t virt_reg_count = data()->live_ranges().size(); |
124 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { | 127 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { |
125 TopLevelLiveRange *range = data()->live_ranges()[vreg]; | 128 TopLevelLiveRange *range = data()->live_ranges()[vreg]; |
126 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { | 129 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { |
(...skipping 16 matching lines...) Expand all Loading... |
143 int to_remove = range->vreg(); | 146 int to_remove = range->vreg(); |
144 splinter_parent->Merge(range, data()->allocation_zone()); | 147 splinter_parent->Merge(range, data()->allocation_zone()); |
145 data()->live_ranges()[to_remove] = nullptr; | 148 data()->live_ranges()[to_remove] = nullptr; |
146 } | 149 } |
147 } | 150 } |
148 | 151 |
149 | 152 |
150 } // namespace compiler | 153 } // namespace compiler |
151 } // namespace internal | 154 } // namespace internal |
152 } // namespace v8 | 155 } // namespace v8 |
OLD | NEW |