| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) { | 85 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) { |
| 86 Node* const input = Parameter(0); | 86 Node* const input = Parameter(0); |
| 87 Node* const context = Parameter(1); | 87 Node* const context = Parameter(1); |
| 88 Node* const effect = graph()->start(); | 88 Node* const effect = graph()->start(); |
| 89 Node* const control = graph()->start(); | 89 Node* const control = graph()->start(); |
| 90 Reduction const r = Reduce( | 90 Reduction const r = Reduce( |
| 91 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleLo, 1), | 91 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleLo, 1), |
| 92 input, context, effect, control)); | 92 input, context, effect, control)); |
| 93 ASSERT_TRUE(r.Changed()); | 93 ASSERT_TRUE(r.Changed()); |
| 94 EXPECT_THAT(r.replacement(), IsFloat64ExtractLowWord32(input)); | 94 EXPECT_THAT(r.replacement(), |
| 95 IsFloat64ExtractLowWord32(IsGuard(Type::Number(), input, _))); |
| 95 } | 96 } |
| 96 | 97 |
| 97 | 98 |
| 98 // ----------------------------------------------------------------------------- | 99 // ----------------------------------------------------------------------------- |
| 99 // %_DoubleHi | 100 // %_DoubleHi |
| 100 | 101 |
| 101 | 102 |
| 102 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) { | 103 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) { |
| 103 Node* const input = Parameter(0); | 104 Node* const input = Parameter(0); |
| 104 Node* const context = Parameter(1); | 105 Node* const context = Parameter(1); |
| 105 Node* const effect = graph()->start(); | 106 Node* const effect = graph()->start(); |
| 106 Node* const control = graph()->start(); | 107 Node* const control = graph()->start(); |
| 107 Reduction const r = Reduce( | 108 Reduction const r = Reduce( |
| 108 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleHi, 1), | 109 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleHi, 1), |
| 109 input, context, effect, control)); | 110 input, context, effect, control)); |
| 110 ASSERT_TRUE(r.Changed()); | 111 ASSERT_TRUE(r.Changed()); |
| 111 EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32(input)); | 112 EXPECT_THAT(r.replacement(), |
| 113 IsFloat64ExtractHighWord32(IsGuard(Type::Number(), input, _))); |
| 112 } | 114 } |
| 113 | 115 |
| 114 | 116 |
| 115 // ----------------------------------------------------------------------------- | 117 // ----------------------------------------------------------------------------- |
| 116 // %_IsSmi | 118 // %_IsSmi |
| 117 | 119 |
| 118 | 120 |
| 119 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { | 121 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { |
| 120 Node* const input = Parameter(0); | 122 Node* const input = Parameter(0); |
| 121 Node* const context = Parameter(1); | 123 Node* const context = Parameter(1); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 265 |
| 264 TEST_F(JSIntrinsicLoweringTest, InlineMathSqrt) { | 266 TEST_F(JSIntrinsicLoweringTest, InlineMathSqrt) { |
| 265 Node* const input = Parameter(0); | 267 Node* const input = Parameter(0); |
| 266 Node* const context = Parameter(1); | 268 Node* const context = Parameter(1); |
| 267 Node* const effect = graph()->start(); | 269 Node* const effect = graph()->start(); |
| 268 Node* const control = graph()->start(); | 270 Node* const control = graph()->start(); |
| 269 Reduction const r = Reduce( | 271 Reduction const r = Reduce( |
| 270 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), | 272 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), |
| 271 input, context, effect, control)); | 273 input, context, effect, control)); |
| 272 ASSERT_TRUE(r.Changed()); | 274 ASSERT_TRUE(r.Changed()); |
| 273 EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input)); | 275 EXPECT_THAT(r.replacement(), |
| 276 IsFloat64Sqrt(IsGuard(Type::Number(), input, _))); |
| 274 } | 277 } |
| 275 | 278 |
| 276 | 279 |
| 277 // ----------------------------------------------------------------------------- | 280 // ----------------------------------------------------------------------------- |
| 278 // %_MathClz32 | 281 // %_MathClz32 |
| 279 | 282 |
| 280 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { | 283 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
| 281 Node* const input = Parameter(0); | 284 Node* const input = Parameter(0); |
| 282 Node* const context = Parameter(1); | 285 Node* const context = Parameter(1); |
| 283 Node* const effect = graph()->start(); | 286 Node* const effect = graph()->start(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 ASSERT_TRUE(r.Changed()); | 349 ASSERT_TRUE(r.Changed()); |
| 347 EXPECT_THAT( | 350 EXPECT_THAT( |
| 348 r.replacement(), | 351 r.replacement(), |
| 349 IsLoadContext( | 352 IsLoadContext( |
| 350 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); | 353 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); |
| 351 } | 354 } |
| 352 | 355 |
| 353 } // namespace compiler | 356 } // namespace compiler |
| 354 } // namespace internal | 357 } // namespace internal |
| 355 } // namespace v8 | 358 } // namespace v8 |
| OLD | NEW |