| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "test/unittests/compiler/instruction-selector-unittest.h" | 5 #include "test/unittests/compiler/instruction-selector-unittest.h" |
| 6 | 6 |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
| 9 #include "src/flags.h" | 9 #include "src/flags.h" |
| 10 #include "test/unittests/compiler/compiler-test-utils.h" | 10 #include "test/unittests/compiler/compiler-test-utils.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { | 340 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
| 341 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, | 341 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
| 342 kMachAnyTagged); | 342 kMachAnyTagged); |
| 343 | 343 |
| 344 BailoutId bailout_id(42); | 344 BailoutId bailout_id(42); |
| 345 | 345 |
| 346 Node* function_node = m.Parameter(0); | 346 Node* function_node = m.Parameter(0); |
| 347 Node* receiver = m.Parameter(1); | 347 Node* receiver = m.Parameter(1); |
| 348 Node* context = m.Parameter(2); | 348 Node* context = m.Parameter(2); |
| 349 | 349 |
| 350 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); | 350 ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
| 351 Node* locals = m.NewNode(m.common()->StateValues(0)); | 351 ZoneVector<MachineType> empty_types(zone()); |
| 352 Node* stack = m.NewNode(m.common()->StateValues(0)); | 352 |
| 353 Node* parameters = |
| 354 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1)); |
| 355 Node* locals = m.NewNode(m.common()->TypedStateValues(&empty_types)); |
| 356 Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types)); |
| 353 Node* context_dummy = m.Int32Constant(0); | 357 Node* context_dummy = m.Int32Constant(0); |
| 354 | 358 |
| 355 Node* state_node = m.NewNode( | 359 Node* state_node = m.NewNode( |
| 356 m.common()->FrameState(JS_FRAME, bailout_id, | 360 m.common()->FrameState(JS_FRAME, bailout_id, |
| 357 OutputFrameStateCombine::Push()), | 361 OutputFrameStateCombine::Push()), |
| 358 parameters, locals, stack, context_dummy, m.UndefinedConstant()); | 362 parameters, locals, stack, context_dummy, m.UndefinedConstant()); |
| 359 Node* call = m.CallJS0(function_node, receiver, context, state_node); | 363 Node* call = m.CallJS0(function_node, receiver, context, state_node); |
| 360 m.Return(call); | 364 m.Return(call); |
| 361 | 365 |
| 362 Stream s = m.Build(kAllExceptNopInstructions); | 366 Stream s = m.Build(kAllExceptNopInstructions); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 380 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, | 384 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
| 381 kMachAnyTagged); | 385 kMachAnyTagged); |
| 382 | 386 |
| 383 BailoutId bailout_id_before(42); | 387 BailoutId bailout_id_before(42); |
| 384 | 388 |
| 385 // Some arguments for the call node. | 389 // Some arguments for the call node. |
| 386 Node* function_node = m.Parameter(0); | 390 Node* function_node = m.Parameter(0); |
| 387 Node* receiver = m.Parameter(1); | 391 Node* receiver = m.Parameter(1); |
| 388 Node* context = m.Int32Constant(1); // Context is ignored. | 392 Node* context = m.Int32Constant(1); // Context is ignored. |
| 389 | 393 |
| 394 ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
| 395 ZoneVector<MachineType> float64_type(1, kMachFloat64, zone()); |
| 396 ZoneVector<MachineType> tagged_type(1, kMachAnyTagged, zone()); |
| 397 |
| 390 // Build frame state for the state before the call. | 398 // Build frame state for the state before the call. |
| 391 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); | 399 Node* parameters = |
| 392 Node* locals = m.NewNode(m.common()->StateValues(1), m.Float64Constant(0.5)); | 400 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); |
| 393 Node* stack = m.NewNode(m.common()->StateValues(1), m.UndefinedConstant()); | 401 Node* locals = m.NewNode(m.common()->TypedStateValues(&float64_type), |
| 402 m.Float64Constant(0.5)); |
| 403 Node* stack = m.NewNode(m.common()->TypedStateValues(&tagged_type), |
| 404 m.UndefinedConstant()); |
| 394 | 405 |
| 395 Node* context_sentinel = m.Int32Constant(0); | 406 Node* context_sentinel = m.Int32Constant(0); |
| 396 Node* frame_state_before = m.NewNode( | 407 Node* frame_state_before = m.NewNode( |
| 397 m.common()->FrameState(JS_FRAME, bailout_id_before, | 408 m.common()->FrameState(JS_FRAME, bailout_id_before, |
| 398 OutputFrameStateCombine::Push()), | 409 OutputFrameStateCombine::Push()), |
| 399 parameters, locals, stack, context_sentinel, m.UndefinedConstant()); | 410 parameters, locals, stack, context_sentinel, m.UndefinedConstant()); |
| 400 | 411 |
| 401 // Build the call. | 412 // Build the call. |
| 402 Node* call = m.CallFunctionStub0(function_node, receiver, context, | 413 Node* call = m.CallFunctionStub0(function_node, receiver, context, |
| 403 frame_state_before, CALL_AS_METHOD); | 414 frame_state_before, CALL_AS_METHOD); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 kMachAnyTagged); | 477 kMachAnyTagged); |
| 467 | 478 |
| 468 BailoutId bailout_id_before(42); | 479 BailoutId bailout_id_before(42); |
| 469 BailoutId bailout_id_parent(62); | 480 BailoutId bailout_id_parent(62); |
| 470 | 481 |
| 471 // Some arguments for the call node. | 482 // Some arguments for the call node. |
| 472 Node* function_node = m.Parameter(0); | 483 Node* function_node = m.Parameter(0); |
| 473 Node* receiver = m.Parameter(1); | 484 Node* receiver = m.Parameter(1); |
| 474 Node* context = m.Int32Constant(66); | 485 Node* context = m.Int32Constant(66); |
| 475 | 486 |
| 487 ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
| 488 ZoneVector<MachineType> int32x2_type(2, kMachInt32, zone()); |
| 489 ZoneVector<MachineType> float64_type(1, kMachFloat64, zone()); |
| 490 |
| 476 // Build frame state for the state before the call. | 491 // Build frame state for the state before the call. |
| 477 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(63)); | 492 Node* parameters = |
| 478 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(64)); | 493 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63)); |
| 479 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(65)); | 494 Node* locals = |
| 495 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64)); |
| 496 Node* stack = |
| 497 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65)); |
| 480 Node* frame_state_parent = | 498 Node* frame_state_parent = |
| 481 m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_parent, | 499 m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_parent, |
| 482 OutputFrameStateCombine::Ignore()), | 500 OutputFrameStateCombine::Ignore()), |
| 483 parameters, locals, stack, context, m.UndefinedConstant()); | 501 parameters, locals, stack, context, m.UndefinedConstant()); |
| 484 | 502 |
| 485 Node* context2 = m.Int32Constant(46); | 503 Node* context2 = m.Int32Constant(46); |
| 486 Node* parameters2 = | 504 Node* parameters2 = |
| 487 m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); | 505 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); |
| 488 Node* locals2 = | 506 Node* locals2 = m.NewNode(m.common()->TypedStateValues(&float64_type), |
| 489 m.NewNode(m.common()->StateValues(1), m.Float64Constant(0.25)); | 507 m.Float64Constant(0.25)); |
| 490 Node* stack2 = m.NewNode(m.common()->StateValues(2), m.Int32Constant(44), | 508 Node* stack2 = m.NewNode(m.common()->TypedStateValues(&int32x2_type), |
| 491 m.Int32Constant(45)); | 509 m.Int32Constant(44), m.Int32Constant(45)); |
| 492 Node* frame_state_before = | 510 Node* frame_state_before = |
| 493 m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before, | 511 m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before, |
| 494 OutputFrameStateCombine::Push()), | 512 OutputFrameStateCombine::Push()), |
| 495 parameters2, locals2, stack2, context2, frame_state_parent); | 513 parameters2, locals2, stack2, context2, frame_state_parent); |
| 496 | 514 |
| 497 // Build the call. | 515 // Build the call. |
| 498 Node* call = m.CallFunctionStub0(function_node, receiver, context2, | 516 Node* call = m.CallFunctionStub0(function_node, receiver, context2, |
| 499 frame_state_before, CALL_AS_METHOD); | 517 frame_state_before, CALL_AS_METHOD); |
| 500 | 518 |
| 501 m.Return(call); | 519 m.Return(call); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); | 582 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); |
| 565 // Continuation. | 583 // Continuation. |
| 566 | 584 |
| 567 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 585 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
| 568 EXPECT_EQ(index, s.size()); | 586 EXPECT_EQ(index, s.size()); |
| 569 } | 587 } |
| 570 | 588 |
| 571 } // namespace compiler | 589 } // namespace compiler |
| 572 } // namespace internal | 590 } // namespace internal |
| 573 } // namespace v8 | 591 } // namespace v8 |
| OLD | NEW |