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 #ifndef V8_GREEDY_ALLOCATOR_H_ | 5 #ifndef V8_GREEDY_ALLOCATOR_H_ |
6 #define V8_GREEDY_ALLOCATOR_H_ | 6 #define V8_GREEDY_ALLOCATOR_H_ |
7 | 7 |
8 #include "src/compiler/coalesced-live-ranges.h" | 8 #include "src/compiler/coalesced-live-ranges.h" |
9 #include "src/compiler/register-allocator.h" | 9 #include "src/compiler/register-allocator.h" |
10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // This is the extension point for splitting heuristics. | 125 // This is the extension point for splitting heuristics. |
126 void SplitOrSpillBlockedRange(LiveRange* range); | 126 void SplitOrSpillBlockedRange(LiveRange* range); |
127 | 127 |
128 // Find a good position where to fill, after a range was spilled after a call. | 128 // Find a good position where to fill, after a range was spilled after a call. |
129 LifetimePosition FindSplitPositionAfterCall(const LiveRange* range, | 129 LifetimePosition FindSplitPositionAfterCall(const LiveRange* range, |
130 int call_index); | 130 int call_index); |
131 // Split a range around all calls it passes over. Returns true if any changes | 131 // Split a range around all calls it passes over. Returns true if any changes |
132 // were made, or false if no calls were found. | 132 // were made, or false if no calls were found. |
133 bool TrySplitAroundCalls(LiveRange* range); | 133 bool TrySplitAroundCalls(LiveRange* range); |
134 | 134 |
| 135 // Find a split position at the outmost loop. |
| 136 LifetimePosition FindSplitPositionBeforeLoops(LiveRange* range); |
| 137 |
135 // Finds the first call instruction in the path of this range. Splits before | 138 // Finds the first call instruction in the path of this range. Splits before |
136 // and requeues that segment (if any), spills the section over the call, and | 139 // and requeues that segment (if any), spills the section over the call, and |
137 // returns the section after the call. The return is: | 140 // returns the section after the call. The return is: |
138 // - same range, if no call was found | 141 // - same range, if no call was found |
139 // - nullptr, if the range finished at the call and there's no "after the | 142 // - nullptr, if the range finished at the call and there's no "after the |
140 // call" portion. | 143 // call" portion. |
141 // - the portion after the call. | 144 // - the portion after the call. |
142 LiveRange* GetRemainderAfterSplittingAroundFirstCall(LiveRange* range); | 145 LiveRange* GetRemainderAfterSplittingAroundFirstCall(LiveRange* range); |
143 | 146 |
144 // Necessary heuristic: spill when all else failed. | 147 // Necessary heuristic: spill when all else failed. |
145 void SpillRangeAsLastResort(LiveRange* range); | 148 void SpillRangeAsLastResort(LiveRange* range); |
146 | 149 |
147 void AssignRangeToRegister(int reg_id, LiveRange* range); | 150 void AssignRangeToRegister(int reg_id, LiveRange* range); |
148 | 151 |
149 Zone* local_zone_; | 152 Zone* local_zone_; |
150 ZoneVector<CoalescedLiveRanges*> allocations_; | 153 ZoneVector<CoalescedLiveRanges*> allocations_; |
151 AllocationScheduler scheduler_; | 154 AllocationScheduler scheduler_; |
152 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); | 155 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); |
153 }; | 156 }; |
154 } // namespace compiler | 157 } // namespace compiler |
155 } // namespace internal | 158 } // namespace internal |
156 } // namespace v8 | 159 } // namespace v8 |
157 #endif // V8_GREEDY_ALLOCATOR_H_ | 160 #endif // V8_GREEDY_ALLOCATOR_H_ |
OLD | NEW |