Chromium Code Reviews| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 next_(nullptr), | 128 next_(nullptr), |
| 129 current_interval_(nullptr), | 129 current_interval_(nullptr), |
| 130 last_processed_use_(nullptr), | 130 last_processed_use_(nullptr), |
| 131 current_hint_operand_(nullptr), | 131 current_hint_operand_(nullptr), |
| 132 spill_start_index_(kMaxInt), | 132 spill_start_index_(kMaxInt), |
| 133 spill_type_(SpillType::kNoSpillType), | 133 spill_type_(SpillType::kNoSpillType), |
| 134 spill_operand_(nullptr), | 134 spill_operand_(nullptr), |
| 135 spills_at_definition_(nullptr) {} | 135 spills_at_definition_(nullptr) {} |
| 136 | 136 |
| 137 | 137 |
| 138 void LiveRange::set_assigned_register(int reg) { | 138 void LiveRange::set_assigned_register(int reg, Zone* zone) { |
| 139 DCHECK(!HasRegisterAssigned() && !IsSpilled()); | 139 DCHECK(!HasRegisterAssigned() && !IsSpilled()); |
| 140 assigned_register_ = reg; | 140 assigned_register_ = reg; |
| 141 // TODO(dcarney): stop aliasing hint operands. | |
| 142 ConvertUsesToOperand(CreateAssignedOperand(zone)); | |
|
Benedikt Meurer
2014/12/11 11:45:32
Urghs...
| |
| 141 } | 143 } |
| 142 | 144 |
| 143 | 145 |
| 144 void LiveRange::MakeSpilled() { | 146 void LiveRange::MakeSpilled() { |
| 145 DCHECK(!IsSpilled()); | 147 DCHECK(!IsSpilled()); |
| 146 DCHECK(!TopLevel()->HasNoSpillType()); | 148 DCHECK(!TopLevel()->HasNoSpillType()); |
| 147 spilled_ = true; | 149 spilled_ = true; |
| 148 assigned_register_ = kInvalidAssignment; | 150 assigned_register_ = kInvalidAssignment; |
| 149 } | 151 } |
| 150 | 152 |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 : InstructionOperand::STACK_SLOT; | 936 : InstructionOperand::STACK_SLOT; |
| 935 auto op = new (code_zone()) InstructionOperand(op_kind, index); | 937 auto op = new (code_zone()) InstructionOperand(op_kind, index); |
| 936 range->SetOperand(op); | 938 range->SetOperand(op); |
| 937 } | 939 } |
| 938 } | 940 } |
| 939 | 941 |
| 940 | 942 |
| 941 void RegisterAllocator::CommitAssignment() { | 943 void RegisterAllocator::CommitAssignment() { |
| 942 for (auto range : live_ranges()) { | 944 for (auto range : live_ranges()) { |
| 943 if (range == nullptr || range->IsEmpty()) continue; | 945 if (range == nullptr || range->IsEmpty()) continue; |
| 946 // Register assignments were committed in set_assigned_register. | |
| 947 if (range->HasRegisterAssigned()) continue; | |
| 944 auto assigned = range->CreateAssignedOperand(code_zone()); | 948 auto assigned = range->CreateAssignedOperand(code_zone()); |
| 945 range->ConvertUsesToOperand(assigned); | 949 range->ConvertUsesToOperand(assigned); |
| 946 if (range->IsSpilled()) { | 950 if (range->IsSpilled()) { |
| 947 range->CommitSpillsAtDefinition(code(), assigned); | 951 range->CommitSpillsAtDefinition(code(), assigned); |
| 948 } | 952 } |
| 949 } | 953 } |
| 950 } | 954 } |
| 951 | 955 |
| 952 | 956 |
| 953 SpillRange* RegisterAllocator::AssignSpillRangeToLiveRange(LiveRange* range) { | 957 SpillRange* RegisterAllocator::AssignSpillRangeToLiveRange(LiveRange* range) { |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2540 | 2544 |
| 2541 | 2545 |
| 2542 void RegisterAllocator::SetLiveRangeAssignedRegister(LiveRange* range, | 2546 void RegisterAllocator::SetLiveRangeAssignedRegister(LiveRange* range, |
| 2543 int reg) { | 2547 int reg) { |
| 2544 if (range->Kind() == DOUBLE_REGISTERS) { | 2548 if (range->Kind() == DOUBLE_REGISTERS) { |
| 2545 assigned_double_registers_->Add(reg); | 2549 assigned_double_registers_->Add(reg); |
| 2546 } else { | 2550 } else { |
| 2547 DCHECK(range->Kind() == GENERAL_REGISTERS); | 2551 DCHECK(range->Kind() == GENERAL_REGISTERS); |
| 2548 assigned_registers_->Add(reg); | 2552 assigned_registers_->Add(reg); |
| 2549 } | 2553 } |
| 2550 range->set_assigned_register(reg); | 2554 range->set_assigned_register(reg, code_zone()); |
| 2551 } | 2555 } |
| 2552 | 2556 |
| 2553 } // namespace compiler | 2557 } // namespace compiler |
| 2554 } // namespace internal | 2558 } // namespace internal |
| 2555 } // namespace v8 | 2559 } // namespace v8 |
| OLD | NEW |