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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 float GetAllocatedRangeWeight(float candidate_weight); | 118 float GetAllocatedRangeWeight(float candidate_weight); |
119 | 119 |
120 // Returns kInvalidWeight if there are no conflicts, or the largest weight of | 120 // Returns kInvalidWeight if there are no conflicts, or the largest weight of |
121 // a range conflicting with the given range, at the given register. | 121 // a range conflicting with the given range, at the given register. |
122 float GetMaximumConflictingWeight(unsigned reg_id, | 122 float GetMaximumConflictingWeight(unsigned reg_id, |
123 const LiveRange* range) const; | 123 const LiveRange* range) const; |
124 | 124 |
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. |
| 129 LifetimePosition FindSplitPositionAfterCall(const LiveRange* range, |
| 130 int call_index); |
| 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. |
| 133 bool TrySplitAroundCalls(LiveRange* range); |
| 134 |
| 135 // 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 |
| 137 // returns the section after the call. The return is: |
| 138 // - same range, if no call was found |
| 139 // - nullptr, if the range finished at the call and there's no "after the |
| 140 // call" portion. |
| 141 // - the portion after the call. |
| 142 LiveRange* GetRemainderAfterSplittingAroundFirstCall(LiveRange* range); |
| 143 |
128 // Necessary heuristic: spill when all else failed. | 144 // Necessary heuristic: spill when all else failed. |
129 void SpillRangeAsLastResort(LiveRange* range); | 145 void SpillRangeAsLastResort(LiveRange* range); |
130 | 146 |
131 void AssignRangeToRegister(int reg_id, LiveRange* range); | 147 void AssignRangeToRegister(int reg_id, LiveRange* range); |
132 | 148 |
133 Zone* local_zone_; | 149 Zone* local_zone_; |
134 ZoneVector<CoalescedLiveRanges*> allocations_; | 150 ZoneVector<CoalescedLiveRanges*> allocations_; |
135 AllocationScheduler scheduler_; | 151 AllocationScheduler scheduler_; |
136 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); | 152 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); |
137 }; | 153 }; |
138 } // namespace compiler | 154 } // namespace compiler |
139 } // namespace internal | 155 } // namespace internal |
140 } // namespace v8 | 156 } // namespace v8 |
141 #endif // V8_GREEDY_ALLOCATOR_H_ | 157 #endif // V8_GREEDY_ALLOCATOR_H_ |
OLD | NEW |