| 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/compiler-unittests/instruction-selector-unittest.h" | 5 #include "test/compiler-unittests/instruction-selector-unittest.h" |
| 6 | 6 |
| 7 #include "src/flags.h" | 7 #include "src/flags.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 input->index(), sequence.GetImmediate(input->index()))); | 65 input->index(), sequence.GetImmediate(input->index()))); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 s.instructions_.push_back(instr); | 68 s.instructions_.push_back(instr); |
| 69 } | 69 } |
| 70 return s; | 70 return s; |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) { | 74 TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) { |
| 75 StreamBuilder m(this, kMachineWord32, kMachineWord32); | 75 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 76 m.Return(m.Parameter(0)); | 76 m.Return(m.Parameter(0)); |
| 77 Stream s = m.Build(kAllInstructions); | 77 Stream s = m.Build(kAllInstructions); |
| 78 ASSERT_EQ(2U, s.size()); | 78 ASSERT_EQ(2U, s.size()); |
| 79 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); | 79 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); |
| 80 ASSERT_EQ(1U, s[0]->OutputCount()); | 80 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 81 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); | 81 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); |
| 82 EXPECT_EQ(1U, s[1]->InputCount()); | 82 EXPECT_EQ(1U, s[1]->InputCount()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 TARGET_TEST_F(InstructionSelectorTest, ReturnZero) { | 86 TARGET_TEST_F(InstructionSelectorTest, ReturnZero) { |
| 87 StreamBuilder m(this, kMachineWord32); | 87 StreamBuilder m(this, kMachInt32); |
| 88 m.Return(m.Int32Constant(0)); | 88 m.Return(m.Int32Constant(0)); |
| 89 Stream s = m.Build(kAllInstructions); | 89 Stream s = m.Build(kAllInstructions); |
| 90 ASSERT_EQ(2U, s.size()); | 90 ASSERT_EQ(2U, s.size()); |
| 91 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); | 91 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); |
| 92 ASSERT_EQ(1U, s[0]->OutputCount()); | 92 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 93 EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind()); | 93 EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind()); |
| 94 EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0))); | 94 EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0))); |
| 95 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); | 95 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); |
| 96 EXPECT_EQ(1U, s[1]->InputCount()); | 96 EXPECT_EQ(1U, s[1]->InputCount()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace compiler | 99 } // namespace compiler |
| 100 } // namespace internal | 100 } // namespace internal |
| 101 } // namespace v8 | 101 } // namespace v8 |
| OLD | NEW |