| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 700   return -index - 1 - config()->num_general_registers(); | 700   return -index - 1 - config()->num_general_registers(); | 
| 701 } | 701 } | 
| 702 | 702 | 
| 703 | 703 | 
| 704 InstructionOperand* RegisterAllocator::AllocateFixed( | 704 InstructionOperand* RegisterAllocator::AllocateFixed( | 
| 705     UnallocatedOperand* operand, int pos, bool is_tagged) { | 705     UnallocatedOperand* operand, int pos, bool is_tagged) { | 
| 706   TRACE("Allocating fixed reg for op %d\n", operand->virtual_register()); | 706   TRACE("Allocating fixed reg for op %d\n", operand->virtual_register()); | 
| 707   DCHECK(operand->HasFixedPolicy()); | 707   DCHECK(operand->HasFixedPolicy()); | 
| 708   InstructionOperand allocated; | 708   InstructionOperand allocated; | 
| 709   if (operand->HasFixedSlotPolicy()) { | 709   if (operand->HasFixedSlotPolicy()) { | 
| 710     allocated = AllocatedOperand(InstructionOperand::STACK_SLOT, | 710     allocated = AllocatedOperand(AllocatedOperand::STACK_SLOT, | 
| 711                                  operand->fixed_slot_index()); | 711                                  operand->fixed_slot_index()); | 
| 712   } else if (operand->HasFixedRegisterPolicy()) { | 712   } else if (operand->HasFixedRegisterPolicy()) { | 
| 713     allocated = AllocatedOperand(InstructionOperand::REGISTER, | 713     allocated = AllocatedOperand(AllocatedOperand::REGISTER, | 
| 714                                  operand->fixed_register_index()); | 714                                  operand->fixed_register_index()); | 
| 715   } else if (operand->HasFixedDoubleRegisterPolicy()) { | 715   } else if (operand->HasFixedDoubleRegisterPolicy()) { | 
| 716     allocated = AllocatedOperand(InstructionOperand::DOUBLE_REGISTER, | 716     allocated = AllocatedOperand(AllocatedOperand::DOUBLE_REGISTER, | 
| 717                                  operand->fixed_register_index()); | 717                                  operand->fixed_register_index()); | 
| 718   } else { | 718   } else { | 
| 719     UNREACHABLE(); | 719     UNREACHABLE(); | 
| 720   } | 720   } | 
| 721   InstructionOperand::ReplaceWith(operand, &allocated); | 721   InstructionOperand::ReplaceWith(operand, &allocated); | 
| 722   if (is_tagged) { | 722   if (is_tagged) { | 
| 723     TRACE("Fixed reg is tagged at %d\n", pos); | 723     TRACE("Fixed reg is tagged at %d\n", pos); | 
| 724     auto instr = InstructionAt(pos); | 724     auto instr = InstructionAt(pos); | 
| 725     if (instr->HasPointerMap()) { | 725     if (instr->HasPointerMap()) { | 
| 726       instr->pointer_map()->RecordPointer(operand, code_zone()); | 726       instr->pointer_map()->RecordPointer(operand, code_zone()); | 
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 969     } | 969     } | 
| 970   } | 970   } | 
| 971 | 971 | 
| 972   // Allocate slots for the merged spill ranges. | 972   // Allocate slots for the merged spill ranges. | 
| 973   for (auto range : spill_ranges()) { | 973   for (auto range : spill_ranges()) { | 
| 974     if (range->IsEmpty()) continue; | 974     if (range->IsEmpty()) continue; | 
| 975     // Allocate a new operand referring to the spill slot. | 975     // Allocate a new operand referring to the spill slot. | 
| 976     auto kind = range->Kind(); | 976     auto kind = range->Kind(); | 
| 977     int index = frame()->AllocateSpillSlot(kind == DOUBLE_REGISTERS); | 977     int index = frame()->AllocateSpillSlot(kind == DOUBLE_REGISTERS); | 
| 978     auto op_kind = kind == DOUBLE_REGISTERS | 978     auto op_kind = kind == DOUBLE_REGISTERS | 
| 979                        ? InstructionOperand::DOUBLE_STACK_SLOT | 979                        ? AllocatedOperand::DOUBLE_STACK_SLOT | 
| 980                        : InstructionOperand::STACK_SLOT; | 980                        : AllocatedOperand::STACK_SLOT; | 
| 981     auto op = AllocatedOperand::New(code_zone(), op_kind, index); | 981     auto op = AllocatedOperand::New(code_zone(), op_kind, index); | 
| 982     range->SetOperand(op); | 982     range->SetOperand(op); | 
| 983   } | 983   } | 
| 984 } | 984 } | 
| 985 | 985 | 
| 986 | 986 | 
| 987 void RegisterAllocator::CommitAssignment() { | 987 void RegisterAllocator::CommitAssignment() { | 
| 988   for (auto range : live_ranges()) { | 988   for (auto range : live_ranges()) { | 
| 989     if (range == nullptr || range->IsEmpty()) continue; | 989     if (range == nullptr || range->IsEmpty()) continue; | 
| 990     auto assigned = range->GetAssignedOperand(operand_cache()); | 990     auto assigned = range->GetAssignedOperand(operand_cache()); | 
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2533   } else { | 2533   } else { | 
| 2534     DCHECK(range->Kind() == GENERAL_REGISTERS); | 2534     DCHECK(range->Kind() == GENERAL_REGISTERS); | 
| 2535     assigned_registers_->Add(reg); | 2535     assigned_registers_->Add(reg); | 
| 2536   } | 2536   } | 
| 2537   range->set_assigned_register(reg, operand_cache()); | 2537   range->set_assigned_register(reg, operand_cache()); | 
| 2538 } | 2538 } | 
| 2539 | 2539 | 
| 2540 }  // namespace compiler | 2540 }  // namespace compiler | 
| 2541 }  // namespace internal | 2541 }  // namespace internal | 
| 2542 }  // namespace v8 | 2542 }  // namespace v8 | 
| OLD | NEW | 
|---|