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/bit-vector.h" | 5 #include "src/bit-vector.h" |
6 #include "src/compiler/instruction.h" | 6 #include "src/compiler/instruction.h" |
7 #include "src/compiler/register-allocator-verifier.h" | 7 #include "src/compiler/register-allocator-verifier.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 RegisterAllocatorVerifier::RegisterAllocatorVerifier( | 54 RegisterAllocatorVerifier::RegisterAllocatorVerifier( |
55 Zone* zone, const RegisterConfiguration* config, | 55 Zone* zone, const RegisterConfiguration* config, |
56 const InstructionSequence* sequence) | 56 const InstructionSequence* sequence) |
57 : zone_(zone), config_(config), sequence_(sequence), constraints_(zone) { | 57 : zone_(zone), config_(config), sequence_(sequence), constraints_(zone) { |
58 constraints_.reserve(sequence->instructions().size()); | 58 constraints_.reserve(sequence->instructions().size()); |
59 // TODO(dcarney): model unique constraints. | 59 // TODO(dcarney): model unique constraints. |
60 // Construct OperandConstraints for all InstructionOperands, eliminating | 60 // Construct OperandConstraints for all InstructionOperands, eliminating |
61 // kSameAsFirst along the way. | 61 // kSameAsFirst along the way. |
62 for (const auto* instr : sequence->instructions()) { | 62 for (const auto* instr : sequence->instructions()) { |
63 const size_t operand_count = OperandCount(instr); | 63 const size_t operand_count = OperandCount(instr); |
64 auto* op_constraints = | 64 auto* op_constraints = zone->NewArray<OperandConstraint>(operand_count); |
65 zone->NewArray<OperandConstraint>(static_cast<int>(operand_count)); | |
66 size_t count = 0; | 65 size_t count = 0; |
67 for (size_t i = 0; i < instr->InputCount(); ++i, ++count) { | 66 for (size_t i = 0; i < instr->InputCount(); ++i, ++count) { |
68 BuildConstraint(instr->InputAt(i), &op_constraints[count]); | 67 BuildConstraint(instr->InputAt(i), &op_constraints[count]); |
69 VerifyInput(op_constraints[count]); | 68 VerifyInput(op_constraints[count]); |
70 } | 69 } |
71 for (size_t i = 0; i < instr->TempCount(); ++i, ++count) { | 70 for (size_t i = 0; i < instr->TempCount(); ++i, ++count) { |
72 BuildConstraint(instr->TempAt(i), &op_constraints[count]); | 71 BuildConstraint(instr->TempAt(i), &op_constraints[count]); |
73 VerifyTemp(op_constraints[count]); | 72 VerifyTemp(op_constraints[count]); |
74 } | 73 } |
75 for (size_t i = 0; i < instr->OutputCount(); ++i, ++count) { | 74 for (size_t i = 0; i < instr->OutputCount(); ++i, ++count) { |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 int virtual_register = op_constraints[count].virtual_register_; | 661 int virtual_register = op_constraints[count].virtual_register_; |
663 current->Define(zone(), instr->OutputAt(i), virtual_register); | 662 current->Define(zone(), instr->OutputAt(i), virtual_register); |
664 } | 663 } |
665 } | 664 } |
666 } | 665 } |
667 } | 666 } |
668 | 667 |
669 } // namespace compiler | 668 } // namespace compiler |
670 } // namespace internal | 669 } // namespace internal |
671 } // namespace v8 | 670 } // namespace v8 |
OLD | NEW |