| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 const MachineType type = GetParam(); | 179 const MachineType type = GetParam(); |
| 180 StreamBuilder m(this, type, type); | 180 StreamBuilder m(this, type, type); |
| 181 Node* param = m.Parameter(0); | 181 Node* param = m.Parameter(0); |
| 182 Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start()); | 182 Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start()); |
| 183 m.Return(finish); | 183 m.Return(finish); |
| 184 Stream s = m.Build(kAllInstructions); | 184 Stream s = m.Build(kAllInstructions); |
| 185 ASSERT_EQ(3U, s.size()); | 185 ASSERT_EQ(3U, s.size()); |
| 186 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); | 186 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); |
| 187 ASSERT_EQ(1U, s[0]->OutputCount()); | 187 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 188 ASSERT_TRUE(s[0]->Output()->IsUnallocated()); | 188 ASSERT_TRUE(s[0]->Output()->IsUnallocated()); |
| 189 EXPECT_EQ(param->id(), | 189 EXPECT_EQ(param->id(), s.ToVreg(s[0]->Output())); |
| 190 UnallocatedOperand::cast(s[0]->Output())->virtual_register()); | |
| 191 EXPECT_EQ(kArchNop, s[1]->arch_opcode()); | 190 EXPECT_EQ(kArchNop, s[1]->arch_opcode()); |
| 192 ASSERT_EQ(1U, s[1]->InputCount()); | 191 ASSERT_EQ(1U, s[1]->InputCount()); |
| 193 ASSERT_TRUE(s[1]->InputAt(0)->IsUnallocated()); | 192 ASSERT_TRUE(s[1]->InputAt(0)->IsUnallocated()); |
| 194 EXPECT_EQ(param->id(), | 193 EXPECT_EQ(param->id(), s.ToVreg(s[1]->InputAt(0))); |
| 195 UnallocatedOperand::cast(s[1]->InputAt(0))->virtual_register()); | |
| 196 ASSERT_EQ(1U, s[1]->OutputCount()); | 194 ASSERT_EQ(1U, s[1]->OutputCount()); |
| 197 ASSERT_TRUE(s[1]->Output()->IsUnallocated()); | 195 ASSERT_TRUE(s[1]->Output()->IsUnallocated()); |
| 198 EXPECT_TRUE(UnallocatedOperand::cast(s[1]->Output())->HasSameAsInputPolicy()); | 196 EXPECT_TRUE(UnallocatedOperand::cast(s[1]->Output())->HasSameAsInputPolicy()); |
| 199 EXPECT_EQ(finish->id(), | 197 EXPECT_EQ(finish->id(), s.ToVreg(s[1]->Output())); |
| 200 UnallocatedOperand::cast(s[1]->Output())->virtual_register()); | |
| 201 } | 198 } |
| 202 | 199 |
| 203 | 200 |
| 204 TARGET_TEST_P(InstructionSelectorFinishTest, PropagateDoubleness) { | 201 TARGET_TEST_P(InstructionSelectorFinishTest, PropagateDoubleness) { |
| 205 const MachineType type = GetParam(); | 202 const MachineType type = GetParam(); |
| 206 StreamBuilder m(this, type, type); | 203 StreamBuilder m(this, type, type); |
| 207 Node* param = m.Parameter(0); | 204 Node* param = m.Parameter(0); |
| 208 Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start()); | 205 Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start()); |
| 209 m.Return(finish); | 206 m.Return(finish); |
| 210 Stream s = m.Build(kAllInstructions); | 207 Stream s = m.Build(kAllInstructions); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 const Instruction* i2 = s2[i]; | 303 const Instruction* i2 = s2[i]; |
| 307 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); | 304 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); |
| 308 EXPECT_EQ(i1->InputCount(), i2->InputCount()); | 305 EXPECT_EQ(i1->InputCount(), i2->InputCount()); |
| 309 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); | 306 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); |
| 310 } | 307 } |
| 311 } | 308 } |
| 312 | 309 |
| 313 } // namespace compiler | 310 } // namespace compiler |
| 314 } // namespace internal | 311 } // namespace internal |
| 315 } // namespace v8 | 312 } // namespace v8 |
| OLD | NEW |