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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 EXPECT_EQ(OutputFrameStateCombine::kPushOutput, | 470 EXPECT_EQ(OutputFrameStateCombine::kPushOutput, |
471 desc_before->state_combine().kind()); | 471 desc_before->state_combine().kind()); |
472 EXPECT_EQ(1u, desc_before->parameters_count()); | 472 EXPECT_EQ(1u, desc_before->parameters_count()); |
473 EXPECT_EQ(1u, desc_before->locals_count()); | 473 EXPECT_EQ(1u, desc_before->locals_count()); |
474 EXPECT_EQ(1u, desc_before->stack_count()); | 474 EXPECT_EQ(1u, desc_before->stack_count()); |
475 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(3))); | 475 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(3))); |
476 EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(4))); // This should be a context. | 476 EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(4))); // This should be a context. |
477 // We inserted 0 here. | 477 // We inserted 0 here. |
478 EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(5))); | 478 EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(5))); |
479 EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(6))->IsUndefined(isolate())); | 479 EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(6))->IsUndefined(isolate())); |
480 EXPECT_EQ(MachineType::AnyTagged(), | |
481 desc_before->GetType(0)); // function is always | |
482 // tagged/any. | |
483 EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1)); | |
484 EXPECT_EQ(MachineType::AnyTagged(), | |
485 desc_before->GetType(2)); // context is always | |
486 // tagged/any. | |
487 EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3)); | |
488 EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(4)); | |
489 | 480 |
490 // Function. | 481 // Function. |
491 EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(7))); | 482 EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(7))); |
492 // Context. | 483 // Context. |
493 EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(8))); | 484 EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(8))); |
494 | 485 |
495 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 486 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
496 | 487 |
497 EXPECT_EQ(index, s.size()); | 488 EXPECT_EQ(index, s.size()); |
498 } | 489 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // Deoptimization id. | 569 // Deoptimization id. |
579 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1)); | 570 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1)); |
580 FrameStateDescriptor* desc_before = | 571 FrameStateDescriptor* desc_before = |
581 s.GetFrameStateDescriptor(deopt_id_before); | 572 s.GetFrameStateDescriptor(deopt_id_before); |
582 FrameStateDescriptor* desc_before_outer = desc_before->outer_state(); | 573 FrameStateDescriptor* desc_before_outer = desc_before->outer_state(); |
583 EXPECT_EQ(bailout_id_before, desc_before->bailout_id()); | 574 EXPECT_EQ(bailout_id_before, desc_before->bailout_id()); |
584 EXPECT_EQ(1u, desc_before_outer->parameters_count()); | 575 EXPECT_EQ(1u, desc_before_outer->parameters_count()); |
585 EXPECT_EQ(1u, desc_before_outer->locals_count()); | 576 EXPECT_EQ(1u, desc_before_outer->locals_count()); |
586 EXPECT_EQ(1u, desc_before_outer->stack_count()); | 577 EXPECT_EQ(1u, desc_before_outer->stack_count()); |
587 // Values from parent environment. | 578 // Values from parent environment. |
588 EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0)); | |
589 EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(3))); | 579 EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(3))); |
590 EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(1)); | |
591 // Context: | 580 // Context: |
592 EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(4))); | 581 EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(4))); |
593 EXPECT_EQ(MachineType::AnyTagged(), desc_before_outer->GetType(2)); | |
594 EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(5))); | 582 EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(5))); |
595 EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(3)); | |
596 EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(6))); | 583 EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(6))); |
597 EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(4)); | |
598 // Values from the nested frame. | 584 // Values from the nested frame. |
599 EXPECT_EQ(1u, desc_before->parameters_count()); | 585 EXPECT_EQ(1u, desc_before->parameters_count()); |
600 EXPECT_EQ(1u, desc_before->locals_count()); | 586 EXPECT_EQ(1u, desc_before->locals_count()); |
601 EXPECT_EQ(2u, desc_before->stack_count()); | 587 EXPECT_EQ(2u, desc_before->stack_count()); |
602 EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0)); | |
603 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(8))); | 588 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(8))); |
604 EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1)); | |
605 EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(9))); | 589 EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(9))); |
606 EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(2)); | |
607 EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(10))); | 590 EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(10))); |
608 EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3)); | |
609 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(11))); | 591 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(11))); |
610 EXPECT_EQ(MachineType::Int32(), desc_before->GetType(4)); | |
611 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(12))); | 592 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(12))); |
612 EXPECT_EQ(MachineType::Int32(), desc_before->GetType(5)); | |
613 | 593 |
614 // Function. | 594 // Function. |
615 EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(13))); | 595 EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(13))); |
616 // Context. | 596 // Context. |
617 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); | 597 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); |
618 // Continuation. | 598 // Continuation. |
619 | 599 |
620 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 600 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
621 EXPECT_EQ(index, s.size()); | 601 EXPECT_EQ(index, s.size()); |
622 } | 602 } |
623 | 603 |
624 } // namespace compiler | 604 } // namespace compiler |
625 } // namespace internal | 605 } // namespace internal |
626 } // namespace v8 | 606 } // namespace v8 |
OLD | NEW |