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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); | 505 ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
506 ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); | 506 ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); |
507 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); | 507 ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
508 | 508 |
509 Callable callable = CodeFactory::ToObject(isolate()); | 509 Callable callable = CodeFactory::ToObject(isolate()); |
510 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 510 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
511 isolate(), zone(), callable.descriptor(), 1, | 511 isolate(), zone(), callable.descriptor(), 1, |
512 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); | 512 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
513 | 513 |
514 // Build frame state for the state before the call. | 514 // Build frame state for the state before the call. |
515 Node* parameters = | 515 Node* parameters = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
516 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63)); | 516 m.Int32Constant(63)); |
517 Node* locals = | 517 Node* locals = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
518 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64)); | 518 m.Int32Constant(64)); |
519 Node* stack = | 519 Node* stack = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
520 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65)); | 520 m.Int32Constant(65)); |
521 Node* frame_state_parent = m.AddNode( | 521 Node* frame_state_parent = m.AddNode( |
522 m.common()->FrameState(bailout_id_parent, | 522 m.common()->FrameState(bailout_id_parent, |
523 OutputFrameStateCombine::Ignore(), | 523 OutputFrameStateCombine::Ignore(), |
524 m.GetFrameStateFunctionInfo(1, 1)), | 524 m.GetFrameStateFunctionInfo(1, 1)), |
525 parameters, locals, stack, context, function_node, m.UndefinedConstant()); | 525 parameters, locals, stack, context, function_node, m.UndefinedConstant()); |
526 | 526 |
527 Node* parameters2 = | 527 Node* parameters2 = m.AddNode(m.common()->TypedStateValues(&int32_type, 0u), |
528 m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); | 528 m.Int32Constant(43)); |
529 Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type), | 529 Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type, 0u), |
530 m.Float64Constant(0.25)); | 530 m.Float64Constant(0.25)); |
531 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type), | 531 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type, 0u), |
532 m.Int32Constant(44), m.Int32Constant(45)); | 532 m.Int32Constant(44), m.Int32Constant(45)); |
533 Node* state_node = m.AddNode( | 533 Node* state_node = m.AddNode( |
534 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), | 534 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), |
535 m.GetFrameStateFunctionInfo(1, 1)), | 535 m.GetFrameStateFunctionInfo(1, 1)), |
536 parameters2, locals2, stack2, context2, function_node, | 536 parameters2, locals2, stack2, context2, function_node, |
537 frame_state_parent); | 537 frame_state_parent); |
538 | 538 |
539 // Build the call. | 539 // Build the call. |
540 Node* args[] = {function_node, receiver, context2}; | 540 Node* args[] = {function_node, receiver, context2}; |
541 Node* stub_code = m.HeapConstant(callable.code()); | 541 Node* stub_code = m.HeapConstant(callable.code()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); | 597 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); |
598 // Continuation. | 598 // Continuation. |
599 | 599 |
600 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 600 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
601 EXPECT_EQ(index, s.size()); | 601 EXPECT_EQ(index, s.size()); |
602 } | 602 } |
603 | 603 |
604 } // namespace compiler | 604 } // namespace compiler |
605 } // namespace internal | 605 } // namespace internal |
606 } // namespace v8 | 606 } // namespace v8 |
OLD | NEW |