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 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 s.immediates_.insert(std::make_pair( | 55 s.immediates_.insert(std::make_pair( |
56 input->index(), sequence.GetImmediate(input->index()))); | 56 input->index(), sequence.GetImmediate(input->index()))); |
57 } | 57 } |
58 } | 58 } |
59 s.instructions_.push_back(instr); | 59 s.instructions_.push_back(instr); |
60 } | 60 } |
61 return s; | 61 return s; |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 COMPILER_TEST_F(InstructionSelectorTest, ReturnP) { | 65 TARGET_TEST_F(InstructionSelectorTest, ReturnP) { |
66 StreamBuilder m(this, kMachineWord32, kMachineWord32); | 66 StreamBuilder m(this, kMachineWord32, kMachineWord32); |
67 m.Return(m.Parameter(0)); | 67 m.Return(m.Parameter(0)); |
68 Stream s = m.Build(kAllInstructions); | 68 Stream s = m.Build(kAllInstructions); |
69 ASSERT_EQ(2U, s.size()); | 69 ASSERT_EQ(2U, s.size()); |
70 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); | 70 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); |
71 ASSERT_EQ(1U, s[0]->OutputCount()); | 71 ASSERT_EQ(1U, s[0]->OutputCount()); |
72 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); | 72 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); |
73 EXPECT_EQ(1U, s[1]->InputCount()); | 73 EXPECT_EQ(1U, s[1]->InputCount()); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 COMPILER_TEST_F(InstructionSelectorTest, ReturnImm) { | 77 TARGET_TEST_F(InstructionSelectorTest, ReturnImm) { |
78 StreamBuilder m(this, kMachineWord32); | 78 StreamBuilder m(this, kMachineWord32); |
79 m.Return(m.Int32Constant(0)); | 79 m.Return(m.Int32Constant(0)); |
80 Stream s = m.Build(kAllInstructions); | 80 Stream s = m.Build(kAllInstructions); |
81 ASSERT_EQ(2U, s.size()); | 81 ASSERT_EQ(2U, s.size()); |
82 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); | 82 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); |
83 ASSERT_EQ(1U, s[0]->OutputCount()); | 83 ASSERT_EQ(1U, s[0]->OutputCount()); |
84 EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind()); | 84 EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind()); |
85 EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0))); | 85 EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0))); |
86 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); | 86 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); |
87 EXPECT_EQ(1U, s[1]->InputCount()); | 87 EXPECT_EQ(1U, s[1]->InputCount()); |
88 } | 88 } |
89 | 89 |
90 } // namespace compiler | 90 } // namespace compiler |
91 } // namespace internal | 91 } // namespace internal |
92 } // namespace v8 | 92 } // namespace v8 |
OLD | NEW |