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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 Node* const control = graph()->start(); | 264 Node* const control = graph()->start(); |
265 Reduction const r = Reduce(graph()->NewNode( | 265 Reduction const r = Reduce(graph()->NewNode( |
266 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, | 266 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, |
267 context, effect, control)); | 267 context, effect, control)); |
268 ASSERT_TRUE(r.Changed()); | 268 ASSERT_TRUE(r.Changed()); |
269 EXPECT_THAT(r.replacement(), IsObjectIsReceiver(input)); | 269 EXPECT_THAT(r.replacement(), IsObjectIsReceiver(input)); |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 // ----------------------------------------------------------------------------- | 273 // ----------------------------------------------------------------------------- |
274 // %_JSValueGetValue | |
275 | |
276 | |
277 TEST_F(JSIntrinsicLoweringTest, InlineJSValueGetValue) { | |
278 Node* const input = Parameter(0); | |
279 Node* const context = Parameter(1); | |
280 Node* const effect = graph()->start(); | |
281 Node* const control = graph()->start(); | |
282 Reduction const r = Reduce(graph()->NewNode( | |
283 javascript()->CallRuntime(Runtime::kInlineJSValueGetValue, 1), input, | |
284 context, effect, control)); | |
285 ASSERT_TRUE(r.Changed()); | |
286 EXPECT_THAT(r.replacement(), | |
287 IsLoadField(AccessBuilder::ForValue(), input, effect, control)); | |
288 } | |
289 | |
290 | |
291 // ----------------------------------------------------------------------------- | |
292 // %_MathFloor | 274 // %_MathFloor |
293 | 275 |
294 | 276 |
295 TEST_F(JSIntrinsicLoweringTest, InlineMathFloor) { | 277 TEST_F(JSIntrinsicLoweringTest, InlineMathFloor) { |
296 Node* const input = Parameter(0); | 278 Node* const input = Parameter(0); |
297 Node* const context = Parameter(1); | 279 Node* const context = Parameter(1); |
298 Node* const effect = graph()->start(); | 280 Node* const effect = graph()->start(); |
299 Node* const control = graph()->start(); | 281 Node* const control = graph()->start(); |
300 Reduction const r = Reduce( | 282 Reduction const r = Reduce( |
301 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1), | 283 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1), |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 CaptureEq(&if_false0)))))), | 361 CaptureEq(&if_false0)))))), |
380 IsMerge( | 362 IsMerge( |
381 IsIfTrue(AllOf(CaptureEq(&branch0), | 363 IsIfTrue(AllOf(CaptureEq(&branch0), |
382 IsBranch(IsObjectIsSmi(input), control))), | 364 IsBranch(IsObjectIsSmi(input), control))), |
383 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 365 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
384 } | 366 } |
385 | 367 |
386 } // namespace compiler | 368 } // namespace compiler |
387 } // namespace internal | 369 } // namespace internal |
388 } // namespace v8 | 370 } // namespace v8 |
OLD | NEW |