OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/linkage.h" | 6 #include "src/compiler/linkage.h" |
7 #include "src/compiler/register-allocator.h" | 7 #include "src/compiler/register-allocator.h" |
8 #include "src/string-stream.h" | 8 #include "src/string-stream.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 } | 2654 } |
2655 | 2655 |
2656 DCHECK(!current->HasRegisterAssigned() && !current->spilled()); | 2656 DCHECK(!current->HasRegisterAssigned() && !current->spilled()); |
2657 | 2657 |
2658 ProcessCurrentRange(current); | 2658 ProcessCurrentRange(current); |
2659 } | 2659 } |
2660 } | 2660 } |
2661 | 2661 |
2662 bool LinearScanAllocator::TrySplitAndSpillSplinter(LiveRange* range) { | 2662 bool LinearScanAllocator::TrySplitAndSpillSplinter(LiveRange* range) { |
2663 DCHECK(range->TopLevel()->IsSplinter()); | 2663 DCHECK(range->TopLevel()->IsSplinter()); |
2664 // If there was no hint, apply regular (hot path) heuristics. | |
2665 if (range->FirstHintPosition() == nullptr) return false; | |
2666 // If we can spill the whole range, great. Otherwise, split above the | 2664 // If we can spill the whole range, great. Otherwise, split above the |
2667 // first use needing a register and spill the top part. | 2665 // first use needing a register and spill the top part. |
2668 const UsePosition* next_reg = range->NextRegisterPosition(range->Start()); | 2666 const UsePosition* next_reg = range->NextRegisterPosition(range->Start()); |
2669 if (next_reg == nullptr) { | 2667 if (next_reg == nullptr) { |
2670 Spill(range); | 2668 Spill(range); |
2671 return true; | 2669 return true; |
| 2670 } else if (range->FirstHintPosition() == nullptr) { |
| 2671 // If there was no hint, but we have a use position requiring a |
| 2672 // register, apply the hot path heuristics. |
| 2673 return false; |
2672 } else if (next_reg->pos().PrevStart() > range->Start()) { | 2674 } else if (next_reg->pos().PrevStart() > range->Start()) { |
2673 LiveRange* tail = SplitRangeAt(range, next_reg->pos().PrevStart()); | 2675 LiveRange* tail = SplitRangeAt(range, next_reg->pos().PrevStart()); |
2674 AddToUnhandledSorted(tail); | 2676 AddToUnhandledSorted(tail); |
2675 Spill(range); | 2677 Spill(range); |
2676 return true; | 2678 return true; |
2677 } | 2679 } |
2678 return false; | 2680 return false; |
2679 } | 2681 } |
2680 | 2682 |
2681 void LinearScanAllocator::SetLiveRangeAssignedRegister(LiveRange* range, | 2683 void LinearScanAllocator::SetLiveRangeAssignedRegister(LiveRange* range, |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3715 } | 3717 } |
3716 } | 3718 } |
3717 } | 3719 } |
3718 } | 3720 } |
3719 } | 3721 } |
3720 | 3722 |
3721 | 3723 |
3722 } // namespace compiler | 3724 } // namespace compiler |
3723 } // namespace internal | 3725 } // namespace internal |
3724 } // namespace v8 | 3726 } // namespace v8 |
OLD | NEW |