OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 StrictModeFlag strict_mode); | 123 StrictModeFlag strict_mode); |
124 | 124 |
125 // Computes the right stub matching. Inserts the result in the | 125 // Computes the right stub matching. Inserts the result in the |
126 // cache before returning. This might compile a stub if needed. | 126 // cache before returning. This might compile a stub if needed. |
127 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, | 127 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, |
128 Handle<JSObject> object); | 128 Handle<JSObject> object); |
129 | 129 |
130 Handle<Code> ComputeLoadField(Handle<Name> name, | 130 Handle<Code> ComputeLoadField(Handle<Name> name, |
131 Handle<JSObject> object, | 131 Handle<JSObject> object, |
132 Handle<JSObject> holder, | 132 Handle<JSObject> holder, |
133 Code::Kind kind, | |
134 PropertyIndex field_index, | 133 PropertyIndex field_index, |
135 Representation representation); | 134 Representation representation); |
136 | 135 |
137 Handle<Code> ComputeLoadCallback(Handle<Name> name, | 136 Handle<Code> ComputeLoadCallback(Handle<Name> name, |
138 Handle<JSObject> object, | 137 Handle<JSObject> object, |
139 Handle<JSObject> holder, | 138 Handle<JSObject> holder, |
140 Code::Kind kind, | |
141 Handle<ExecutableAccessorInfo> callback); | 139 Handle<ExecutableAccessorInfo> callback); |
142 | 140 |
143 Handle<Code> ComputeLoadCallback(Handle<Name> name, | 141 Handle<Code> ComputeLoadCallback(Handle<Name> name, |
144 Handle<JSObject> object, | 142 Handle<JSObject> object, |
145 Handle<JSObject> holder, | 143 Handle<JSObject> holder, |
146 Code::Kind kind, | |
147 const CallOptimization& call_optimization); | 144 const CallOptimization& call_optimization); |
148 | 145 |
149 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, | 146 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, |
150 Handle<JSObject> object, | 147 Handle<JSObject> object, |
151 Handle<JSObject> holder, | 148 Handle<JSObject> holder, |
152 Handle<JSFunction> getter); | 149 Handle<JSFunction> getter); |
153 | 150 |
154 Handle<Code> ComputeLoadConstant(Handle<Name> name, | 151 Handle<Code> ComputeLoadConstant(Handle<Name> name, |
155 Handle<JSObject> object, | 152 Handle<JSObject> object, |
156 Handle<JSObject> holder, | 153 Handle<JSObject> holder, |
157 Code::Kind kind, | |
158 Handle<Object> value); | 154 Handle<Object> value); |
159 | 155 |
160 Handle<Code> ComputeLoadInterceptor(Handle<Name> name, | 156 Handle<Code> ComputeLoadInterceptor(Handle<Name> name, |
161 Handle<JSObject> object, | 157 Handle<JSObject> object, |
162 Handle<JSObject> holder, | 158 Handle<JSObject> holder); |
163 Code::Kind kind); | |
164 | 159 |
165 Handle<Code> ComputeLoadNormal(Handle<Name> name, | 160 Handle<Code> ComputeLoadNormal(Handle<Name> name, |
166 Handle<JSObject> object); | 161 Handle<JSObject> object); |
167 | 162 |
168 Handle<Code> ComputeLoadGlobal(Handle<Name> name, | 163 Handle<Code> ComputeLoadGlobal(Handle<Name> name, |
169 Handle<JSObject> object, | 164 Handle<JSObject> object, |
170 Handle<GlobalObject> holder, | 165 Handle<GlobalObject> holder, |
171 Handle<PropertyCell> cell, | 166 Handle<PropertyCell> cell, |
172 bool is_dont_delete); | 167 bool is_dont_delete); |
173 | 168 |
174 // --- | 169 // --- |
175 | 170 |
| 171 Handle<Code> ComputeKeyedLoadField(Handle<Name> name, |
| 172 Handle<JSObject> object, |
| 173 Handle<JSObject> holder, |
| 174 PropertyIndex field_index, |
| 175 Representation representation); |
| 176 |
| 177 Handle<Code> ComputeKeyedLoadCallback( |
| 178 Handle<Name> name, |
| 179 Handle<JSObject> object, |
| 180 Handle<JSObject> holder, |
| 181 Handle<ExecutableAccessorInfo> callback); |
| 182 |
| 183 Handle<Code> ComputeKeyedLoadCallback( |
| 184 Handle<Name> name, |
| 185 Handle<JSObject> object, |
| 186 Handle<JSObject> holder, |
| 187 const CallOptimization& call_optimization); |
| 188 |
| 189 Handle<Code> ComputeKeyedLoadConstant(Handle<Name> name, |
| 190 Handle<JSObject> object, |
| 191 Handle<JSObject> holder, |
| 192 Handle<Object> value); |
| 193 |
| 194 Handle<Code> ComputeKeyedLoadInterceptor(Handle<Name> name, |
| 195 Handle<JSObject> object, |
| 196 Handle<JSObject> holder); |
| 197 |
| 198 // --- |
| 199 |
176 Handle<Code> ComputeStoreField(Handle<Name> name, | 200 Handle<Code> ComputeStoreField(Handle<Name> name, |
177 Handle<JSObject> object, | 201 Handle<JSObject> object, |
178 LookupResult* lookup, | 202 LookupResult* lookup, |
179 StrictModeFlag strict_mode); | 203 StrictModeFlag strict_mode); |
180 | 204 |
181 Handle<Code> ComputeStoreTransition(Handle<Name> name, | 205 Handle<Code> ComputeStoreTransition(Handle<Name> name, |
182 Handle<JSObject> object, | 206 Handle<JSObject> object, |
183 LookupResult* lookup, | 207 LookupResult* lookup, |
184 Handle<Map> transition, | 208 Handle<Map> transition, |
185 StrictModeFlag strict_mode); | 209 StrictModeFlag strict_mode); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 MacroAssembler masm_; | 635 MacroAssembler masm_; |
612 Failure* failure_; | 636 Failure* failure_; |
613 }; | 637 }; |
614 | 638 |
615 | 639 |
616 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; | 640 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; |
617 | 641 |
618 | 642 |
619 class BaseLoadStoreStubCompiler: public StubCompiler { | 643 class BaseLoadStoreStubCompiler: public StubCompiler { |
620 public: | 644 public: |
621 BaseLoadStoreStubCompiler(Isolate* isolate, | 645 BaseLoadStoreStubCompiler(Isolate* isolate, Register* registers) |
622 Code::Kind kind, | 646 : StubCompiler(isolate), registers_(registers) { } |
623 Register* registers) | |
624 : StubCompiler(isolate), kind_(kind), registers_(registers) { } | |
625 virtual ~BaseLoadStoreStubCompiler() { } | 647 virtual ~BaseLoadStoreStubCompiler() { } |
626 | 648 |
627 Handle<Code> CompileMonomorphicIC(Handle<Map> receiver_map, | 649 Handle<Code> CompileMonomorphicIC(Handle<Map> receiver_map, |
628 Handle<Code> handler, | 650 Handle<Code> handler, |
629 Handle<Name> name); | 651 Handle<Name> name); |
630 | 652 |
631 Handle<Code> CompilePolymorphicIC(MapHandleList* receiver_maps, | 653 Handle<Code> CompilePolymorphicIC(MapHandleList* receiver_maps, |
632 CodeHandleList* handlers, | 654 CodeHandleList* handlers, |
633 Handle<Name> name, | 655 Handle<Name> name, |
634 Code::StubType type, | 656 Code::StubType type, |
635 IcCheckType check); | 657 IcCheckType check); |
636 | 658 |
637 virtual void GenerateNameCheck(Handle<Name> name, | 659 virtual void GenerateNameCheck(Handle<Name> name, |
638 Register name_reg, | 660 Register name_reg, |
639 Label* miss) { } | 661 Label* miss) { } |
640 | 662 |
641 static Builtins::Name MissBuiltin(Code::Kind kind) { | 663 static Builtins::Name MissBuiltin(Code::Kind kind) { |
642 switch (kind) { | 664 switch (kind) { |
643 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; | 665 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
644 case Code::STORE_IC: return Builtins::kStoreIC_Miss; | 666 case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
645 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; | 667 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
646 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; | 668 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
647 default: UNREACHABLE(); | 669 default: UNREACHABLE(); |
648 } | 670 } |
649 return Builtins::kLoadIC_Miss; | 671 return Builtins::kLoadIC_Miss; |
650 } | 672 } |
651 | 673 |
652 static GDBJITInterface::CodeTag GetGDBJITCodeTag(Code::Kind kind) { | |
653 switch (kind) { | |
654 case Code::LOAD_IC: return GDBJITInterface::LOAD_IC; | |
655 case Code::STORE_IC: return GDBJITInterface::STORE_IC; | |
656 case Code::KEYED_LOAD_IC: return GDBJITInterface::KEYED_LOAD_IC; | |
657 case Code::KEYED_STORE_IC: return GDBJITInterface::KEYED_STORE_IC; | |
658 default: UNREACHABLE(); | |
659 } | |
660 return static_cast<GDBJITInterface::CodeTag>(0); | |
661 } | |
662 | |
663 protected: | 674 protected: |
664 virtual Register HandlerFrontendHeader(Handle<JSObject> object, | 675 virtual Register HandlerFrontendHeader(Handle<JSObject> object, |
665 Register object_reg, | 676 Register object_reg, |
666 Handle<JSObject> holder, | 677 Handle<JSObject> holder, |
667 Handle<Name> name, | 678 Handle<Name> name, |
668 Label* miss) = 0; | 679 Label* miss) = 0; |
669 | 680 |
670 virtual void HandlerFrontendFooter(Handle<Name> name, | 681 virtual void HandlerFrontendFooter(Handle<Name> name, |
671 Label* success, | 682 Label* success, |
672 Label* miss) = 0; | 683 Label* miss) = 0; |
673 | 684 |
674 Register HandlerFrontend(Handle<JSObject> object, | 685 Register HandlerFrontend(Handle<JSObject> object, |
675 Register object_reg, | 686 Register object_reg, |
676 Handle<JSObject> holder, | 687 Handle<JSObject> holder, |
677 Handle<Name> name, | 688 Handle<Name> name, |
678 Label* success); | 689 Label* success); |
679 | 690 |
680 Handle<Code> GetICCode(Code::Kind kind, | 691 Handle<Code> GetICCode(Code::Kind kind, |
681 Code::StubType type, | 692 Code::StubType type, |
682 Handle<Name> name, | 693 Handle<Name> name, |
683 InlineCacheState state = MONOMORPHIC); | 694 InlineCacheState state = MONOMORPHIC); |
684 | 695 |
685 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | |
686 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | |
687 switch (kind()) { | |
688 case Code::LOAD_IC: return code->ic_state() == MONOMORPHIC | |
689 ? Logger::LOAD_IC_TAG : Logger::LOAD_POLYMORPHIC_IC_TAG; | |
690 case Code::STORE_IC: return code->ic_state() == MONOMORPHIC | |
691 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | |
692 case Code::KEYED_LOAD_IC: return code->ic_state() == MONOMORPHIC | |
693 ? Logger::KEYED_LOAD_IC_TAG : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; | |
694 case Code::KEYED_STORE_IC: return code->ic_state() == MONOMORPHIC | |
695 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | |
696 default: UNREACHABLE(); | |
697 } | |
698 return static_cast<Logger::LogEventsAndTags>(0); | |
699 } | |
700 | |
701 void JitEvent(Handle<Name> name, Handle<Code> code) { | |
702 GDBJIT(AddCode(GetGDBJITCodeTag(kind()), *name, *code)); | |
703 } | |
704 | |
705 Code::Kind kind() const { return kind_; } | |
706 | |
707 virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } | 696 virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } |
| 697 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) = 0; |
| 698 virtual void JitEvent(Handle<Name> name, Handle<Code> code) = 0; |
| 699 virtual Code::Kind kind() = 0; |
708 virtual Register receiver() = 0; | 700 virtual Register receiver() = 0; |
709 virtual Register name() = 0; | 701 virtual Register name() = 0; |
710 virtual Register scratch1() = 0; | 702 virtual Register scratch1() = 0; |
711 virtual Register scratch2() = 0; | 703 virtual Register scratch2() = 0; |
712 virtual Register scratch3() = 0; | 704 virtual Register scratch3() = 0; |
713 | 705 |
714 static Register* GetRegisters(Code::Kind kind); | |
715 | |
716 Code::Kind kind_; | |
717 Register* registers_; | 706 Register* registers_; |
718 }; | 707 }; |
719 | 708 |
720 | 709 |
721 class BaseLoadStubCompiler: public BaseLoadStoreStubCompiler { | 710 class BaseLoadStubCompiler: public BaseLoadStoreStubCompiler { |
722 public: | 711 public: |
723 BaseLoadStubCompiler(Isolate* isolate, Code::Kind kind) | 712 BaseLoadStubCompiler(Isolate* isolate, Register* registers) |
724 : BaseLoadStoreStubCompiler(isolate, kind, GetRegisters(kind)) { } | 713 : BaseLoadStoreStubCompiler(isolate, registers) { } |
725 BaseLoadStubCompiler(Isolate* isolate, Code::Kind kind, Register* registers) | |
726 : BaseLoadStoreStubCompiler(isolate, kind, registers) { } | |
727 virtual ~BaseLoadStubCompiler() { } | 714 virtual ~BaseLoadStubCompiler() { } |
728 | 715 |
729 Handle<Code> CompileLoadField(Handle<JSObject> object, | 716 Handle<Code> CompileLoadField(Handle<JSObject> object, |
730 Handle<JSObject> holder, | 717 Handle<JSObject> holder, |
731 Handle<Name> name, | 718 Handle<Name> name, |
732 PropertyIndex index, | 719 PropertyIndex index, |
733 Representation representation); | 720 Representation representation); |
734 | 721 |
735 Handle<Code> CompileLoadCallback(Handle<JSObject> object, | 722 Handle<Code> CompileLoadCallback(Handle<JSObject> object, |
736 Handle<JSObject> holder, | 723 Handle<JSObject> holder, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 virtual Register scratch1() { return registers_[2]; } | 788 virtual Register scratch1() { return registers_[2]; } |
802 virtual Register scratch2() { return registers_[3]; } | 789 virtual Register scratch2() { return registers_[3]; } |
803 virtual Register scratch3() { return registers_[4]; } | 790 virtual Register scratch3() { return registers_[4]; } |
804 Register scratch4() { return registers_[5]; } | 791 Register scratch4() { return registers_[5]; } |
805 }; | 792 }; |
806 | 793 |
807 | 794 |
808 class LoadStubCompiler: public BaseLoadStubCompiler { | 795 class LoadStubCompiler: public BaseLoadStubCompiler { |
809 public: | 796 public: |
810 explicit LoadStubCompiler(Isolate* isolate) | 797 explicit LoadStubCompiler(Isolate* isolate) |
811 : BaseLoadStubCompiler(isolate, Code::LOAD_IC, registers()) { } | 798 : BaseLoadStubCompiler(isolate, registers()) { } |
812 | 799 |
813 Handle<Code> CompileLoadNonexistent(Handle<JSObject> object, | 800 Handle<Code> CompileLoadNonexistent(Handle<JSObject> object, |
814 Handle<JSObject> last, | 801 Handle<JSObject> last, |
815 Handle<Name> name, | 802 Handle<Name> name, |
816 Handle<GlobalObject> global); | 803 Handle<GlobalObject> global); |
817 | 804 |
818 static void GenerateLoadViaGetter(MacroAssembler* masm, | 805 static void GenerateLoadViaGetter(MacroAssembler* masm, |
819 Handle<JSFunction> getter); | 806 Handle<JSFunction> getter); |
820 | 807 |
821 Handle<Code> CompileLoadViaGetter(Handle<JSObject> object, | 808 Handle<Code> CompileLoadViaGetter(Handle<JSObject> object, |
822 Handle<JSObject> holder, | 809 Handle<JSObject> holder, |
823 Handle<Name> name, | 810 Handle<Name> name, |
824 Handle<JSFunction> getter); | 811 Handle<JSFunction> getter); |
825 | 812 |
826 Handle<Code> CompileLoadGlobal(Handle<JSObject> object, | 813 Handle<Code> CompileLoadGlobal(Handle<JSObject> object, |
827 Handle<GlobalObject> holder, | 814 Handle<GlobalObject> holder, |
828 Handle<PropertyCell> cell, | 815 Handle<PropertyCell> cell, |
829 Handle<Name> name, | 816 Handle<Name> name, |
830 bool is_dont_delete); | 817 bool is_dont_delete); |
831 | 818 |
| 819 private: |
832 static Register* registers(); | 820 static Register* registers(); |
| 821 virtual Code::Kind kind() { return Code::LOAD_IC; } |
| 822 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 823 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; |
| 824 return code->ic_state() == MONOMORPHIC |
| 825 ? Logger::LOAD_IC_TAG : Logger::LOAD_POLYMORPHIC_IC_TAG; |
| 826 } |
| 827 virtual void JitEvent(Handle<Name> name, Handle<Code> code); |
833 }; | 828 }; |
834 | 829 |
835 | 830 |
836 class KeyedLoadStubCompiler: public BaseLoadStubCompiler { | 831 class KeyedLoadStubCompiler: public BaseLoadStubCompiler { |
837 public: | 832 public: |
838 explicit KeyedLoadStubCompiler(Isolate* isolate) | 833 explicit KeyedLoadStubCompiler(Isolate* isolate) |
839 : BaseLoadStubCompiler(isolate, Code::KEYED_LOAD_IC, registers()) { } | 834 : BaseLoadStubCompiler(isolate, registers()) { } |
840 | 835 |
841 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); | 836 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); |
842 | 837 |
843 void CompileElementHandlers(MapHandleList* receiver_maps, | 838 void CompileElementHandlers(MapHandleList* receiver_maps, |
844 CodeHandleList* handlers); | 839 CodeHandleList* handlers); |
845 | 840 |
846 static void GenerateLoadDictionaryElement(MacroAssembler* masm); | 841 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
847 | 842 |
| 843 private: |
848 static Register* registers(); | 844 static Register* registers(); |
849 | 845 virtual Code::Kind kind() { return Code::KEYED_LOAD_IC; } |
850 private: | 846 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 847 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; |
| 848 return code->ic_state() == MONOMORPHIC |
| 849 ? Logger::KEYED_LOAD_IC_TAG : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; |
| 850 } |
| 851 virtual void JitEvent(Handle<Name> name, Handle<Code> code); |
851 virtual void GenerateNameCheck(Handle<Name> name, | 852 virtual void GenerateNameCheck(Handle<Name> name, |
852 Register name_reg, | 853 Register name_reg, |
853 Label* miss); | 854 Label* miss); |
854 }; | 855 }; |
855 | 856 |
856 | 857 |
857 class BaseStoreStubCompiler: public BaseLoadStoreStubCompiler { | 858 class BaseStoreStubCompiler: public BaseLoadStoreStubCompiler { |
858 public: | 859 public: |
859 BaseStoreStubCompiler(Isolate* isolate, | 860 BaseStoreStubCompiler(Isolate* isolate, |
860 Code::Kind kind, | 861 StrictModeFlag strict_mode, |
861 StrictModeFlag strict_mode) | 862 Register* registers) |
862 : BaseLoadStoreStubCompiler(isolate, kind, GetRegisters(kind)), | 863 : BaseLoadStoreStubCompiler(isolate, registers), |
863 strict_mode_(strict_mode) { } | 864 strict_mode_(strict_mode) { } |
864 | 865 |
865 virtual ~BaseStoreStubCompiler() { } | 866 virtual ~BaseStoreStubCompiler() { } |
866 | 867 |
867 Handle<Code> CompileStoreTransition(Handle<JSObject> object, | 868 Handle<Code> CompileStoreTransition(Handle<JSObject> object, |
868 LookupResult* lookup, | 869 LookupResult* lookup, |
869 Handle<Map> transition, | 870 Handle<Map> transition, |
870 Handle<Name> name); | 871 Handle<Name> name); |
871 | 872 |
872 Handle<Code> CompileStoreField(Handle<JSObject> object, | 873 Handle<Code> CompileStoreField(Handle<JSObject> object, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 virtual Code::ExtraICState extra_state() { return strict_mode_; } | 951 virtual Code::ExtraICState extra_state() { return strict_mode_; } |
951 | 952 |
952 private: | 953 private: |
953 StrictModeFlag strict_mode_; | 954 StrictModeFlag strict_mode_; |
954 }; | 955 }; |
955 | 956 |
956 | 957 |
957 class StoreStubCompiler: public BaseStoreStubCompiler { | 958 class StoreStubCompiler: public BaseStoreStubCompiler { |
958 public: | 959 public: |
959 StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode) | 960 StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode) |
960 : BaseStoreStubCompiler(isolate, Code::STORE_IC, strict_mode) { } | 961 : BaseStoreStubCompiler(isolate, strict_mode, registers()) { } |
961 | 962 |
962 | 963 |
963 Handle<Code> CompileStoreCallback(Handle<JSObject> object, | 964 Handle<Code> CompileStoreCallback(Handle<JSObject> object, |
964 Handle<JSObject> holder, | 965 Handle<JSObject> holder, |
965 Handle<Name> name, | 966 Handle<Name> name, |
966 Handle<ExecutableAccessorInfo> callback); | 967 Handle<ExecutableAccessorInfo> callback); |
967 | 968 |
968 Handle<Code> CompileStoreCallback(Handle<JSObject> object, | 969 Handle<Code> CompileStoreCallback(Handle<JSObject> object, |
969 Handle<JSObject> holder, | 970 Handle<JSObject> holder, |
970 Handle<Name> name, | 971 Handle<Name> name, |
971 const CallOptimization& call_optimization); | 972 const CallOptimization& call_optimization); |
972 | 973 |
973 static void GenerateStoreViaSetter(MacroAssembler* masm, | 974 static void GenerateStoreViaSetter(MacroAssembler* masm, |
974 Handle<JSFunction> setter); | 975 Handle<JSFunction> setter); |
975 | 976 |
976 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, | 977 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, |
977 Handle<JSObject> holder, | 978 Handle<JSObject> holder, |
978 Handle<Name> name, | 979 Handle<Name> name, |
979 Handle<JSFunction> setter); | 980 Handle<JSFunction> setter); |
980 | 981 |
981 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, | 982 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, |
982 Handle<Name> name); | 983 Handle<Name> name); |
983 | 984 |
| 985 private: |
984 static Register* registers(); | 986 static Register* registers(); |
| 987 virtual Code::Kind kind() { return Code::STORE_IC; } |
| 988 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 989 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; |
| 990 return code->ic_state() == MONOMORPHIC |
| 991 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; |
| 992 } |
| 993 virtual void JitEvent(Handle<Name> name, Handle<Code> code); |
985 }; | 994 }; |
986 | 995 |
987 | 996 |
988 class KeyedStoreStubCompiler: public BaseStoreStubCompiler { | 997 class KeyedStoreStubCompiler: public BaseStoreStubCompiler { |
989 public: | 998 public: |
990 KeyedStoreStubCompiler(Isolate* isolate, | 999 KeyedStoreStubCompiler(Isolate* isolate, |
991 StrictModeFlag strict_mode, | 1000 StrictModeFlag strict_mode, |
992 KeyedAccessStoreMode store_mode) | 1001 KeyedAccessStoreMode store_mode) |
993 : BaseStoreStubCompiler(isolate, Code::KEYED_STORE_IC, strict_mode), | 1002 : BaseStoreStubCompiler(isolate, strict_mode, registers()), |
994 store_mode_(store_mode) { } | 1003 store_mode_(store_mode) { } |
995 | 1004 |
996 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); | 1005 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); |
997 | 1006 |
998 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, | 1007 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, |
999 CodeHandleList* handler_stubs, | 1008 CodeHandleList* handler_stubs, |
1000 MapHandleList* transitioned_maps); | 1009 MapHandleList* transitioned_maps); |
1001 | 1010 |
1002 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); | 1011 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); |
1003 | 1012 |
1004 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 1013 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
1005 | 1014 |
1006 static Register* registers(); | |
1007 | |
1008 protected: | 1015 protected: |
1009 virtual Code::ExtraICState extra_state() { | 1016 virtual Code::ExtraICState extra_state() { |
1010 return Code::ComputeExtraICState(store_mode_, strict_mode()); | 1017 return Code::ComputeExtraICState(store_mode_, strict_mode()); |
1011 } | 1018 } |
1012 | 1019 |
1013 private: | 1020 private: |
1014 Register transition_map() { | 1021 Register transition_map() { |
1015 return registers()[3]; | 1022 return registers()[3]; |
1016 } | 1023 } |
1017 | 1024 |
| 1025 static Register* registers(); |
| 1026 virtual Code::Kind kind() { return Code::KEYED_STORE_IC; } |
| 1027 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 1028 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; |
| 1029 return code->ic_state() == MONOMORPHIC |
| 1030 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
| 1031 } |
| 1032 virtual void JitEvent(Handle<Name> name, Handle<Code> code); |
1018 virtual void GenerateNameCheck(Handle<Name> name, | 1033 virtual void GenerateNameCheck(Handle<Name> name, |
1019 Register name_reg, | 1034 Register name_reg, |
1020 Label* miss); | 1035 Label* miss); |
1021 KeyedAccessStoreMode store_mode_; | 1036 KeyedAccessStoreMode store_mode_; |
1022 }; | 1037 }; |
1023 | 1038 |
1024 | 1039 |
1025 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 1040 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call |
1026 // IC stubs. | 1041 // IC stubs. |
1027 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 1042 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 Handle<JSFunction> constant_function_; | 1201 Handle<JSFunction> constant_function_; |
1187 bool is_simple_api_call_; | 1202 bool is_simple_api_call_; |
1188 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1203 Handle<FunctionTemplateInfo> expected_receiver_type_; |
1189 Handle<CallHandlerInfo> api_call_info_; | 1204 Handle<CallHandlerInfo> api_call_info_; |
1190 }; | 1205 }; |
1191 | 1206 |
1192 | 1207 |
1193 } } // namespace v8::internal | 1208 } } // namespace v8::internal |
1194 | 1209 |
1195 #endif // V8_STUB_CACHE_H_ | 1210 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |