| 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/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/js-intrinsic-lowering.h" | 7 #include "src/compiler/js-intrinsic-lowering.h" |
| 8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
| 9 #include "test/unittests/compiler/graph-unittest.h" | 9 #include "test/unittests/compiler/graph-unittest.h" |
| 10 #include "test/unittests/compiler/node-test-utils.h" | 10 #include "test/unittests/compiler/node-test-utils.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // %_ConstructDouble | 45 // %_ConstructDouble |
| 46 | 46 |
| 47 | 47 |
| 48 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedConstructDouble) { | 48 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedConstructDouble) { |
| 49 Node* const input0 = Parameter(0); | 49 Node* const input0 = Parameter(0); |
| 50 Node* const input1 = Parameter(1); | 50 Node* const input1 = Parameter(1); |
| 51 Node* const context = Parameter(2); | 51 Node* const context = Parameter(2); |
| 52 Node* const effect = graph()->start(); | 52 Node* const effect = graph()->start(); |
| 53 Node* const control = graph()->start(); | 53 Node* const control = graph()->start(); |
| 54 Reduction const r = Reduce(graph()->NewNode( | 54 Reduction const r = Reduce(graph()->NewNode( |
| 55 javascript()->CallRuntime(Runtime::kInlineOptimizedConstructDouble, 2), | 55 javascript()->CallRuntime(Runtime::kInlineConstructDouble, 2), input0, |
| 56 input0, input1, context, effect, control)); | 56 input1, context, effect, control)); |
| 57 ASSERT_TRUE(r.Changed()); | 57 ASSERT_TRUE(r.Changed()); |
| 58 EXPECT_THAT(r.replacement(), IsFloat64InsertHighWord32( | 58 EXPECT_THAT(r.replacement(), IsFloat64InsertHighWord32( |
| 59 IsFloat64InsertLowWord32( | 59 IsFloat64InsertLowWord32( |
| 60 IsNumberConstant(BitEq(0.0)), input1), | 60 IsNumberConstant(BitEq(0.0)), input1), |
| 61 input0)); | 61 input0)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 // ----------------------------------------------------------------------------- | 65 // ----------------------------------------------------------------------------- |
| 66 // %_DoubleLo | 66 // %_DoubleLo |
| 67 | 67 |
| 68 | 68 |
| 69 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) { | 69 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) { |
| 70 Node* const input = Parameter(0); | 70 Node* const input = Parameter(0); |
| 71 Node* const context = Parameter(1); | 71 Node* const context = Parameter(1); |
| 72 Node* const effect = graph()->start(); | 72 Node* const effect = graph()->start(); |
| 73 Node* const control = graph()->start(); | 73 Node* const control = graph()->start(); |
| 74 Reduction const r = Reduce(graph()->NewNode( | 74 Reduction const r = Reduce( |
| 75 javascript()->CallRuntime(Runtime::kInlineOptimizedDoubleLo, 1), input, | 75 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleLo, 1), |
| 76 context, effect, control)); | 76 input, context, effect, control)); |
| 77 ASSERT_TRUE(r.Changed()); | 77 ASSERT_TRUE(r.Changed()); |
| 78 EXPECT_THAT(r.replacement(), IsFloat64ExtractLowWord32(input)); | 78 EXPECT_THAT(r.replacement(), IsFloat64ExtractLowWord32(input)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 // ----------------------------------------------------------------------------- | 82 // ----------------------------------------------------------------------------- |
| 83 // %_DoubleHi | 83 // %_DoubleHi |
| 84 | 84 |
| 85 | 85 |
| 86 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) { | 86 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) { |
| 87 Node* const input = Parameter(0); | 87 Node* const input = Parameter(0); |
| 88 Node* const context = Parameter(1); | 88 Node* const context = Parameter(1); |
| 89 Node* const effect = graph()->start(); | 89 Node* const effect = graph()->start(); |
| 90 Node* const control = graph()->start(); | 90 Node* const control = graph()->start(); |
| 91 Reduction const r = Reduce(graph()->NewNode( | 91 Reduction const r = Reduce( |
| 92 javascript()->CallRuntime(Runtime::kInlineOptimizedDoubleHi, 1), input, | 92 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleHi, 1), |
| 93 context, effect, control)); | 93 input, context, effect, control)); |
| 94 ASSERT_TRUE(r.Changed()); | 94 ASSERT_TRUE(r.Changed()); |
| 95 EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32(input)); | 95 EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32(input)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 // ----------------------------------------------------------------------------- | 99 // ----------------------------------------------------------------------------- |
| 100 // %_IsSmi | 100 // %_IsSmi |
| 101 | 101 |
| 102 | 102 |
| 103 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { | 103 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 CaptureEq(&if_false0)))))), | 261 CaptureEq(&if_false0)))))), |
| 262 IsMerge( | 262 IsMerge( |
| 263 IsIfTrue(AllOf(CaptureEq(&branch0), | 263 IsIfTrue(AllOf(CaptureEq(&branch0), |
| 264 IsBranch(IsObjectIsSmi(input), control))), | 264 IsBranch(IsObjectIsSmi(input), control))), |
| 265 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 265 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace compiler | 268 } // namespace compiler |
| 269 } // namespace internal | 269 } // namespace internal |
| 270 } // namespace v8 | 270 } // namespace v8 |
| OLD | NEW |