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 { |
11 namespace compiler { | 11 namespace compiler { |
12 | 12 |
13 static size_t OperandCount(const Instruction* instr) { | 13 static size_t OperandCount(const Instruction* instr) { |
14 return instr->InputCount() + instr->OutputCount() + instr->TempCount(); | 14 return instr->InputCount() + instr->OutputCount() + instr->TempCount(); |
15 } | 15 } |
16 | 16 |
17 | 17 |
18 static void VerifyGapEmpty(const GapInstruction* gap) { | 18 static void VerifyGapEmpty(const GapInstruction* gap) { |
19 for (int i = GapInstruction::FIRST_INNER_POSITION; | 19 for (int i = GapInstruction::FIRST_INNER_POSITION; |
20 i <= GapInstruction::LAST_INNER_POSITION; i++) { | 20 i <= GapInstruction::LAST_INNER_POSITION; i++) { |
21 GapInstruction::InnerPosition inner_pos = | 21 GapInstruction::InnerPosition inner_pos = |
22 static_cast<GapInstruction::InnerPosition>(i); | 22 static_cast<GapInstruction::InnerPosition>(i); |
23 CHECK_EQ(NULL, gap->GetParallelMove(inner_pos)); | 23 CHECK(!gap->GetParallelMove(inner_pos)); |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 | 27 |
28 void RegisterAllocatorVerifier::VerifyInput( | 28 void RegisterAllocatorVerifier::VerifyInput( |
29 const OperandConstraint& constraint) { | 29 const OperandConstraint& constraint) { |
30 CHECK_NE(kSameAsFirst, constraint.type_); | 30 CHECK_NE(kSameAsFirst, constraint.type_); |
31 if (constraint.type_ != kImmediate) { | 31 if (constraint.type_ != kImmediate) { |
32 CHECK_NE(UnallocatedOperand::kInvalidVirtualRegister, | 32 CHECK_NE(UnallocatedOperand::kInvalidVirtualRegister, |
33 constraint.virtual_register_); | 33 constraint.virtual_register_); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } | 425 } |
426 // Found correct definition or use. | 426 // Found correct definition or use. |
427 if (v->define_vreg != kInvalidVreg) { | 427 if (v->define_vreg != kInvalidVreg) { |
428 CHECK(v->define_vreg == phi->first_pred_vreg); | 428 CHECK(v->define_vreg == phi->first_pred_vreg); |
429 } else if (v->use_vreg != phi->first_pred_vreg) { | 429 } else if (v->use_vreg != phi->first_pred_vreg) { |
430 // Walk the phi chain, hunting for a matching phi use. | 430 // Walk the phi chain, hunting for a matching phi use. |
431 auto p = phi; | 431 auto p = phi; |
432 for (; p != nullptr; p = p->first_pred_phi) { | 432 for (; p != nullptr; p = p->first_pred_phi) { |
433 if (p->virtual_register == v->use_vreg) break; | 433 if (p->virtual_register == v->use_vreg) break; |
434 } | 434 } |
435 CHECK_NE(nullptr, p); | 435 CHECK(p); |
436 } | 436 } |
437 // Mark the use. | 437 // Mark the use. |
438 it->second->use_vreg = use_vreg; | 438 it->second->use_vreg = use_vreg; |
439 return; | 439 return; |
440 } | 440 } |
441 // Use of a phi value without definition. | 441 // Use of a phi value without definition. |
442 CHECK(false); | 442 UNREACHABLE(); |
443 } | 443 } |
444 | 444 |
445 private: | 445 private: |
446 Map map_; | 446 Map map_; |
447 DISALLOW_COPY_AND_ASSIGN(OperandMap); | 447 DISALLOW_COPY_AND_ASSIGN(OperandMap); |
448 }; | 448 }; |
449 | 449 |
450 } // namespace | 450 } // namespace |
451 | 451 |
452 | 452 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 int virtual_register = op_constraints[count].virtual_register_; | 670 int virtual_register = op_constraints[count].virtual_register_; |
671 current->Define(zone(), instr->OutputAt(i), virtual_register); | 671 current->Define(zone(), instr->OutputAt(i), virtual_register); |
672 } | 672 } |
673 } | 673 } |
674 } | 674 } |
675 } | 675 } |
676 | 676 |
677 } // namespace compiler | 677 } // namespace compiler |
678 } // namespace internal | 678 } // namespace internal |
679 } // namespace v8 | 679 } // namespace v8 |
OLD | NEW |