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 "src/types-inl.h" | 10 #include "src/types-inl.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 Node* const control = graph()->start(); | 390 Node* const control = graph()->start(); |
391 Reduction const r = Reduce( | 391 Reduction const r = Reduce( |
392 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), | 392 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), |
393 input, context, effect, control)); | 393 input, context, effect, control)); |
394 ASSERT_TRUE(r.Changed()); | 394 ASSERT_TRUE(r.Changed()); |
395 EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input)); | 395 EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input)); |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 // ----------------------------------------------------------------------------- | 399 // ----------------------------------------------------------------------------- |
400 // %_StringGetLength | |
401 | |
402 | |
403 TEST_F(JSIntrinsicLoweringTest, InlineStringGetLength) { | |
404 Node* const input = Parameter(0); | |
405 Node* const context = Parameter(1); | |
406 Node* const effect = graph()->start(); | |
407 Node* const control = graph()->start(); | |
408 Reduction const r = Reduce(graph()->NewNode( | |
409 javascript()->CallRuntime(Runtime::kInlineStringGetLength, 1), input, | |
410 context, effect, control)); | |
411 ASSERT_TRUE(r.Changed()); | |
412 EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(), | |
413 input, effect, control)); | |
414 } | |
415 | |
416 | |
417 // ----------------------------------------------------------------------------- | |
418 // %_MathClz32 | 400 // %_MathClz32 |
419 | 401 |
420 | 402 |
421 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { | 403 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
422 Node* const input = Parameter(0); | 404 Node* const input = Parameter(0); |
423 Node* const context = Parameter(1); | 405 Node* const context = Parameter(1); |
424 Node* const effect = graph()->start(); | 406 Node* const effect = graph()->start(); |
425 Node* const control = graph()->start(); | 407 Node* const control = graph()->start(); |
426 Reduction const r = Reduce( | 408 Reduction const r = Reduce( |
427 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), | 409 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 CaptureEq(&if_false0)))))), | 452 CaptureEq(&if_false0)))))), |
471 IsMerge( | 453 IsMerge( |
472 IsIfTrue(AllOf(CaptureEq(&branch0), | 454 IsIfTrue(AllOf(CaptureEq(&branch0), |
473 IsBranch(IsObjectIsSmi(input), control))), | 455 IsBranch(IsObjectIsSmi(input), control))), |
474 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 456 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
475 } | 457 } |
476 | 458 |
477 } // namespace compiler | 459 } // namespace compiler |
478 } // namespace internal | 460 } // namespace internal |
479 } // namespace v8 | 461 } // namespace v8 |
OLD | NEW |