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/common-operator-unittest.h" | 5 #include "test/compiler-unittests/common-operator-unittest.h" |
6 | 6 |
7 #include "src/compiler/operator-properties-inl.h" | 7 #include "src/compiler/operator-properties-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
11 namespace compiler { | 11 namespace compiler { |
12 | 12 |
13 CommonOperatorTest::CommonOperatorTest() : common_(zone()) {} | 13 CommonOperatorTest::CommonOperatorTest() : common_(zone()) {} |
14 | 14 |
15 | 15 |
16 CommonOperatorTest::~CommonOperatorTest() {} | 16 CommonOperatorTest::~CommonOperatorTest() {} |
17 | 17 |
| 18 |
| 19 TEST_F(CommonOperatorTest, ControlEffect) { |
| 20 Operator* op = common()->ControlEffect(); |
| 21 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); |
| 22 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
| 23 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 24 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); |
| 25 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); |
| 26 } |
| 27 |
| 28 |
| 29 TEST_F(CommonOperatorTest, Finish) { |
| 30 static const int kArguments[] = {1, 5, 6, 42, 100, 10000, kMaxInt}; |
| 31 TRACED_FOREACH(int, arguments, kArguments) { |
| 32 Operator* op = common()->Finish(arguments); |
| 33 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); |
| 34 EXPECT_EQ(arguments, OperatorProperties::GetEffectInputCount(op)); |
| 35 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); |
| 36 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 37 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
| 38 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
| 39 } |
| 40 } |
| 41 |
18 } // namespace compiler | 42 } // namespace compiler |
19 } // namespace internal | 43 } // namespace internal |
20 } // namespace v8 | 44 } // namespace v8 |
OLD | NEW |