| 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 "test/unittests/compiler/instruction-selector-unittest.h" | 5 #include "test/unittests/compiler/instruction-selector-unittest.h" |
| 6 | 6 |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
| 9 #include "src/flags.h" | 9 #include "src/flags.h" |
| 10 #include "test/unittests/compiler/compiler-test-utils.h" | 10 #include "test/unittests/compiler/compiler-test-utils.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind()); | 77 EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind()); |
| 78 if (output->IsConstant()) { | 78 if (output->IsConstant()) { |
| 79 int vreg = ConstantOperand::cast(output)->virtual_register(); | 79 int vreg = ConstantOperand::cast(output)->virtual_register(); |
| 80 s.constants_.insert(std::make_pair(vreg, sequence.GetConstant(vreg))); | 80 s.constants_.insert(std::make_pair(vreg, sequence.GetConstant(vreg))); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 for (size_t i = 0; i < instr->InputCount(); ++i) { | 83 for (size_t i = 0; i < instr->InputCount(); ++i) { |
| 84 InstructionOperand* input = instr->InputAt(i); | 84 InstructionOperand* input = instr->InputAt(i); |
| 85 EXPECT_NE(InstructionOperand::CONSTANT, input->kind()); | 85 EXPECT_NE(InstructionOperand::CONSTANT, input->kind()); |
| 86 if (input->IsImmediate()) { | 86 if (input->IsImmediate()) { |
| 87 int index = ImmediateOperand::cast(input)->index(); | 87 auto imm = ImmediateOperand::cast(input); |
| 88 s.immediates_.insert( | 88 if (imm->type() == ImmediateOperand::INDEXED) { |
| 89 std::make_pair(index, sequence.GetImmediate(index))); | 89 int index = imm->indexed_value(); |
| 90 s.immediates_.insert( |
| 91 std::make_pair(index, sequence.GetImmediate(imm))); |
| 92 } |
| 90 } | 93 } |
| 91 } | 94 } |
| 92 s.instructions_.push_back(instr); | 95 s.instructions_.push_back(instr); |
| 93 } | 96 } |
| 94 for (auto i : s.virtual_registers_) { | 97 for (auto i : s.virtual_registers_) { |
| 95 int const virtual_register = i.second; | 98 int const virtual_register = i.second; |
| 96 if (sequence.IsDouble(virtual_register)) { | 99 if (sequence.IsDouble(virtual_register)) { |
| 97 EXPECT_FALSE(sequence.IsReference(virtual_register)); | 100 EXPECT_FALSE(sequence.IsReference(virtual_register)); |
| 98 s.doubles_.insert(virtual_register); | 101 s.doubles_.insert(virtual_register); |
| 99 } | 102 } |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); | 586 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); |
| 584 // Continuation. | 587 // Continuation. |
| 585 | 588 |
| 586 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 589 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
| 587 EXPECT_EQ(index, s.size()); | 590 EXPECT_EQ(index, s.size()); |
| 588 } | 591 } |
| 589 | 592 |
| 590 } // namespace compiler | 593 } // namespace compiler |
| 591 } // namespace internal | 594 } // namespace internal |
| 592 } // namespace v8 | 595 } // namespace v8 |
| OLD | NEW |