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 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 return true; | 2683 return true; |
2684 } | 2684 } |
2685 | 2685 |
2686 auto second_part = SplitRangeAt(current, register_use->pos()); | 2686 auto second_part = SplitRangeAt(current, register_use->pos()); |
2687 Spill(second_part); | 2687 Spill(second_part); |
2688 | 2688 |
2689 return true; | 2689 return true; |
2690 } | 2690 } |
2691 | 2691 |
2692 | 2692 |
| 2693 SpillSlotLocator::SpillSlotLocator(RegisterAllocationData* data) |
| 2694 : data_(data) {} |
| 2695 |
| 2696 |
| 2697 void SpillSlotLocator::LocateSpillSlots() { |
| 2698 auto code = data()->code(); |
| 2699 for (auto range : data()->live_ranges()) { |
| 2700 if (range == nullptr || range->IsEmpty() || range->IsChild()) continue; |
| 2701 // We care only about ranges which spill in the frame. |
| 2702 if (!range->HasSpillRange()) continue; |
| 2703 auto spills = range->spills_at_definition(); |
| 2704 DCHECK_NOT_NULL(spills); |
| 2705 for (; spills != nullptr; spills = spills->next) { |
| 2706 code->GetInstructionBlock(spills->gap_index)->mark_needs_frame(); |
| 2707 } |
| 2708 } |
| 2709 } |
| 2710 |
| 2711 |
2693 OperandAssigner::OperandAssigner(RegisterAllocationData* data) : data_(data) {} | 2712 OperandAssigner::OperandAssigner(RegisterAllocationData* data) : data_(data) {} |
2694 | 2713 |
2695 | 2714 |
2696 void OperandAssigner::AssignSpillSlots() { | 2715 void OperandAssigner::AssignSpillSlots() { |
2697 auto& spill_ranges = data()->spill_ranges(); | 2716 auto& spill_ranges = data()->spill_ranges(); |
2698 // Merge disjoint spill ranges | 2717 // Merge disjoint spill ranges |
2699 for (size_t i = 0; i < spill_ranges.size(); i++) { | 2718 for (size_t i = 0; i < spill_ranges.size(); i++) { |
2700 auto range = spill_ranges[i]; | 2719 auto range = spill_ranges[i]; |
2701 if (range->IsEmpty()) continue; | 2720 if (range->IsEmpty()) continue; |
2702 for (size_t j = i + 1; j < spill_ranges.size(); j++) { | 2721 for (size_t j = i + 1; j < spill_ranges.size(); j++) { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3126 auto eliminate = moves->PrepareInsertAfter(move); | 3145 auto eliminate = moves->PrepareInsertAfter(move); |
3127 to_insert.push_back(move); | 3146 to_insert.push_back(move); |
3128 if (eliminate != nullptr) to_eliminate.push_back(eliminate); | 3147 if (eliminate != nullptr) to_eliminate.push_back(eliminate); |
3129 } | 3148 } |
3130 } | 3149 } |
3131 | 3150 |
3132 | 3151 |
3133 } // namespace compiler | 3152 } // namespace compiler |
3134 } // namespace internal | 3153 } // namespace internal |
3135 } // namespace v8 | 3154 } // namespace v8 |
OLD | NEW |