| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 // Finds the first call instruction in the path of this range. Splits before | 173 // Finds the first call instruction in the path of this range. Splits before |
| 174 // and requeues that segment (if any), spills the section over the call, and | 174 // and requeues that segment (if any), spills the section over the call, and |
| 175 // returns the section after the call. The return is: | 175 // returns the section after the call. The return is: |
| 176 // - same range, if no call was found | 176 // - same range, if no call was found |
| 177 // - nullptr, if the range finished at the call and there's no "after the | 177 // - nullptr, if the range finished at the call and there's no "after the |
| 178 // call" portion. | 178 // call" portion. |
| 179 // - the portion after the call. | 179 // - the portion after the call. |
| 180 LiveRange* GetRemainderAfterSplittingAroundFirstCall(LiveRange* range); | 180 LiveRange* GetRemainderAfterSplittingAroundFirstCall(LiveRange* range); |
| 181 | 181 |
| 182 // While we attempt to merge spill ranges later on in the allocation pipeline, |
| 183 // we want to ensure group elements get merged. Waiting until later may hinder |
| 184 // merge-ability, since the pipeline merger (being naive) may create conflicts |
| 185 // between spill ranges of group members. |
| 186 void TryReuseSpillRangesForGroups(); |
| 187 |
| 182 // Necessary heuristic: spill when all else failed. | 188 // Necessary heuristic: spill when all else failed. |
| 183 void SpillRangeAsLastResort(LiveRange* range); | 189 void SpillRangeAsLastResort(LiveRange* range); |
| 184 | 190 |
| 185 void AssignRangeToRegister(int reg_id, LiveRange* range); | 191 void AssignRangeToRegister(int reg_id, LiveRange* range); |
| 186 | 192 |
| 187 Zone* local_zone_; | 193 Zone* local_zone_; |
| 188 ZoneVector<CoalescedLiveRanges*> allocations_; | 194 ZoneVector<CoalescedLiveRanges*> allocations_; |
| 189 AllocationScheduler scheduler_; | 195 AllocationScheduler scheduler_; |
| 190 ZoneVector<LiveRangeGroup*> groups_; | 196 ZoneVector<LiveRangeGroup*> groups_; |
| 191 | 197 |
| 192 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); | 198 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); |
| 193 }; | 199 }; |
| 194 } // namespace compiler | 200 } // namespace compiler |
| 195 } // namespace internal | 201 } // namespace internal |
| 196 } // namespace v8 | 202 } // namespace v8 |
| 197 #endif // V8_GREEDY_ALLOCATOR_H_ | 203 #endif // V8_GREEDY_ALLOCATOR_H_ |
| OLD | NEW |