| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), | 270 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), |
| 271 input, context, effect, control)); | 271 input, context, effect, control)); |
| 272 ASSERT_TRUE(r.Changed()); | 272 ASSERT_TRUE(r.Changed()); |
| 273 EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input)); | 273 EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input)); |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 // ----------------------------------------------------------------------------- | 277 // ----------------------------------------------------------------------------- |
| 278 // %_MathClz32 | 278 // %_MathClz32 |
| 279 | 279 |
| 280 | |
| 281 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { | 280 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
| 282 Node* const input = Parameter(0); | 281 Node* const input = Parameter(0); |
| 283 Node* const context = Parameter(1); | 282 Node* const context = Parameter(1); |
| 284 Node* const effect = graph()->start(); | 283 Node* const effect = graph()->start(); |
| 285 Node* const control = graph()->start(); | 284 Node* const control = graph()->start(); |
| 286 Reduction const r = Reduce( | 285 Reduction const r = Reduce( |
| 287 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), | 286 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), |
| 288 input, context, effect, control)); | 287 input, context, effect, control)); |
| 289 ASSERT_TRUE(r.Changed()); | 288 ASSERT_TRUE(r.Changed()); |
| 290 EXPECT_THAT(r.replacement(), IsWord32Clz(input)); | 289 EXPECT_THAT(r.replacement(), IsWord32Clz(input)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 effect, CaptureEq(&if_false0)), | 326 effect, CaptureEq(&if_false0)), |
| 328 effect, _), | 327 effect, _), |
| 329 IsInt32Constant(JS_VALUE_TYPE)), | 328 IsInt32Constant(JS_VALUE_TYPE)), |
| 330 CaptureEq(&if_false0)))))), | 329 CaptureEq(&if_false0)))))), |
| 331 IsMerge( | 330 IsMerge( |
| 332 IsIfTrue(AllOf(CaptureEq(&branch0), | 331 IsIfTrue(AllOf(CaptureEq(&branch0), |
| 333 IsBranch(IsObjectIsSmi(input), control))), | 332 IsBranch(IsObjectIsSmi(input), control))), |
| 334 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 333 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
| 335 } | 334 } |
| 336 | 335 |
| 336 // ----------------------------------------------------------------------------- |
| 337 // %_GetOrdinaryHasInstance |
| 338 |
| 339 TEST_F(JSIntrinsicLoweringTest, InlineGetOrdinaryHasInstance) { |
| 340 Node* const context = Parameter(0); |
| 341 Node* const effect = graph()->start(); |
| 342 Node* const control = graph()->start(); |
| 343 Reduction const r = Reduce(graph()->NewNode( |
| 344 javascript()->CallRuntime(Runtime::kInlineGetOrdinaryHasInstance, 0), |
| 345 context, effect, control)); |
| 346 ASSERT_TRUE(r.Changed()); |
| 347 EXPECT_THAT( |
| 348 r.replacement(), |
| 349 IsLoadContext( |
| 350 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); |
| 351 } |
| 352 |
| 337 } // namespace compiler | 353 } // namespace compiler |
| 338 } // namespace internal | 354 } // namespace internal |
| 339 } // namespace v8 | 355 } // namespace v8 |
| OLD | NEW |