| 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(m.common()->TypedStateValues(&int32_type, 0u), |
| 368 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1)); | 368 m.Int32Constant(1)); |
| 369 Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types)); | 369 Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types, 0u)); |
| 370 Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types)); | 370 Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types, 0u)); |
| 371 Node* context_sentinel = m.Int32Constant(0); | 371 Node* context_sentinel = m.Int32Constant(0); |
| 372 Node* state_node = m.AddNode( | 372 Node* state_node = m.AddNode( |
| 373 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), | 373 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), |
| 374 m.GetFrameStateFunctionInfo(1, 0)), | 374 m.GetFrameStateFunctionInfo(1, 0)), |
| 375 parameters, locals, stack, context_sentinel, function_node, | 375 parameters, locals, stack, context_sentinel, function_node, |
| 376 m.UndefinedConstant()); | 376 m.UndefinedConstant()); |
| 377 | 377 |
| 378 // Build the call. | 378 // Build the call. |
| 379 Node* args[] = {receiver, m.UndefinedConstant(), m.Int32Constant(1), context}; | 379 Node* args[] = {receiver, m.UndefinedConstant(), m.Int32Constant(1), context}; |
| 380 Node* call = | 380 Node* call = |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); | 412 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
| 413 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); | 413 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
| 414 ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone()); | 414 ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone()); |
| 415 | 415 |
| 416 Callable callable = CodeFactory::ToObject(isolate()); | 416 Callable callable = CodeFactory::ToObject(isolate()); |
| 417 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 417 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 418 isolate(), zone(), callable.descriptor(), 1, | 418 isolate(), zone(), callable.descriptor(), 1, |
| 419 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); | 419 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
| 420 | 420 |
| 421 // Build frame state for the state before the call. | 421 // Build frame state for the state before the call. |
| 422 Node* parameters = | 422 Node* parameters = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
| 423 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); | 423 m.Int32Constant(43)); |
| 424 Node* locals = m.AddNode(m.common()->TypedStateValues(&float64_type), | 424 Node* locals = m.AddNode(m.common()->TypedStateValues(&float64_type, 0u), |
| 425 m.Float64Constant(0.5)); | 425 m.Float64Constant(0.5)); |
| 426 Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type), | 426 Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type, 0u), |
| 427 m.UndefinedConstant()); | 427 m.UndefinedConstant()); |
| 428 Node* context_sentinel = m.Int32Constant(0); | 428 Node* context_sentinel = m.Int32Constant(0); |
| 429 Node* state_node = m.AddNode( | 429 Node* state_node = m.AddNode( |
| 430 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), | 430 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), |
| 431 m.GetFrameStateFunctionInfo(1, 1)), | 431 m.GetFrameStateFunctionInfo(1, 1)), |
| 432 parameters, locals, stack, context_sentinel, function_node, | 432 parameters, locals, stack, context_sentinel, function_node, |
| 433 m.UndefinedConstant()); | 433 m.UndefinedConstant()); |
| 434 | 434 |
| 435 // Build the call. | 435 // Build the call. |
| 436 Node* args[] = {function_node, receiver, context}; | 436 Node* args[] = {function_node, receiver, context}; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); | 514 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
| 515 ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); | 515 ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); |
| 516 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); | 516 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
| 517 | 517 |
| 518 Callable callable = CodeFactory::ToObject(isolate()); | 518 Callable callable = CodeFactory::ToObject(isolate()); |
| 519 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 519 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 520 isolate(), zone(), callable.descriptor(), 1, | 520 isolate(), zone(), callable.descriptor(), 1, |
| 521 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); | 521 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
| 522 | 522 |
| 523 // Build frame state for the state before the call. | 523 // Build frame state for the state before the call. |
| 524 Node* parameters = | 524 Node* parameters = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
| 525 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63)); | 525 m.Int32Constant(63)); |
| 526 Node* locals = | 526 Node* locals = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
| 527 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64)); | 527 m.Int32Constant(64)); |
| 528 Node* stack = | 528 Node* stack = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
| 529 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65)); | 529 m.Int32Constant(65)); |
| 530 Node* frame_state_parent = m.AddNode( | 530 Node* frame_state_parent = m.AddNode( |
| 531 m.common()->FrameState(bailout_id_parent, | 531 m.common()->FrameState(bailout_id_parent, |
| 532 OutputFrameStateCombine::Ignore(), | 532 OutputFrameStateCombine::Ignore(), |
| 533 m.GetFrameStateFunctionInfo(1, 1)), | 533 m.GetFrameStateFunctionInfo(1, 1)), |
| 534 parameters, locals, stack, context, function_node, m.UndefinedConstant()); | 534 parameters, locals, stack, context, function_node, m.UndefinedConstant()); |
| 535 | 535 |
| 536 Node* parameters2 = | 536 Node* parameters2 = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
| 537 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); | 537 m.Int32Constant(43)); |
| 538 Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type), | 538 Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type, 0u), |
| 539 m.Float64Constant(0.25)); | 539 m.Float64Constant(0.25)); |
| 540 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type), | 540 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type, 0u), |
| 541 m.Int32Constant(44), m.Int32Constant(45)); | 541 m.Int32Constant(44), m.Int32Constant(45)); |
| 542 Node* state_node = m.AddNode( | 542 Node* state_node = m.AddNode( |
| 543 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), | 543 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), |
| 544 m.GetFrameStateFunctionInfo(1, 1)), | 544 m.GetFrameStateFunctionInfo(1, 1)), |
| 545 parameters2, locals2, stack2, context2, function_node, | 545 parameters2, locals2, stack2, context2, function_node, |
| 546 frame_state_parent); | 546 frame_state_parent); |
| 547 | 547 |
| 548 // Build the call. | 548 // Build the call. |
| 549 Node* args[] = {function_node, receiver, context2}; | 549 Node* args[] = {function_node, receiver, context2}; |
| 550 Node* stub_code = m.HeapConstant(callable.code()); | 550 Node* stub_code = m.HeapConstant(callable.code()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); | 617 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); |
| 618 // Continuation. | 618 // Continuation. |
| 619 | 619 |
| 620 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 620 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
| 621 EXPECT_EQ(index, s.size()); | 621 EXPECT_EQ(index, s.size()); |
| 622 } | 622 } |
| 623 | 623 |
| 624 } // namespace compiler | 624 } // namespace compiler |
| 625 } // namespace internal | 625 } // namespace internal |
| 626 } // namespace v8 | 626 } // namespace v8 |
| OLD | NEW |