| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/compiler-source-position-table.h" | 8 #include "src/compiler/compiler-source-position-table.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/schedule.h" | 10 #include "src/compiler/schedule.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 Node* receiver = m.Parameter(1); | 357 Node* receiver = m.Parameter(1); |
| 358 Node* context = m.Parameter(2); | 358 Node* context = m.Parameter(2); |
| 359 | 359 |
| 360 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); | 360 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
| 361 ZoneVector<MachineType> empty_types(zone()); | 361 ZoneVector<MachineType> empty_types(zone()); |
| 362 | 362 |
| 363 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( | 363 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( |
| 364 zone(), false, 1, CallDescriptor::kNeedsFrameState); | 364 zone(), false, 1, CallDescriptor::kNeedsFrameState); |
| 365 | 365 |
| 366 // Build frame state for the state before the call. | 366 // Build frame state for the state before the call. |
| 367 Node* parameters = | 367 Node* parameters = m.AddNode( |
| 368 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1)); | 368 m.common()->TypedStateValues(&int32_type, SparseInputMask::Dense()), |
| 369 Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types)); | 369 m.Int32Constant(1)); |
| 370 Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types)); | 370 Node* locals = m.AddNode( |
| 371 m.common()->TypedStateValues(&empty_types, SparseInputMask::Dense())); |
| 372 Node* stack = m.AddNode( |
| 373 m.common()->TypedStateValues(&empty_types, SparseInputMask::Dense())); |
| 371 Node* context_sentinel = m.Int32Constant(0); | 374 Node* context_sentinel = m.Int32Constant(0); |
| 372 Node* state_node = m.AddNode( | 375 Node* state_node = m.AddNode( |
| 373 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), | 376 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), |
| 374 m.GetFrameStateFunctionInfo(1, 0)), | 377 m.GetFrameStateFunctionInfo(1, 0)), |
| 375 parameters, locals, stack, context_sentinel, function_node, | 378 parameters, locals, stack, context_sentinel, function_node, |
| 376 m.UndefinedConstant()); | 379 m.UndefinedConstant()); |
| 377 | 380 |
| 378 // Build the call. | 381 // Build the call. |
| 379 Node* args[] = {receiver, m.UndefinedConstant(), m.Int32Constant(1), context}; | 382 Node* args[] = {receiver, m.UndefinedConstant(), m.Int32Constant(1), context}; |
| 380 Node* call = | 383 Node* call = |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); | 415 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
| 413 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); | 416 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
| 414 ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone()); | 417 ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone()); |
| 415 | 418 |
| 416 Callable callable = CodeFactory::ToObject(isolate()); | 419 Callable callable = CodeFactory::ToObject(isolate()); |
| 417 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 420 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 418 isolate(), zone(), callable.descriptor(), 1, | 421 isolate(), zone(), callable.descriptor(), 1, |
| 419 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); | 422 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
| 420 | 423 |
| 421 // Build frame state for the state before the call. | 424 // Build frame state for the state before the call. |
| 422 Node* parameters = | 425 Node* parameters = m.AddNode( |
| 423 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); | 426 m.common()->TypedStateValues(&int32_type, SparseInputMask::Dense()), |
| 424 Node* locals = m.AddNode(m.common()->TypedStateValues(&float64_type), | 427 m.Int32Constant(43)); |
| 425 m.Float64Constant(0.5)); | 428 Node* locals = m.AddNode( |
| 426 Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type), | 429 m.common()->TypedStateValues(&float64_type, SparseInputMask::Dense()), |
| 427 m.UndefinedConstant()); | 430 m.Float64Constant(0.5)); |
| 431 Node* stack = m.AddNode( |
| 432 m.common()->TypedStateValues(&tagged_type, SparseInputMask::Dense()), |
| 433 m.UndefinedConstant()); |
| 428 Node* context_sentinel = m.Int32Constant(0); | 434 Node* context_sentinel = m.Int32Constant(0); |
| 429 Node* state_node = m.AddNode( | 435 Node* state_node = m.AddNode( |
| 430 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), | 436 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), |
| 431 m.GetFrameStateFunctionInfo(1, 1)), | 437 m.GetFrameStateFunctionInfo(1, 1)), |
| 432 parameters, locals, stack, context_sentinel, function_node, | 438 parameters, locals, stack, context_sentinel, function_node, |
| 433 m.UndefinedConstant()); | 439 m.UndefinedConstant()); |
| 434 | 440 |
| 435 // Build the call. | 441 // Build the call. |
| 436 Node* args[] = {function_node, receiver, context}; | 442 Node* args[] = {function_node, receiver, context}; |
| 437 Node* stub_code = m.HeapConstant(callable.code()); | 443 Node* stub_code = m.HeapConstant(callable.code()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); | 511 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
| 506 ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); | 512 ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); |
| 507 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); | 513 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
| 508 | 514 |
| 509 Callable callable = CodeFactory::ToObject(isolate()); | 515 Callable callable = CodeFactory::ToObject(isolate()); |
| 510 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 516 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 511 isolate(), zone(), callable.descriptor(), 1, | 517 isolate(), zone(), callable.descriptor(), 1, |
| 512 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); | 518 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
| 513 | 519 |
| 514 // Build frame state for the state before the call. | 520 // Build frame state for the state before the call. |
| 515 Node* parameters = | 521 Node* parameters = m.AddNode( |
| 516 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63)); | 522 m.common()->TypedStateValues(&int32_type, SparseInputMask::Dense()), |
| 517 Node* locals = | 523 m.Int32Constant(63)); |
| 518 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64)); | 524 Node* locals = m.AddNode( |
| 519 Node* stack = | 525 m.common()->TypedStateValues(&int32_type, SparseInputMask::Dense()), |
| 520 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65)); | 526 m.Int32Constant(64)); |
| 527 Node* stack = m.AddNode( |
| 528 m.common()->TypedStateValues(&int32_type, SparseInputMask::Dense()), |
| 529 m.Int32Constant(65)); |
| 521 Node* frame_state_parent = m.AddNode( | 530 Node* frame_state_parent = m.AddNode( |
| 522 m.common()->FrameState(bailout_id_parent, | 531 m.common()->FrameState(bailout_id_parent, |
| 523 OutputFrameStateCombine::Ignore(), | 532 OutputFrameStateCombine::Ignore(), |
| 524 m.GetFrameStateFunctionInfo(1, 1)), | 533 m.GetFrameStateFunctionInfo(1, 1)), |
| 525 parameters, locals, stack, context, function_node, m.UndefinedConstant()); | 534 parameters, locals, stack, context, function_node, m.UndefinedConstant()); |
| 526 | 535 |
| 527 Node* parameters2 = | 536 Node* parameters2 = m.AddNode( |
| 528 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); | 537 m.common()->TypedStateValues(&int32_type, SparseInputMask::Dense()), |
| 529 Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type), | 538 m.Int32Constant(43)); |
| 530 m.Float64Constant(0.25)); | 539 Node* locals2 = m.AddNode( |
| 531 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type), | 540 m.common()->TypedStateValues(&float64_type, SparseInputMask::Dense()), |
| 532 m.Int32Constant(44), m.Int32Constant(45)); | 541 m.Float64Constant(0.25)); |
| 542 Node* stack2 = m.AddNode( |
| 543 m.common()->TypedStateValues(&int32x2_type, SparseInputMask::Dense()), |
| 544 m.Int32Constant(44), m.Int32Constant(45)); |
| 533 Node* state_node = m.AddNode( | 545 Node* state_node = m.AddNode( |
| 534 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), | 546 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), |
| 535 m.GetFrameStateFunctionInfo(1, 1)), | 547 m.GetFrameStateFunctionInfo(1, 1)), |
| 536 parameters2, locals2, stack2, context2, function_node, | 548 parameters2, locals2, stack2, context2, function_node, |
| 537 frame_state_parent); | 549 frame_state_parent); |
| 538 | 550 |
| 539 // Build the call. | 551 // Build the call. |
| 540 Node* args[] = {function_node, receiver, context2}; | 552 Node* args[] = {function_node, receiver, context2}; |
| 541 Node* stub_code = m.HeapConstant(callable.code()); | 553 Node* stub_code = m.HeapConstant(callable.code()); |
| 542 Node* call = m.CallNWithFrameState(descriptor, stub_code, args, state_node); | 554 Node* call = m.CallNWithFrameState(descriptor, stub_code, args, state_node); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); | 609 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); |
| 598 // Continuation. | 610 // Continuation. |
| 599 | 611 |
| 600 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 612 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
| 601 EXPECT_EQ(index, s.size()); | 613 EXPECT_EQ(index, s.size()); |
| 602 } | 614 } |
| 603 | 615 |
| 604 } // namespace compiler | 616 } // namespace compiler |
| 605 } // namespace internal | 617 } // namespace internal |
| 606 } // namespace v8 | 618 } // namespace v8 |
| OLD | NEW |