| 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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 auto output_operand = last_instruction->OutputAt(i); | 1055 auto output_operand = last_instruction->OutputAt(i); |
| 1056 DCHECK(!output_operand->IsConstant()); | 1056 DCHECK(!output_operand->IsConstant()); |
| 1057 auto output = UnallocatedOperand::cast(output_operand); | 1057 auto output = UnallocatedOperand::cast(output_operand); |
| 1058 int output_vreg = output->virtual_register(); | 1058 int output_vreg = output->virtual_register(); |
| 1059 auto range = LiveRangeFor(output_vreg); | 1059 auto range = LiveRangeFor(output_vreg); |
| 1060 bool assigned = false; | 1060 bool assigned = false; |
| 1061 if (output->HasFixedPolicy()) { | 1061 if (output->HasFixedPolicy()) { |
| 1062 AllocateFixed(output, -1, false); | 1062 AllocateFixed(output, -1, false); |
| 1063 // This value is produced on the stack, we never need to spill it. | 1063 // This value is produced on the stack, we never need to spill it. |
| 1064 if (output->IsStackSlot()) { | 1064 if (output->IsStackSlot()) { |
| 1065 DCHECK(output->index() < 0); | 1065 DCHECK(output->index() < frame_->GetSpillSlotCount()); |
| 1066 range->SetSpillOperand(output); | 1066 range->SetSpillOperand(output); |
| 1067 range->SetSpillStartIndex(end); | 1067 range->SetSpillStartIndex(end); |
| 1068 assigned = true; | 1068 assigned = true; |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 for (auto succ : block->successors()) { | 1071 for (auto succ : block->successors()) { |
| 1072 const InstructionBlock* successor = code()->InstructionBlockAt(succ); | 1072 const InstructionBlock* successor = code()->InstructionBlockAt(succ); |
| 1073 DCHECK(successor->PredecessorCount() == 1); | 1073 DCHECK(successor->PredecessorCount() == 1); |
| 1074 int gap_index = successor->first_instruction_index() + 1; | 1074 int gap_index = successor->first_instruction_index() + 1; |
| 1075 DCHECK(code()->IsGapAt(gap_index)); | 1075 DCHECK(code()->IsGapAt(gap_index)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 auto first_output = UnallocatedOperand::cast(output); | 1121 auto first_output = UnallocatedOperand::cast(output); |
| 1122 auto range = LiveRangeFor(first_output->virtual_register()); | 1122 auto range = LiveRangeFor(first_output->virtual_register()); |
| 1123 bool assigned = false; | 1123 bool assigned = false; |
| 1124 if (first_output->HasFixedPolicy()) { | 1124 if (first_output->HasFixedPolicy()) { |
| 1125 auto output_copy = first_output->CopyUnconstrained(code_zone()); | 1125 auto output_copy = first_output->CopyUnconstrained(code_zone()); |
| 1126 bool is_tagged = HasTaggedValue(first_output->virtual_register()); | 1126 bool is_tagged = HasTaggedValue(first_output->virtual_register()); |
| 1127 AllocateFixed(first_output, gap_index, is_tagged); | 1127 AllocateFixed(first_output, gap_index, is_tagged); |
| 1128 | 1128 |
| 1129 // This value is produced on the stack, we never need to spill it. | 1129 // This value is produced on the stack, we never need to spill it. |
| 1130 if (first_output->IsStackSlot()) { | 1130 if (first_output->IsStackSlot()) { |
| 1131 DCHECK(first_output->index() < 0); | 1131 DCHECK(first_output->index() < frame_->GetSpillSlotCount()); |
| 1132 range->SetSpillOperand(first_output); | 1132 range->SetSpillOperand(first_output); |
| 1133 range->SetSpillStartIndex(gap_index - 1); | 1133 range->SetSpillStartIndex(gap_index - 1); |
| 1134 assigned = true; | 1134 assigned = true; |
| 1135 } | 1135 } |
| 1136 AddGapMove(gap_index, GapInstruction::START, first_output, | 1136 AddGapMove(gap_index, GapInstruction::START, first_output, |
| 1137 output_copy); | 1137 output_copy); |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 // Make sure we add a gap move for spilling (if we have not done | 1140 // Make sure we add a gap move for spilling (if we have not done |
| 1141 // so already). | 1141 // so already). |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 } else { | 2470 } else { |
| 2471 DCHECK(range->Kind() == GENERAL_REGISTERS); | 2471 DCHECK(range->Kind() == GENERAL_REGISTERS); |
| 2472 assigned_registers_->Add(reg); | 2472 assigned_registers_->Add(reg); |
| 2473 } | 2473 } |
| 2474 range->set_assigned_register(reg, code_zone()); | 2474 range->set_assigned_register(reg, code_zone()); |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 } // namespace compiler | 2477 } // namespace compiler |
| 2478 } // namespace internal | 2478 } // namespace internal |
| 2479 } // namespace v8 | 2479 } // namespace v8 |
| OLD | NEW |