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