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/opcodes.h" | 6 #include "src/compiler/opcodes.h" |
7 #include "src/compiler/operator.h" | 7 #include "src/compiler/operator.h" |
8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_EQ((javascript1.*sop.constructor)(), (javascript2.*sop.constructor)()); | 100 EXPECT_EQ((javascript1.*sop.constructor)(), (javascript2.*sop.constructor)()); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 TEST_P(JSSharedOperatorTest, NumberOfInputsAndOutputs) { | 104 TEST_P(JSSharedOperatorTest, NumberOfInputsAndOutputs) { |
105 JSOperatorBuilder javascript(zone()); | 105 JSOperatorBuilder javascript(zone()); |
106 const SharedOperator& sop = GetParam(); | 106 const SharedOperator& sop = GetParam(); |
107 const Operator* op = (javascript.*sop.constructor)(); | 107 const Operator* op = (javascript.*sop.constructor)(); |
108 | 108 |
109 const int context_input_count = 1; | 109 const int context_input_count = 1; |
110 // TODO(jarin): Get rid of this hack. | |
111 const int frame_state_input_count = | |
112 FLAG_turbo_deoptimization ? sop.frame_state_input_count : 0; | |
113 EXPECT_EQ(sop.value_input_count, op->ValueInputCount()); | 110 EXPECT_EQ(sop.value_input_count, op->ValueInputCount()); |
114 EXPECT_EQ(context_input_count, OperatorProperties::GetContextInputCount(op)); | 111 EXPECT_EQ(context_input_count, OperatorProperties::GetContextInputCount(op)); |
115 EXPECT_EQ(frame_state_input_count, | 112 EXPECT_EQ(sop.frame_state_input_count, |
116 OperatorProperties::GetFrameStateInputCount(op)); | 113 OperatorProperties::GetFrameStateInputCount(op)); |
117 EXPECT_EQ(sop.effect_input_count, op->EffectInputCount()); | 114 EXPECT_EQ(sop.effect_input_count, op->EffectInputCount()); |
118 EXPECT_EQ(sop.control_input_count, op->ControlInputCount()); | 115 EXPECT_EQ(sop.control_input_count, op->ControlInputCount()); |
119 EXPECT_EQ(sop.value_input_count + context_input_count + | 116 EXPECT_EQ(sop.value_input_count + context_input_count + |
120 frame_state_input_count + sop.effect_input_count + | 117 sop.frame_state_input_count + sop.effect_input_count + |
121 sop.control_input_count, | 118 sop.control_input_count, |
122 OperatorProperties::GetTotalInputCount(op)); | 119 OperatorProperties::GetTotalInputCount(op)); |
123 | 120 |
124 EXPECT_EQ(sop.value_output_count, op->ValueOutputCount()); | 121 EXPECT_EQ(sop.value_output_count, op->ValueOutputCount()); |
125 EXPECT_EQ(sop.effect_output_count, op->EffectOutputCount()); | 122 EXPECT_EQ(sop.effect_output_count, op->EffectOutputCount()); |
126 EXPECT_EQ(sop.control_output_count, op->ControlOutputCount()); | 123 EXPECT_EQ(sop.control_output_count, op->ControlOutputCount()); |
127 } | 124 } |
128 | 125 |
129 | 126 |
130 TEST_P(JSSharedOperatorTest, OpcodeIsCorrect) { | 127 TEST_P(JSSharedOperatorTest, OpcodeIsCorrect) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 JSOperatorBuilder javascript2(zone()); | 159 JSOperatorBuilder javascript2(zone()); |
163 EXPECT_EQ(javascript1.StoreProperty(mode), javascript2.StoreProperty(mode)); | 160 EXPECT_EQ(javascript1.StoreProperty(mode), javascript2.StoreProperty(mode)); |
164 } | 161 } |
165 | 162 |
166 | 163 |
167 TEST_P(JSStorePropertyOperatorTest, NumberOfInputsAndOutputs) { | 164 TEST_P(JSStorePropertyOperatorTest, NumberOfInputsAndOutputs) { |
168 JSOperatorBuilder javascript(zone()); | 165 JSOperatorBuilder javascript(zone()); |
169 const LanguageMode mode = GetParam(); | 166 const LanguageMode mode = GetParam(); |
170 const Operator* op = javascript.StoreProperty(mode); | 167 const Operator* op = javascript.StoreProperty(mode); |
171 | 168 |
172 // TODO(jarin): Get rid of this hack. | |
173 const int frame_state_input_count = FLAG_turbo_deoptimization ? 2 : 0; | |
174 EXPECT_EQ(3, op->ValueInputCount()); | 169 EXPECT_EQ(3, op->ValueInputCount()); |
175 EXPECT_EQ(1, OperatorProperties::GetContextInputCount(op)); | 170 EXPECT_EQ(1, OperatorProperties::GetContextInputCount(op)); |
176 EXPECT_EQ(frame_state_input_count, | 171 EXPECT_EQ(2, OperatorProperties::GetFrameStateInputCount(op)); |
177 OperatorProperties::GetFrameStateInputCount(op)); | |
178 EXPECT_EQ(1, op->EffectInputCount()); | 172 EXPECT_EQ(1, op->EffectInputCount()); |
179 EXPECT_EQ(1, op->ControlInputCount()); | 173 EXPECT_EQ(1, op->ControlInputCount()); |
180 EXPECT_EQ(6 + frame_state_input_count, | 174 EXPECT_EQ(8, OperatorProperties::GetTotalInputCount(op)); |
181 OperatorProperties::GetTotalInputCount(op)); | |
182 | 175 |
183 EXPECT_EQ(0, op->ValueOutputCount()); | 176 EXPECT_EQ(0, op->ValueOutputCount()); |
184 EXPECT_EQ(1, op->EffectOutputCount()); | 177 EXPECT_EQ(1, op->EffectOutputCount()); |
185 EXPECT_EQ(2, op->ControlOutputCount()); | 178 EXPECT_EQ(2, op->ControlOutputCount()); |
186 } | 179 } |
187 | 180 |
188 | 181 |
189 TEST_P(JSStorePropertyOperatorTest, OpcodeIsCorrect) { | 182 TEST_P(JSStorePropertyOperatorTest, OpcodeIsCorrect) { |
190 JSOperatorBuilder javascript(zone()); | 183 JSOperatorBuilder javascript(zone()); |
191 const LanguageMode mode = GetParam(); | 184 const LanguageMode mode = GetParam(); |
(...skipping 17 matching lines...) Expand all Loading... |
209 EXPECT_EQ(Operator::kNoProperties, op->properties()); | 202 EXPECT_EQ(Operator::kNoProperties, op->properties()); |
210 } | 203 } |
211 | 204 |
212 | 205 |
213 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSStorePropertyOperatorTest, | 206 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSStorePropertyOperatorTest, |
214 ::testing::Values(SLOPPY, STRICT)); | 207 ::testing::Values(SLOPPY, STRICT)); |
215 | 208 |
216 } // namespace compiler | 209 } // namespace compiler |
217 } // namespace internal | 210 } // namespace internal |
218 } // namespace v8 | 211 } // namespace v8 |
OLD | NEW |