OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 // Truee iff. the v2 is above v1 on stack, or one of them is constant. | 619 // Truee iff. the v2 is above v1 on stack, or one of them is constant. |
620 static bool VerifyValues(Value* v1, Value* v2) { | 620 static bool VerifyValues(Value* v1, Value* v2) { |
621 ASSERT(v1->IsUse() && v2->IsUse()); | 621 ASSERT(v1->IsUse() && v2->IsUse()); |
622 return (v1->AsUse()->definition()->temp_index() + 1) == | 622 return (v1->AsUse()->definition()->temp_index() + 1) == |
623 v2->AsUse()->definition()->temp_index(); | 623 v2->AsUse()->definition()->temp_index(); |
624 } | 624 } |
625 | 625 |
626 | 626 |
627 #define __ compiler->assembler()-> | 627 #define __ compiler->assembler()-> |
628 | 628 |
629 void GraphEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) { | 629 void GraphEntryInstr::PrepareEntry(FlowGraphCompilerShared* compiler) { |
630 // Nothing to do. | 630 // Nothing to do. |
631 } | 631 } |
632 | 632 |
633 | 633 |
634 void JoinEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) { | 634 void JoinEntryInstr::PrepareEntry(FlowGraphCompilerShared* compiler) { |
635 __ Bind(compiler->GetBlockLabel(this)); | 635 __ Bind(compiler->GetBlockLabel(this)); |
636 } | 636 } |
637 | 637 |
638 | 638 |
639 void TargetEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) { | 639 void TargetEntryInstr::PrepareEntry(FlowGraphCompilerShared* compiler) { |
640 __ Bind(compiler->GetBlockLabel(this)); | 640 __ Bind(compiler->GetBlockLabel(this)); |
641 if (HasTryIndex()) { | 641 if (HasTryIndex()) { |
642 compiler->AddExceptionHandler(try_index(), | 642 compiler->AddExceptionHandler(try_index(), |
643 compiler->assembler()->CodeSize()); | 643 compiler->assembler()->CodeSize()); |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 | 647 |
648 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 648 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
649 const int kNumInputs = 0; | 649 const int kNumInputs = 0; |
650 const int kNumTemps = 0; | 650 const int kNumTemps = 0; |
651 return new LocationSummary(kNumInputs, kNumTemps); | 651 return new LocationSummary(kNumInputs, kNumTemps); |
652 } | 652 } |
653 | 653 |
654 | 654 |
655 | 655 |
656 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 656 void ThrowInstr::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
657 ASSERT(exception()->IsUse()); | 657 ASSERT(exception()->IsUse()); |
658 compiler->GenerateCallRuntime(cid(), | 658 compiler->GenerateCallRuntime(cid(), |
659 token_index(), | 659 token_index(), |
660 try_index(), | 660 try_index(), |
661 kThrowRuntimeEntry); | 661 kThrowRuntimeEntry); |
662 __ int3(); | 662 __ int3(); |
663 } | 663 } |
664 | 664 |
665 | 665 |
666 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 666 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
667 const int kNumInputs = 0; | 667 const int kNumInputs = 0; |
668 const int kNumTemps = 0; | 668 const int kNumTemps = 0; |
669 return new LocationSummary(kNumInputs, kNumTemps); | 669 return new LocationSummary(kNumInputs, kNumTemps); |
670 } | 670 } |
671 | 671 |
672 | 672 |
673 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 673 void ReThrowInstr::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
674 ASSERT(exception()->IsUse()); | 674 ASSERT(exception()->IsUse()); |
675 ASSERT(stack_trace()->IsUse()); | 675 ASSERT(stack_trace()->IsUse()); |
676 compiler->GenerateCallRuntime(cid(), | 676 compiler->GenerateCallRuntime(cid(), |
677 token_index(), | 677 token_index(), |
678 try_index(), | 678 try_index(), |
679 kReThrowRuntimeEntry); | 679 kReThrowRuntimeEntry); |
680 __ int3(); | 680 __ int3(); |
681 } | 681 } |
682 | 682 |
683 | 683 |
684 LocationSummary* BranchInstr::MakeLocationSummary() const { | 684 LocationSummary* BranchInstr::MakeLocationSummary() const { |
685 const int kNumInputs = 1; | 685 const int kNumInputs = 1; |
686 const int kNumTemps = 0; | 686 const int kNumTemps = 0; |
687 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 687 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); |
688 locs->set_in(0, Location::RequiresRegister()); | 688 locs->set_in(0, Location::RequiresRegister()); |
689 return locs; | 689 return locs; |
690 } | 690 } |
691 | 691 |
692 | 692 |
693 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 693 void BranchInstr::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
694 Register value = locs()->in(0).reg(); | 694 Register value = locs()->in(0).reg(); |
695 __ CompareObject(value, Bool::ZoneHandle(Bool::True())); | 695 __ CompareObject(value, Bool::ZoneHandle(Bool::True())); |
696 if (compiler->IsNextBlock(false_successor())) { | 696 if (compiler->IsNextBlock(false_successor())) { |
697 // If the next block is the false successor we will fall through to it if | 697 // If the next block is the false successor we will fall through to it if |
698 // comparison with true fails. | 698 // comparison with true fails. |
699 __ j(EQUAL, compiler->GetBlockLabel(true_successor())); | 699 __ j(EQUAL, compiler->GetBlockLabel(true_successor())); |
700 } else { | 700 } else { |
701 ASSERT(compiler->IsNextBlock(true_successor())); | 701 ASSERT(compiler->IsNextBlock(true_successor())); |
702 // If the next block is the true successor we negate comparison and fall | 702 // If the next block is the true successor we negate comparison and fall |
703 // through to it. | 703 // through to it. |
704 __ j(NOT_EQUAL, compiler->GetBlockLabel(false_successor())); | 704 __ j(NOT_EQUAL, compiler->GetBlockLabel(false_successor())); |
705 } | 705 } |
706 } | 706 } |
707 | 707 |
708 | 708 |
709 LocationSummary* CurrentContextComp::MakeLocationSummary() const { | 709 LocationSummary* CurrentContextComp::MakeLocationSummary() const { |
710 return LocationSummary::Make(0, Location::RequiresRegister()); | 710 return LocationSummary::Make(0, Location::RequiresRegister()); |
711 } | 711 } |
712 | 712 |
713 | 713 |
714 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 714 void CurrentContextComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
715 __ MoveRegister(locs()->out().reg(), CTX); | 715 __ MoveRegister(locs()->out().reg(), CTX); |
716 } | 716 } |
717 | 717 |
718 | 718 |
719 LocationSummary* StoreContextComp::MakeLocationSummary() const { | 719 LocationSummary* StoreContextComp::MakeLocationSummary() const { |
720 const intptr_t kNumInputs = 1; | 720 const intptr_t kNumInputs = 1; |
721 const intptr_t kNumTemps = 0; | 721 const intptr_t kNumTemps = 0; |
722 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); | 722 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); |
723 summary->set_in(0, Location::RegisterLocation(CTX)); | 723 summary->set_in(0, Location::RegisterLocation(CTX)); |
724 return summary; | 724 return summary; |
725 } | 725 } |
726 | 726 |
727 | 727 |
728 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 728 void StoreContextComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
729 // Nothing to do. Context register were loaded by register allocator. | 729 // Nothing to do. Context register were loaded by register allocator. |
730 ASSERT(locs()->in(0).reg() == CTX); | 730 ASSERT(locs()->in(0).reg() == CTX); |
731 } | 731 } |
732 | 732 |
733 | 733 |
734 LocationSummary* StrictCompareComp::MakeLocationSummary() const { | 734 LocationSummary* StrictCompareComp::MakeLocationSummary() const { |
735 return LocationSummary::Make(2, Location::SameAsFirstInput()); | 735 return LocationSummary::Make(2, Location::SameAsFirstInput()); |
736 } | 736 } |
737 | 737 |
738 | 738 |
739 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 739 void StrictCompareComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
740 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 740 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
741 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 741 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
742 | 742 |
743 Register left = locs()->in(0).reg(); | 743 Register left = locs()->in(0).reg(); |
744 Register right = locs()->in(1).reg(); | 744 Register right = locs()->in(1).reg(); |
745 Register result = locs()->out().reg(); | 745 Register result = locs()->out().reg(); |
746 | 746 |
747 __ CompareRegisters(left, right); | 747 __ CompareRegisters(left, right); |
748 Label load_true, done; | 748 Label load_true, done; |
749 if (kind() == Token::kEQ_STRICT) { | 749 if (kind() == Token::kEQ_STRICT) { |
750 __ j(EQUAL, &load_true, Assembler::kNearJump); | 750 __ j(EQUAL, &load_true, Assembler::kNearJump); |
751 } else { | 751 } else { |
752 ASSERT(kind() == Token::kNE_STRICT); | 752 ASSERT(kind() == Token::kNE_STRICT); |
753 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); | 753 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); |
754 } | 754 } |
755 __ LoadObject(result, bool_false); | 755 __ LoadObject(result, bool_false); |
756 __ jmp(&done, Assembler::kNearJump); | 756 __ jmp(&done, Assembler::kNearJump); |
757 __ Bind(&load_true); | 757 __ Bind(&load_true); |
758 __ LoadObject(result, bool_true); | 758 __ LoadObject(result, bool_true); |
759 __ Bind(&done); | 759 __ Bind(&done); |
760 } | 760 } |
761 | 761 |
762 | 762 |
763 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 763 void ClosureCallComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
764 ASSERT(VerifyCallComputation(this)); | 764 ASSERT(VerifyCallComputation(this)); |
765 // The arguments to the stub include the closure. The arguments | 765 // The arguments to the stub include the closure. The arguments |
766 // descriptor describes the closure's arguments (and so does not include | 766 // descriptor describes the closure's arguments (and so does not include |
767 // the closure). | 767 // the closure). |
768 Register temp_reg = locs()->temp(0).reg(); | 768 Register temp_reg = locs()->temp(0).reg(); |
769 int argument_count = ArgumentCount(); | 769 int argument_count = ArgumentCount(); |
770 const Array& arguments_descriptor = | 770 const Array& arguments_descriptor = |
771 CodeGenerator::ArgumentsDescriptor(argument_count - 1, | 771 CodeGenerator::ArgumentsDescriptor(argument_count - 1, |
772 argument_names()); | 772 argument_names()); |
773 __ LoadObject(temp_reg, arguments_descriptor); | 773 __ LoadObject(temp_reg, arguments_descriptor); |
774 | 774 |
775 compiler->GenerateCall(token_index(), | 775 compiler->GenerateCall(token_index(), |
776 try_index(), | 776 try_index(), |
777 &StubCode::CallClosureFunctionLabel(), | 777 &StubCode::CallClosureFunctionLabel(), |
778 PcDescriptors::kOther); | 778 PcDescriptors::kOther); |
779 __ Drop(argument_count); | 779 __ Drop(argument_count); |
780 } | 780 } |
781 | 781 |
782 | 782 |
783 LocationSummary* InstanceCallComp::MakeLocationSummary() const { | 783 LocationSummary* InstanceCallComp::MakeLocationSummary() const { |
784 return MakeCallSummary(); | 784 return MakeCallSummary(); |
785 } | 785 } |
786 | 786 |
787 | 787 |
788 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 788 void InstanceCallComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
789 ASSERT(VerifyCallComputation(this)); | 789 ASSERT(VerifyCallComputation(this)); |
790 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 790 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
791 cid(), | 791 cid(), |
792 token_index(), | 792 token_index(), |
793 try_index()); | 793 try_index()); |
794 compiler->GenerateInstanceCall(cid(), | 794 compiler->GenerateInstanceCall(cid(), |
795 token_index(), | 795 token_index(), |
796 try_index(), | 796 try_index(), |
797 function_name(), | 797 function_name(), |
798 ArgumentCount(), | 798 ArgumentCount(), |
799 argument_names(), | 799 argument_names(), |
800 checked_argument_count()); | 800 checked_argument_count()); |
801 } | 801 } |
802 | 802 |
803 | 803 |
804 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 804 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
805 return MakeCallSummary(); | 805 return MakeCallSummary(); |
806 } | 806 } |
807 | 807 |
808 | 808 |
809 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 809 void StaticCallComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
810 ASSERT(VerifyCallComputation(this)); | 810 ASSERT(VerifyCallComputation(this)); |
811 compiler->GenerateStaticCall(cid(), | 811 compiler->GenerateStaticCall(cid(), |
812 token_index(), | 812 token_index(), |
813 try_index(), | 813 try_index(), |
814 function(), | 814 function(), |
815 ArgumentCount(), | 815 ArgumentCount(), |
816 argument_names()); | 816 argument_names()); |
817 } | 817 } |
818 | 818 |
819 | 819 |
820 LocationSummary* UseVal::MakeLocationSummary() const { | 820 LocationSummary* UseVal::MakeLocationSummary() const { |
821 return NULL; | 821 return NULL; |
822 } | 822 } |
823 | 823 |
824 | 824 |
825 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { | 825 void UseVal::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
826 UNIMPLEMENTED(); | 826 UNIMPLEMENTED(); |
827 } | 827 } |
828 | 828 |
829 | 829 |
830 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 830 void AssertAssignableComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
831 compiler->GenerateAssertAssignable(cid(), | 831 compiler->GenerateAssertAssignable(cid(), |
832 token_index(), | 832 token_index(), |
833 try_index(), | 833 try_index(), |
834 dst_type(), | 834 dst_type(), |
835 dst_name()); | 835 dst_name()); |
836 ASSERT(locs()->in(0).reg() == locs()->out().reg()); | 836 ASSERT(locs()->in(0).reg() == locs()->out().reg()); |
837 } | 837 } |
838 | 838 |
839 | 839 |
840 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { | 840 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { |
841 return LocationSummary::Make(1, Location::SameAsFirstInput()); | 841 return LocationSummary::Make(1, Location::SameAsFirstInput()); |
842 } | 842 } |
843 | 843 |
844 | 844 |
845 LocationSummary* StoreInstanceFieldComp::MakeLocationSummary() const { | 845 LocationSummary* StoreInstanceFieldComp::MakeLocationSummary() const { |
846 return LocationSummary::Make(2, Location::RequiresRegister()); | 846 return LocationSummary::Make(2, Location::RequiresRegister()); |
847 } | 847 } |
848 | 848 |
849 | 849 |
850 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 850 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
851 ASSERT(VerifyValues(instance(), value())); | 851 ASSERT(VerifyValues(instance(), value())); |
852 Register instance = locs()->in(0).reg(); | 852 Register instance = locs()->in(0).reg(); |
853 Register value = locs()->in(1).reg(); | 853 Register value = locs()->in(1).reg(); |
854 Register result = locs()->out().reg(); | 854 Register result = locs()->out().reg(); |
855 | 855 |
856 __ StoreIntoObject(instance, FieldAddress(instance, field().Offset()), | 856 __ StoreIntoObject(instance, FieldAddress(instance, field().Offset()), |
857 value); | 857 value); |
858 // TODO(fschneider): Consider eliminating this move by specifying a | 858 // TODO(fschneider): Consider eliminating this move by specifying a |
859 // SameAsSecondInput for the result. | 859 // SameAsSecondInput for the result. |
860 __ MoveRegister(result, value); | 860 __ MoveRegister(result, value); |
861 } | 861 } |
862 | 862 |
863 | 863 |
864 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 864 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
865 LocationSummary* locs = new LocationSummary(1, 1); | 865 LocationSummary* locs = new LocationSummary(1, 1); |
866 locs->set_in(0, Location::RequiresRegister()); | 866 locs->set_in(0, Location::RequiresRegister()); |
867 locs->set_temp(0, Location::RequiresRegister()); | 867 locs->set_temp(0, Location::RequiresRegister()); |
868 locs->set_out(Location::SameAsFirstInput()); | 868 locs->set_out(Location::SameAsFirstInput()); |
869 return locs; | 869 return locs; |
870 } | 870 } |
871 | 871 |
872 | 872 |
873 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 873 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
874 Register value = locs()->in(0).reg(); | 874 Register value = locs()->in(0).reg(); |
875 Register temp = locs()->temp(0).reg(); | 875 Register temp = locs()->temp(0).reg(); |
876 ASSERT(locs()->out().reg() == value); | 876 ASSERT(locs()->out().reg() == value); |
877 | 877 |
878 __ LoadObject(temp, field()); | 878 __ LoadObject(temp, field()); |
879 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); | 879 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); |
880 } | 880 } |
881 | 881 |
882 | 882 |
883 LocationSummary* BooleanNegateComp::MakeLocationSummary() const { | 883 LocationSummary* BooleanNegateComp::MakeLocationSummary() const { |
884 return LocationSummary::Make(1, Location::RequiresRegister()); | 884 return LocationSummary::Make(1, Location::RequiresRegister()); |
885 } | 885 } |
886 | 886 |
887 | 887 |
888 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 888 void BooleanNegateComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
889 Register value = locs()->in(0).reg(); | 889 Register value = locs()->in(0).reg(); |
890 Register result = locs()->out().reg(); | 890 Register result = locs()->out().reg(); |
891 | 891 |
892 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 892 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
893 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 893 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
894 Label done; | 894 Label done; |
895 __ LoadObject(result, bool_true); | 895 __ LoadObject(result, bool_true); |
896 __ CompareRegisters(result, value); | 896 __ CompareRegisters(result, value); |
897 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 897 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
898 __ LoadObject(result, bool_false); | 898 __ LoadObject(result, bool_false); |
899 __ Bind(&done); | 899 __ Bind(&done); |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 LocationSummary* ChainContextComp::MakeLocationSummary() const { | 903 LocationSummary* ChainContextComp::MakeLocationSummary() const { |
904 return LocationSummary::Make(1, Location::NoLocation()); | 904 return LocationSummary::Make(1, Location::NoLocation()); |
905 } | 905 } |
906 | 906 |
907 | 907 |
908 void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 908 void ChainContextComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
909 Register context_value = locs()->in(0).reg(); | 909 Register context_value = locs()->in(0).reg(); |
910 | 910 |
911 // Chain the new context in context_value to its parent in CTX. | 911 // Chain the new context in context_value to its parent in CTX. |
912 __ StoreIntoObject(context_value, | 912 __ StoreIntoObject(context_value, |
913 FieldAddress(context_value, Context::parent_offset()), | 913 FieldAddress(context_value, Context::parent_offset()), |
914 CTX); | 914 CTX); |
915 // Set new context as current context. | 915 // Set new context as current context. |
916 __ MoveRegister(CTX, context_value); | 916 __ MoveRegister(CTX, context_value); |
917 } | 917 } |
918 | 918 |
919 | 919 |
920 LocationSummary* StoreVMFieldComp::MakeLocationSummary() const { | 920 LocationSummary* StoreVMFieldComp::MakeLocationSummary() const { |
921 return LocationSummary::Make(2, Location::SameAsFirstInput()); | 921 return LocationSummary::Make(2, Location::SameAsFirstInput()); |
922 } | 922 } |
923 | 923 |
924 | 924 |
925 void StoreVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 925 void StoreVMFieldComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
926 Register value_reg = locs()->in(0).reg(); | 926 Register value_reg = locs()->in(0).reg(); |
927 Register dest_reg = locs()->in(1).reg(); | 927 Register dest_reg = locs()->in(1).reg(); |
928 ASSERT(value_reg == locs()->out().reg()); | 928 ASSERT(value_reg == locs()->out().reg()); |
929 | 929 |
930 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()), | 930 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()), |
931 value_reg); | 931 value_reg); |
932 } | 932 } |
933 | 933 |
934 | 934 |
935 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { | 935 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { |
936 return MakeCallSummary(); | 936 return MakeCallSummary(); |
937 } | 937 } |
938 | 938 |
939 | 939 |
940 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 940 void AllocateObjectComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
941 const Class& cls = Class::ZoneHandle(constructor().owner()); | 941 const Class& cls = Class::ZoneHandle(constructor().owner()); |
942 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); | 942 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); |
943 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); | 943 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); |
944 compiler->GenerateCall(token_index(), | 944 compiler->GenerateCall(token_index(), |
945 try_index(), | 945 try_index(), |
946 &label, | 946 &label, |
947 PcDescriptors::kOther); | 947 PcDescriptors::kOther); |
948 __ Drop(arguments().length()); // Discard arguments. | 948 __ Drop(arguments().length()); // Discard arguments. |
949 } | 949 } |
950 | 950 |
951 | 951 |
952 LocationSummary* CreateClosureComp::MakeLocationSummary() const { | 952 LocationSummary* CreateClosureComp::MakeLocationSummary() const { |
953 return MakeCallSummary(); | 953 return MakeCallSummary(); |
954 } | 954 } |
955 | 955 |
956 | 956 |
957 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 957 void CreateClosureComp::EmitNativeCode(FlowGraphCompilerShared* compiler) { |
958 const Function& closure_function = function(); | 958 const Function& closure_function = function(); |
959 const Code& stub = Code::Handle( | 959 const Code& stub = Code::Handle( |
960 StubCode::GetAllocationStubForClosure(closure_function)); | 960 StubCode::GetAllocationStubForClosure(closure_function)); |
961 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 961 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
962 compiler->GenerateCall(token_index(), try_index(), &label, | 962 compiler->GenerateCall(token_index(), try_index(), &label, |
963 PcDescriptors::kOther); | 963 PcDescriptors::kOther); |
964 __ Drop(2); // Discard type arguments and receiver. | 964 __ Drop(2); // Discard type arguments and receiver. |
965 } | 965 } |
966 | 966 |
967 #undef __ | 967 #undef __ |
968 | 968 |
969 } // namespace dart | 969 } // namespace dart |
OLD | NEW |