| 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/js-operator.h" | 5 #include "src/compiler/js-operator.h" |
| 6 #include "src/compiler/operator-properties-inl.h" | 6 #include "src/compiler/operator-properties-inl.h" |
| 7 #include "test/unittests/test-utils.h" | 7 #include "test/unittests/test-utils.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 TEST_P(JSSharedOperatorTest, NumberOfInputsAndOutputs) { | 100 TEST_P(JSSharedOperatorTest, NumberOfInputsAndOutputs) { |
| 101 JSOperatorBuilder javascript(zone()); | 101 JSOperatorBuilder javascript(zone()); |
| 102 const SharedOperator& sop = GetParam(); | 102 const SharedOperator& sop = GetParam(); |
| 103 const Operator* op = (javascript.*sop.constructor)(); | 103 const Operator* op = (javascript.*sop.constructor)(); |
| 104 | 104 |
| 105 const int context_input_count = 1; | 105 const int context_input_count = 1; |
| 106 // TODO(jarin): Get rid of this hack. | 106 // TODO(jarin): Get rid of this hack. |
| 107 const int frame_state_input_count = | 107 const int frame_state_input_count = |
| 108 FLAG_turbo_deoptimization ? sop.frame_state_input_count : 0; | 108 FLAG_turbo_deoptimization ? sop.frame_state_input_count : 0; |
| 109 EXPECT_EQ(sop.value_input_count, OperatorProperties::GetValueInputCount(op)); | 109 EXPECT_EQ(sop.value_input_count, op->ValueInputCount()); |
| 110 EXPECT_EQ(context_input_count, OperatorProperties::GetContextInputCount(op)); | 110 EXPECT_EQ(context_input_count, OperatorProperties::GetContextInputCount(op)); |
| 111 EXPECT_EQ(frame_state_input_count, | 111 EXPECT_EQ(frame_state_input_count, |
| 112 OperatorProperties::GetFrameStateInputCount(op)); | 112 OperatorProperties::GetFrameStateInputCount(op)); |
| 113 EXPECT_EQ(sop.effect_input_count, | 113 EXPECT_EQ(sop.effect_input_count, op->EffectInputCount()); |
| 114 OperatorProperties::GetEffectInputCount(op)); | 114 EXPECT_EQ(sop.control_input_count, op->ControlInputCount()); |
| 115 EXPECT_EQ(sop.control_input_count, | |
| 116 OperatorProperties::GetControlInputCount(op)); | |
| 117 EXPECT_EQ(sop.value_input_count + context_input_count + | 115 EXPECT_EQ(sop.value_input_count + context_input_count + |
| 118 frame_state_input_count + sop.effect_input_count + | 116 frame_state_input_count + sop.effect_input_count + |
| 119 sop.control_input_count, | 117 sop.control_input_count, |
| 120 OperatorProperties::GetTotalInputCount(op)); | 118 OperatorProperties::GetTotalInputCount(op)); |
| 121 | 119 |
| 122 EXPECT_EQ(sop.value_output_count, | 120 EXPECT_EQ(sop.value_output_count, op->ValueOutputCount()); |
| 123 OperatorProperties::GetValueOutputCount(op)); | 121 EXPECT_EQ(sop.effect_output_count, op->EffectOutputCount()); |
| 124 EXPECT_EQ(sop.effect_output_count, | 122 EXPECT_EQ(0, op->ControlOutputCount()); |
| 125 OperatorProperties::GetEffectOutputCount(op)); | |
| 126 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | |
| 127 } | 123 } |
| 128 | 124 |
| 129 | 125 |
| 130 TEST_P(JSSharedOperatorTest, OpcodeIsCorrect) { | 126 TEST_P(JSSharedOperatorTest, OpcodeIsCorrect) { |
| 131 JSOperatorBuilder javascript(zone()); | 127 JSOperatorBuilder javascript(zone()); |
| 132 const SharedOperator& sop = GetParam(); | 128 const SharedOperator& sop = GetParam(); |
| 133 const Operator* op = (javascript.*sop.constructor)(); | 129 const Operator* op = (javascript.*sop.constructor)(); |
| 134 EXPECT_EQ(sop.opcode, op->opcode()); | 130 EXPECT_EQ(sop.opcode, op->opcode()); |
| 135 } | 131 } |
| 136 | 132 |
| 137 | 133 |
| 138 TEST_P(JSSharedOperatorTest, Properties) { | 134 TEST_P(JSSharedOperatorTest, Properties) { |
| 139 JSOperatorBuilder javascript(zone()); | 135 JSOperatorBuilder javascript(zone()); |
| 140 const SharedOperator& sop = GetParam(); | 136 const SharedOperator& sop = GetParam(); |
| 141 const Operator* op = (javascript.*sop.constructor)(); | 137 const Operator* op = (javascript.*sop.constructor)(); |
| 142 EXPECT_EQ(sop.properties, op->properties()); | 138 EXPECT_EQ(sop.properties, op->properties()); |
| 143 } | 139 } |
| 144 | 140 |
| 145 | 141 |
| 146 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest, | 142 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest, |
| 147 ::testing::ValuesIn(kSharedOperators)); | 143 ::testing::ValuesIn(kSharedOperators)); |
| 148 | 144 |
| 149 } // namespace compiler | 145 } // namespace compiler |
| 150 } // namespace internal | 146 } // namespace internal |
| 151 } // namespace v8 | 147 } // namespace v8 |
| OLD | NEW |