| 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 "src/compiler/common-operator.h" |
| 6 | 6 #include "src/compiler/compiler-unittests.h" |
| 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 static const int kArguments[] = {1, 5, 6, 42, 100, 10000, kMaxInt}; | 13 namespace { |
| 14 |
| 15 class CommonOperatorTest : public CompilerTest { |
| 16 public: |
| 17 CommonOperatorTest() : common_(zone()) {} |
| 18 virtual ~CommonOperatorTest() {} |
| 19 |
| 20 CommonOperatorBuilder* common() { return &common_; } |
| 21 |
| 22 private: |
| 23 CommonOperatorBuilder common_; |
| 24 }; |
| 14 | 25 |
| 15 | 26 |
| 16 CommonOperatorTest::CommonOperatorTest() : common_(zone()) {} | 27 const int kArguments[] = {1, 5, 6, 42, 100, 10000, kMaxInt}; |
| 17 | 28 |
| 18 | 29 } // namespace |
| 19 CommonOperatorTest::~CommonOperatorTest() {} | |
| 20 | 30 |
| 21 | 31 |
| 22 TEST_F(CommonOperatorTest, ControlEffect) { | 32 TEST_F(CommonOperatorTest, ControlEffect) { |
| 23 Operator* op = common()->ControlEffect(); | 33 Operator* op = common()->ControlEffect(); |
| 24 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); | 34 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); |
| 25 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); | 35 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
| 26 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 36 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 27 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); | 37 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); |
| 28 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); | 38 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); |
| 29 } | 39 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); | 59 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); |
| 50 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 60 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
| 51 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); | 61 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
| 52 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); | 62 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
| 53 } | 63 } |
| 54 } | 64 } |
| 55 | 65 |
| 56 } // namespace compiler | 66 } // namespace compiler |
| 57 } // namespace internal | 67 } // namespace internal |
| 58 } // namespace v8 | 68 } // namespace v8 |
| OLD | NEW |