OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-intrinsic-lowering.h" | 8 #include "src/compiler/js-intrinsic-lowering.h" |
9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 effect, CaptureEq(&if_false)), | 216 effect, CaptureEq(&if_false)), |
217 effect, _), | 217 effect, _), |
218 IsInt32Constant(JS_TYPED_ARRAY_TYPE)), | 218 IsInt32Constant(JS_TYPED_ARRAY_TYPE)), |
219 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | 219 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
220 IsBranch(IsObjectIsSmi(input), control))), | 220 IsBranch(IsObjectIsSmi(input), control))), |
221 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 221 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 // ----------------------------------------------------------------------------- | 225 // ----------------------------------------------------------------------------- |
226 // %_IsFunction | |
227 | |
228 | |
229 TEST_F(JSIntrinsicLoweringTest, InlineIsFunction) { | |
230 Node* const input = Parameter(Type::Any()); | |
231 Node* const context = Parameter(Type::Any()); | |
232 Node* const effect = graph()->start(); | |
233 Node* const control = graph()->start(); | |
234 Reduction const r = Reduce( | |
235 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsFunction, 1), | |
236 input, context, effect, control)); | |
237 ASSERT_TRUE(r.Changed()); | |
238 | |
239 Node* phi = r.replacement(); | |
240 Capture<Node*> branch, if_false; | |
241 EXPECT_THAT( | |
242 phi, | |
243 IsPhi( | |
244 MachineRepresentation::kTagged, IsFalseConstant(), | |
245 IsUint32LessThanOrEqual( | |
246 IsInt32Constant(FIRST_FUNCTION_TYPE), | |
247 IsLoadField(AccessBuilder::ForMapInstanceType(), | |
248 IsLoadField(AccessBuilder::ForMap(), input, effect, | |
249 CaptureEq(&if_false)), | |
250 effect, _)), | |
251 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | |
252 IsBranch(IsObjectIsSmi(input), control))), | |
253 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | |
254 } | |
255 | |
256 | |
257 // ----------------------------------------------------------------------------- | |
258 // %_IsRegExp | 226 // %_IsRegExp |
259 | 227 |
260 | 228 |
261 TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) { | 229 TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) { |
262 Node* const input = Parameter(0); | 230 Node* const input = Parameter(0); |
263 Node* const context = Parameter(1); | 231 Node* const context = Parameter(1); |
264 Node* const effect = graph()->start(); | 232 Node* const effect = graph()->start(); |
265 Node* const control = graph()->start(); | 233 Node* const control = graph()->start(); |
266 Reduction const r = Reduce( | 234 Reduction const r = Reduce( |
267 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsRegExp, 1), | 235 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsRegExp, 1), |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 CaptureEq(&if_false0)))))), | 420 CaptureEq(&if_false0)))))), |
453 IsMerge( | 421 IsMerge( |
454 IsIfTrue(AllOf(CaptureEq(&branch0), | 422 IsIfTrue(AllOf(CaptureEq(&branch0), |
455 IsBranch(IsObjectIsSmi(input), control))), | 423 IsBranch(IsObjectIsSmi(input), control))), |
456 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 424 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
457 } | 425 } |
458 | 426 |
459 } // namespace compiler | 427 } // namespace compiler |
460 } // namespace internal | 428 } // namespace internal |
461 } // namespace v8 | 429 } // namespace v8 |
OLD | NEW |