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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 data->live_ranges()[splinter->vreg()] = splinter; | 51 data->live_ranges()[splinter->vreg()] = splinter; |
52 range->SetSplinter(splinter); | 52 range->SetSplinter(splinter); |
53 } | 53 } |
54 Zone *zone = data->allocation_zone(); | 54 Zone *zone = data->allocation_zone(); |
55 TRACE("creating splinter for range %d between %d and %d\n", range->vreg(), | 55 TRACE("creating splinter for range %d between %d and %d\n", range->vreg(), |
56 start.ToInstructionIndex(), end.ToInstructionIndex()); | 56 start.ToInstructionIndex(), end.ToInstructionIndex()); |
57 range->Splinter(start, end, zone); | 57 range->Splinter(start, end, zone); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
| 61 void SetSlotUse(TopLevelLiveRange *range) { |
| 62 range->set_has_slot_use(false); |
| 63 for (const UsePosition *pos = range->first_pos(); |
| 64 !range->has_slot_use() && pos != nullptr; pos = pos->next()) { |
| 65 if (pos->type() == UsePositionType::kRequiresSlot) { |
| 66 range->set_has_slot_use(true); |
| 67 } |
| 68 } |
| 69 } |
61 | 70 |
62 void SplinterLiveRange(TopLevelLiveRange *range, RegisterAllocationData *data) { | 71 void SplinterLiveRange(TopLevelLiveRange *range, RegisterAllocationData *data) { |
63 const InstructionSequence *code = data->code(); | 72 const InstructionSequence *code = data->code(); |
64 UseInterval *interval = range->first_interval(); | 73 UseInterval *interval = range->first_interval(); |
65 | 74 |
66 LifetimePosition first_cut = LifetimePosition::Invalid(); | 75 LifetimePosition first_cut = LifetimePosition::Invalid(); |
67 LifetimePosition last_cut = LifetimePosition::Invalid(); | 76 LifetimePosition last_cut = LifetimePosition::Invalid(); |
68 | 77 |
69 while (interval != nullptr) { | 78 while (interval != nullptr) { |
70 UseInterval *next_interval = interval->next(); | 79 UseInterval *next_interval = interval->next(); |
(...skipping 21 matching lines...) Expand all Loading... |
92 } | 101 } |
93 } | 102 } |
94 } | 103 } |
95 interval = next_interval; | 104 interval = next_interval; |
96 } | 105 } |
97 // When the range ends in deferred blocks, first_cut will be valid here. | 106 // When the range ends in deferred blocks, first_cut will be valid here. |
98 // Splinter from there to the last instruction that was in a deferred block. | 107 // Splinter from there to the last instruction that was in a deferred block. |
99 if (first_cut.IsValid()) { | 108 if (first_cut.IsValid()) { |
100 CreateSplinter(range, data, first_cut, last_cut); | 109 CreateSplinter(range, data, first_cut, last_cut); |
101 } | 110 } |
| 111 |
| 112 // Redo has_slot_use |
| 113 if (range->has_slot_use() && range->splinter() != nullptr) { |
| 114 SetSlotUse(range); |
| 115 SetSlotUse(range->splinter()); |
| 116 } |
102 } | 117 } |
| 118 |
103 } // namespace | 119 } // namespace |
104 | 120 |
105 | 121 |
106 void LiveRangeSeparator::Splinter() { | 122 void LiveRangeSeparator::Splinter() { |
107 size_t virt_reg_count = data()->live_ranges().size(); | 123 size_t virt_reg_count = data()->live_ranges().size(); |
108 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { | 124 for (size_t vreg = 0; vreg < virt_reg_count; ++vreg) { |
109 TopLevelLiveRange *range = data()->live_ranges()[vreg]; | 125 TopLevelLiveRange *range = data()->live_ranges()[vreg]; |
110 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { | 126 if (range == nullptr || range->IsEmpty() || range->IsSplinter()) { |
111 continue; | 127 continue; |
112 } | 128 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 int to_remove = range->vreg(); | 171 int to_remove = range->vreg(); |
156 splinter_parent->Merge(range, data()->allocation_zone()); | 172 splinter_parent->Merge(range, data()->allocation_zone()); |
157 data()->live_ranges()[to_remove] = nullptr; | 173 data()->live_ranges()[to_remove] = nullptr; |
158 } | 174 } |
159 } | 175 } |
160 | 176 |
161 | 177 |
162 } // namespace compiler | 178 } // namespace compiler |
163 } // namespace internal | 179 } // namespace internal |
164 } // namespace v8 | 180 } // namespace v8 |
OLD | NEW |