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/compiler/linkage.h" | 5 #include "src/compiler/linkage.h" |
6 #include "src/compiler/register-allocator.h" | 6 #include "src/compiler/register-allocator.h" |
7 #include "src/string-stream.h" | 7 #include "src/string-stream.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 | 941 |
942 // Allocate slots for the merged spill ranges. | 942 // Allocate slots for the merged spill ranges. |
943 for (auto range : spill_ranges()) { | 943 for (auto range : spill_ranges()) { |
944 if (range->IsEmpty()) continue; | 944 if (range->IsEmpty()) continue; |
945 // Allocate a new operand referring to the spill slot. | 945 // Allocate a new operand referring to the spill slot. |
946 auto kind = range->Kind(); | 946 auto kind = range->Kind(); |
947 int index = frame()->AllocateSpillSlot(kind == DOUBLE_REGISTERS); | 947 int index = frame()->AllocateSpillSlot(kind == DOUBLE_REGISTERS); |
948 auto op_kind = kind == DOUBLE_REGISTERS | 948 auto op_kind = kind == DOUBLE_REGISTERS |
949 ? InstructionOperand::DOUBLE_STACK_SLOT | 949 ? InstructionOperand::DOUBLE_STACK_SLOT |
950 : InstructionOperand::STACK_SLOT; | 950 : InstructionOperand::STACK_SLOT; |
951 auto op = new (code_zone()) InstructionOperand(op_kind, index); | 951 auto op = InstructionOperand::New(code_zone(), op_kind, index); |
952 range->SetOperand(op); | 952 range->SetOperand(op); |
953 } | 953 } |
954 } | 954 } |
955 | 955 |
956 | 956 |
957 void RegisterAllocator::CommitAssignment() { | 957 void RegisterAllocator::CommitAssignment() { |
958 for (auto range : live_ranges()) { | 958 for (auto range : live_ranges()) { |
959 if (range == nullptr || range->IsEmpty()) continue; | 959 if (range == nullptr || range->IsEmpty()) continue; |
960 // Register assignments were committed in set_assigned_register. | 960 // Register assignments were committed in set_assigned_register. |
961 if (range->HasRegisterAssigned()) continue; | 961 if (range->HasRegisterAssigned()) continue; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 } | 1098 } |
1099 | 1099 |
1100 for (auto succ : block->successors()) { | 1100 for (auto succ : block->successors()) { |
1101 const InstructionBlock* successor = code()->InstructionBlockAt(succ); | 1101 const InstructionBlock* successor = code()->InstructionBlockAt(succ); |
1102 DCHECK(successor->PredecessorCount() == 1); | 1102 DCHECK(successor->PredecessorCount() == 1); |
1103 int gap_index = successor->first_instruction_index(); | 1103 int gap_index = successor->first_instruction_index(); |
1104 DCHECK(code()->IsGapAt(gap_index)); | 1104 DCHECK(code()->IsGapAt(gap_index)); |
1105 | 1105 |
1106 // Create an unconstrained operand for the same virtual register | 1106 // Create an unconstrained operand for the same virtual register |
1107 // and insert a gap move from the fixed output to the operand. | 1107 // and insert a gap move from the fixed output to the operand. |
1108 UnallocatedOperand* output_copy = new (code_zone()) | 1108 UnallocatedOperand* output_copy = |
1109 UnallocatedOperand(UnallocatedOperand::ANY, output_vreg); | 1109 UnallocatedOperand(UnallocatedOperand::ANY, output_vreg) |
1110 | 1110 .Copy(code_zone()); |
1111 AddGapMove(gap_index, GapInstruction::START, output, output_copy); | 1111 AddGapMove(gap_index, GapInstruction::START, output, output_copy); |
1112 } | 1112 } |
1113 } | 1113 } |
1114 | 1114 |
1115 if (!assigned) { | 1115 if (!assigned) { |
1116 for (auto succ : block->successors()) { | 1116 for (auto succ : block->successors()) { |
1117 const InstructionBlock* successor = code()->InstructionBlockAt(succ); | 1117 const InstructionBlock* successor = code()->InstructionBlockAt(succ); |
1118 DCHECK(successor->PredecessorCount() == 1); | 1118 DCHECK(successor->PredecessorCount() == 1); |
1119 int gap_index = successor->first_instruction_index(); | 1119 int gap_index = successor->first_instruction_index(); |
1120 range->SpillAtDefinition(local_zone(), gap_index, output); | 1120 range->SpillAtDefinition(local_zone(), gap_index, output); |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 } else { | 2504 } else { |
2505 DCHECK(range->Kind() == GENERAL_REGISTERS); | 2505 DCHECK(range->Kind() == GENERAL_REGISTERS); |
2506 assigned_registers_->Add(reg); | 2506 assigned_registers_->Add(reg); |
2507 } | 2507 } |
2508 range->set_assigned_register(reg, operand_cache()); | 2508 range->set_assigned_register(reg, operand_cache()); |
2509 } | 2509 } |
2510 | 2510 |
2511 } // namespace compiler | 2511 } // namespace compiler |
2512 } // namespace internal | 2512 } // namespace internal |
2513 } // namespace v8 | 2513 } // namespace v8 |
OLD | NEW |