| 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 "src/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/operator-properties-inl.h" | 6 #include "src/compiler/operator-properties-inl.h" |
| 7 #include "src/test/test-utils.h" | 7 #include "src/test/test-utils.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 CommonOperatorBuilder common_; | 23 CommonOperatorBuilder common_; |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 | 26 |
| 27 const int kArguments[] = {1, 5, 6, 42, 100, 10000, kMaxInt}; | 27 const int kArguments[] = {1, 5, 6, 42, 100, 10000, kMaxInt}; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 | 31 |
| 32 TEST_F(CommonOperatorTest, ControlEffect) { | 32 TEST_F(CommonOperatorTest, ControlEffect) { |
| 33 Operator* op = common()->ControlEffect(); | 33 const Operator* op = common()->ControlEffect(); |
| 34 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); | 34 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); |
| 35 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); | 35 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
| 36 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 36 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 37 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); | 37 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); |
| 38 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); | 38 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 | 41 |
| 42 TEST_F(CommonOperatorTest, ValueEffect) { | 42 TEST_F(CommonOperatorTest, ValueEffect) { |
| 43 TRACED_FOREACH(int, arguments, kArguments) { | 43 TRACED_FOREACH(int, arguments, kArguments) { |
| 44 Operator* op = common()->ValueEffect(arguments); | 44 const Operator* op = common()->ValueEffect(arguments); |
| 45 EXPECT_EQ(arguments, OperatorProperties::GetValueInputCount(op)); | 45 EXPECT_EQ(arguments, OperatorProperties::GetValueInputCount(op)); |
| 46 EXPECT_EQ(arguments, OperatorProperties::GetTotalInputCount(op)); | 46 EXPECT_EQ(arguments, OperatorProperties::GetTotalInputCount(op)); |
| 47 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 47 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 48 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); | 48 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); |
| 49 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); | 49 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 TEST_F(CommonOperatorTest, Finish) { | 54 TEST_F(CommonOperatorTest, Finish) { |
| 55 TRACED_FOREACH(int, arguments, kArguments) { | 55 TRACED_FOREACH(int, arguments, kArguments) { |
| 56 Operator* op = common()->Finish(arguments); | 56 const Operator* op = common()->Finish(arguments); |
| 57 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); | 57 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); |
| 58 EXPECT_EQ(arguments, OperatorProperties::GetEffectInputCount(op)); | 58 EXPECT_EQ(arguments, OperatorProperties::GetEffectInputCount(op)); |
| 59 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); | 59 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); |
| 60 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 60 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 61 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); | 61 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
| 62 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); | 62 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace compiler | 66 } // namespace compiler |
| 67 } // namespace internal | 67 } // namespace internal |
| 68 } // namespace v8 | 68 } // namespace v8 |
| OLD | NEW |