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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 BailoutId bailout_id(42); | 360 BailoutId bailout_id(42); |
361 | 361 |
362 Node* function_node = m.Parameter(0); | 362 Node* function_node = m.Parameter(0); |
363 Node* receiver = m.Parameter(1); | 363 Node* receiver = m.Parameter(1); |
364 Node* context = m.Parameter(2); | 364 Node* context = m.Parameter(2); |
365 | 365 |
366 ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); | 366 ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
367 ZoneVector<MachineType> empty_types(zone()); | 367 ZoneVector<MachineType> empty_types(zone()); |
368 | 368 |
| 369 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( |
| 370 zone(), false, 1, CallDescriptor::kNeedsFrameState); |
| 371 |
369 Node* parameters = | 372 Node* parameters = |
370 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1)); | 373 m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1)); |
371 Node* locals = m.NewNode(m.common()->TypedStateValues(&empty_types)); | 374 Node* locals = m.NewNode(m.common()->TypedStateValues(&empty_types)); |
372 Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types)); | 375 Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types)); |
373 Node* context_dummy = m.Int32Constant(0); | 376 Node* context_dummy = m.Int32Constant(0); |
374 | 377 |
375 Node* state_node = m.NewNode( | 378 Node* state_node = m.NewNode( |
376 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), | 379 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), |
377 m.GetFrameStateFunctionInfo(1, 0)), | 380 m.GetFrameStateFunctionInfo(1, 0)), |
378 parameters, locals, stack, context_dummy, function_node, | 381 parameters, locals, stack, context_dummy, function_node, |
379 m.UndefinedConstant()); | 382 m.UndefinedConstant()); |
380 Node* call = m.CallJS0(function_node, receiver, context, state_node); | 383 Node* args[] = {receiver, context}; |
| 384 Node* call = |
| 385 m.CallNWithFrameState(descriptor, function_node, args, state_node); |
381 m.Return(call); | 386 m.Return(call); |
382 | 387 |
383 Stream s = m.Build(kAllExceptNopInstructions); | 388 Stream s = m.Build(kAllExceptNopInstructions); |
384 | 389 |
385 // Skip until kArchCallJSFunction. | 390 // Skip until kArchCallJSFunction. |
386 size_t index = 0; | 391 size_t index = 0; |
387 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; | 392 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; |
388 index++) { | 393 index++) { |
389 } | 394 } |
390 // Now we should have two instructions: call and return. | 395 // Now we should have two instructions: call and return. |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); | 611 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); |
607 // Continuation. | 612 // Continuation. |
608 | 613 |
609 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 614 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
610 EXPECT_EQ(index, s.size()); | 615 EXPECT_EQ(index, s.size()); |
611 } | 616 } |
612 | 617 |
613 } // namespace compiler | 618 } // namespace compiler |
614 } // namespace internal | 619 } // namespace internal |
615 } // namespace v8 | 620 } // namespace v8 |
OLD | NEW |