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, | |
133 PropertyIndex field_index, | 134 PropertyIndex field_index, |
134 Representation representation); | 135 Representation representation); |
135 | 136 |
136 Handle<Code> ComputeLoadCallback(Handle<Name> name, | 137 Handle<Code> ComputeLoadCallback(Handle<Name> name, |
137 Handle<JSObject> object, | 138 Handle<JSObject> object, |
138 Handle<JSObject> holder, | 139 Handle<JSObject> holder, |
140 Code::Kind kind, | |
139 Handle<ExecutableAccessorInfo> callback); | 141 Handle<ExecutableAccessorInfo> callback); |
140 | 142 |
141 Handle<Code> ComputeLoadCallback(Handle<Name> name, | 143 Handle<Code> ComputeLoadCallback(Handle<Name> name, |
142 Handle<JSObject> object, | 144 Handle<JSObject> object, |
143 Handle<JSObject> holder, | 145 Handle<JSObject> holder, |
146 Code::Kind kind, | |
144 const CallOptimization& call_optimization); | 147 const CallOptimization& call_optimization); |
145 | 148 |
146 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, | 149 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, |
147 Handle<JSObject> object, | 150 Handle<JSObject> object, |
148 Handle<JSObject> holder, | 151 Handle<JSObject> holder, |
149 Handle<JSFunction> getter); | 152 Handle<JSFunction> getter); |
150 | 153 |
151 Handle<Code> ComputeLoadConstant(Handle<Name> name, | 154 Handle<Code> ComputeLoadConstant(Handle<Name> name, |
152 Handle<JSObject> object, | 155 Handle<JSObject> object, |
153 Handle<JSObject> holder, | 156 Handle<JSObject> holder, |
157 Code::Kind kind, | |
154 Handle<Object> value); | 158 Handle<Object> value); |
155 | 159 |
156 Handle<Code> ComputeLoadInterceptor(Handle<Name> name, | 160 Handle<Code> ComputeLoadInterceptor(Handle<Name> name, |
157 Handle<JSObject> object, | 161 Handle<JSObject> object, |
158 Handle<JSObject> holder); | 162 Handle<JSObject> holder, |
163 Code::Kind kind); | |
159 | 164 |
160 Handle<Code> ComputeLoadNormal(Handle<Name> name, | 165 Handle<Code> ComputeLoadNormal(Handle<Name> name, |
161 Handle<JSObject> object); | 166 Handle<JSObject> object); |
162 | 167 |
163 Handle<Code> ComputeLoadGlobal(Handle<Name> name, | 168 Handle<Code> ComputeLoadGlobal(Handle<Name> name, |
164 Handle<JSObject> object, | 169 Handle<JSObject> object, |
165 Handle<GlobalObject> holder, | 170 Handle<GlobalObject> holder, |
166 Handle<PropertyCell> cell, | 171 Handle<PropertyCell> cell, |
167 bool is_dont_delete); | 172 bool is_dont_delete); |
168 | 173 |
169 // --- | 174 // --- |
170 | 175 |
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 | |
200 Handle<Code> ComputeStoreField(Handle<Name> name, | 176 Handle<Code> ComputeStoreField(Handle<Name> name, |
201 Handle<JSObject> object, | 177 Handle<JSObject> object, |
202 LookupResult* lookup, | 178 LookupResult* lookup, |
203 StrictModeFlag strict_mode); | 179 StrictModeFlag strict_mode); |
204 | 180 |
205 Handle<Code> ComputeStoreTransition(Handle<Name> name, | 181 Handle<Code> ComputeStoreTransition(Handle<Name> name, |
206 Handle<JSObject> object, | 182 Handle<JSObject> object, |
207 LookupResult* lookup, | 183 LookupResult* lookup, |
208 Handle<Map> transition, | 184 Handle<Map> transition, |
209 StrictModeFlag strict_mode); | 185 StrictModeFlag strict_mode); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 MacroAssembler masm_; | 605 MacroAssembler masm_; |
630 Failure* failure_; | 606 Failure* failure_; |
631 }; | 607 }; |
632 | 608 |
633 | 609 |
634 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; | 610 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; |
635 | 611 |
636 | 612 |
637 class BaseLoadStoreStubCompiler: public StubCompiler { | 613 class BaseLoadStoreStubCompiler: public StubCompiler { |
638 public: | 614 public: |
639 BaseLoadStoreStubCompiler(Isolate* isolate, Register* registers) | 615 BaseLoadStoreStubCompiler(Isolate* isolate, |
640 : StubCompiler(isolate), registers_(registers) { } | 616 Code::Kind kind, |
617 Register* registers) | |
618 : StubCompiler(isolate), kind_(kind), registers_(registers) { } | |
641 virtual ~BaseLoadStoreStubCompiler() { } | 619 virtual ~BaseLoadStoreStubCompiler() { } |
642 | 620 |
643 Handle<Code> CompileMonomorphicIC(Handle<Map> receiver_map, | 621 Handle<Code> CompileMonomorphicIC(Handle<Map> receiver_map, |
644 Handle<Code> handler, | 622 Handle<Code> handler, |
645 Handle<Name> name); | 623 Handle<Name> name); |
646 | 624 |
647 Handle<Code> CompilePolymorphicIC(MapHandleList* receiver_maps, | 625 Handle<Code> CompilePolymorphicIC(MapHandleList* receiver_maps, |
648 CodeHandleList* handlers, | 626 CodeHandleList* handlers, |
649 Handle<Name> name, | 627 Handle<Name> name, |
650 Code::StubType type, | 628 Code::StubType type, |
651 IcCheckType check); | 629 IcCheckType check); |
652 | 630 |
653 virtual void GenerateNameCheck(Handle<Name> name, | 631 virtual void GenerateNameCheck(Handle<Name> name, |
654 Register name_reg, | 632 Register name_reg, |
655 Label* miss) { } | 633 Label* miss) { } |
656 | 634 |
657 static Builtins::Name MissBuiltin(Code::Kind kind) { | 635 static Builtins::Name MissBuiltin(Code::Kind kind) { |
658 switch (kind) { | 636 switch (kind) { |
659 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; | 637 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
660 case Code::STORE_IC: return Builtins::kStoreIC_Miss; | 638 case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
661 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; | 639 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
662 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; | 640 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
663 default: UNREACHABLE(); | 641 default: UNREACHABLE(); |
664 } | 642 } |
665 return Builtins::kLoadIC_Miss; | 643 return Builtins::kLoadIC_Miss; |
666 } | 644 } |
667 | 645 |
646 static GDBJITInterface::CodeTag GetGDBJITCodeTag(Code::Kind kind) { | |
647 switch (kind) { | |
648 case Code::LOAD_IC: return GDBJITInterface::LOAD_IC; | |
649 case Code::STORE_IC: return GDBJITInterface::LOAD_IC; | |
Toon Verwaest
2013/09/07 13:14:46
GDB..::STORE_IC
Michael Starzinger
2013/09/11 15:22:40
Done. Phew, that's nasty. Thanks for catching that
| |
650 case Code::KEYED_LOAD_IC: return GDBJITInterface::KEYED_LOAD_IC; | |
651 case Code::KEYED_STORE_IC: return GDBJITInterface::KEYED_STORE_IC; | |
652 default: UNREACHABLE(); | |
653 } | |
654 return static_cast<GDBJITInterface::CodeTag>(0); | |
655 } | |
656 | |
668 protected: | 657 protected: |
669 virtual Register HandlerFrontendHeader(Handle<JSObject> object, | 658 virtual Register HandlerFrontendHeader(Handle<JSObject> object, |
670 Register object_reg, | 659 Register object_reg, |
671 Handle<JSObject> holder, | 660 Handle<JSObject> holder, |
672 Handle<Name> name, | 661 Handle<Name> name, |
673 Label* miss) = 0; | 662 Label* miss) = 0; |
674 | 663 |
675 virtual void HandlerFrontendFooter(Handle<Name> name, | 664 virtual void HandlerFrontendFooter(Handle<Name> name, |
676 Label* success, | 665 Label* success, |
677 Label* miss) = 0; | 666 Label* miss) = 0; |
678 | 667 |
679 Register HandlerFrontend(Handle<JSObject> object, | 668 Register HandlerFrontend(Handle<JSObject> object, |
680 Register object_reg, | 669 Register object_reg, |
681 Handle<JSObject> holder, | 670 Handle<JSObject> holder, |
682 Handle<Name> name, | 671 Handle<Name> name, |
683 Label* success); | 672 Label* success); |
684 | 673 |
685 Handle<Code> GetICCode(Code::Kind kind, | 674 Handle<Code> GetICCode(Code::Kind kind, |
686 Code::StubType type, | 675 Code::StubType type, |
687 Handle<Name> name, | 676 Handle<Name> name, |
688 InlineCacheState state = MONOMORPHIC); | 677 InlineCacheState state = MONOMORPHIC); |
689 | 678 |
679 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | |
680 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | |
681 switch (kind()) { | |
682 case Code::LOAD_IC: return code->ic_state() == MONOMORPHIC | |
683 ? Logger::LOAD_IC_TAG : Logger::LOAD_POLYMORPHIC_IC_TAG; | |
684 case Code::STORE_IC: return code->ic_state() == MONOMORPHIC | |
685 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | |
686 case Code::KEYED_LOAD_IC: return code->ic_state() == MONOMORPHIC | |
687 ? Logger::KEYED_LOAD_IC_TAG : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; | |
688 case Code::KEYED_STORE_IC: return code->ic_state() == MONOMORPHIC | |
689 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | |
690 default: UNREACHABLE(); | |
691 } | |
692 return static_cast<Logger::LogEventsAndTags>(0); | |
693 } | |
694 | |
695 void JitEvent(Handle<Name> name, Handle<Code> code) { | |
696 GDBJIT(AddCode(GetGDBJITCodeTag(kind()), *name, *code)); | |
697 } | |
698 | |
699 Code::Kind kind() const { return kind_; } | |
700 | |
690 virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } | 701 virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } |
691 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) = 0; | |
692 virtual void JitEvent(Handle<Name> name, Handle<Code> code) = 0; | |
693 virtual Code::Kind kind() = 0; | |
694 virtual Register receiver() = 0; | 702 virtual Register receiver() = 0; |
695 virtual Register name() = 0; | 703 virtual Register name() = 0; |
696 virtual Register scratch1() = 0; | 704 virtual Register scratch1() = 0; |
697 virtual Register scratch2() = 0; | 705 virtual Register scratch2() = 0; |
698 virtual Register scratch3() = 0; | 706 virtual Register scratch3() = 0; |
699 | 707 |
708 static Register* GetRegisters(Code::Kind kind); | |
709 | |
710 Code::Kind kind_; | |
700 Register* registers_; | 711 Register* registers_; |
701 }; | 712 }; |
702 | 713 |
703 | 714 |
704 class BaseLoadStubCompiler: public BaseLoadStoreStubCompiler { | 715 class BaseLoadStubCompiler: public BaseLoadStoreStubCompiler { |
705 public: | 716 public: |
706 BaseLoadStubCompiler(Isolate* isolate, Register* registers) | 717 BaseLoadStubCompiler(Isolate* isolate, Code::Kind kind) |
707 : BaseLoadStoreStubCompiler(isolate, registers) { } | 718 : BaseLoadStoreStubCompiler(isolate, kind, GetRegisters(kind)) { } |
719 BaseLoadStubCompiler(Isolate* isolate, Code::Kind kind, Register* registers) | |
720 : BaseLoadStoreStubCompiler(isolate, kind, registers) { } | |
708 virtual ~BaseLoadStubCompiler() { } | 721 virtual ~BaseLoadStubCompiler() { } |
709 | 722 |
710 Handle<Code> CompileLoadField(Handle<JSObject> object, | 723 Handle<Code> CompileLoadField(Handle<JSObject> object, |
711 Handle<JSObject> holder, | 724 Handle<JSObject> holder, |
712 Handle<Name> name, | 725 Handle<Name> name, |
713 PropertyIndex index, | 726 PropertyIndex index, |
714 Representation representation); | 727 Representation representation); |
715 | 728 |
716 Handle<Code> CompileLoadCallback(Handle<JSObject> object, | 729 Handle<Code> CompileLoadCallback(Handle<JSObject> object, |
717 Handle<JSObject> holder, | 730 Handle<JSObject> holder, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
782 virtual Register scratch1() { return registers_[2]; } | 795 virtual Register scratch1() { return registers_[2]; } |
783 virtual Register scratch2() { return registers_[3]; } | 796 virtual Register scratch2() { return registers_[3]; } |
784 virtual Register scratch3() { return registers_[4]; } | 797 virtual Register scratch3() { return registers_[4]; } |
785 Register scratch4() { return registers_[5]; } | 798 Register scratch4() { return registers_[5]; } |
786 }; | 799 }; |
787 | 800 |
788 | 801 |
789 class LoadStubCompiler: public BaseLoadStubCompiler { | 802 class LoadStubCompiler: public BaseLoadStubCompiler { |
790 public: | 803 public: |
791 explicit LoadStubCompiler(Isolate* isolate) | 804 explicit LoadStubCompiler(Isolate* isolate) |
792 : BaseLoadStubCompiler(isolate, registers()) { } | 805 : BaseLoadStubCompiler(isolate, Code::LOAD_IC, registers()) { } |
793 | 806 |
794 Handle<Code> CompileLoadNonexistent(Handle<JSObject> object, | 807 Handle<Code> CompileLoadNonexistent(Handle<JSObject> object, |
795 Handle<JSObject> last, | 808 Handle<JSObject> last, |
796 Handle<Name> name, | 809 Handle<Name> name, |
797 Handle<GlobalObject> global); | 810 Handle<GlobalObject> global); |
798 | 811 |
799 static void GenerateLoadViaGetter(MacroAssembler* masm, | 812 static void GenerateLoadViaGetter(MacroAssembler* masm, |
800 Handle<JSFunction> getter); | 813 Handle<JSFunction> getter); |
801 | 814 |
802 Handle<Code> CompileLoadViaGetter(Handle<JSObject> object, | 815 Handle<Code> CompileLoadViaGetter(Handle<JSObject> object, |
803 Handle<JSObject> holder, | 816 Handle<JSObject> holder, |
804 Handle<Name> name, | 817 Handle<Name> name, |
805 Handle<JSFunction> getter); | 818 Handle<JSFunction> getter); |
806 | 819 |
807 Handle<Code> CompileLoadGlobal(Handle<JSObject> object, | 820 Handle<Code> CompileLoadGlobal(Handle<JSObject> object, |
808 Handle<GlobalObject> holder, | 821 Handle<GlobalObject> holder, |
809 Handle<PropertyCell> cell, | 822 Handle<PropertyCell> cell, |
810 Handle<Name> name, | 823 Handle<Name> name, |
811 bool is_dont_delete); | 824 bool is_dont_delete); |
812 | 825 |
813 private: | |
814 static Register* registers(); | 826 static Register* registers(); |
815 virtual Code::Kind kind() { return Code::LOAD_IC; } | |
816 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | |
817 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | |
818 return code->ic_state() == MONOMORPHIC | |
819 ? Logger::LOAD_IC_TAG : Logger::LOAD_POLYMORPHIC_IC_TAG; | |
820 } | |
821 virtual void JitEvent(Handle<Name> name, Handle<Code> code); | |
822 }; | 827 }; |
823 | 828 |
824 | 829 |
825 class KeyedLoadStubCompiler: public BaseLoadStubCompiler { | 830 class KeyedLoadStubCompiler: public BaseLoadStubCompiler { |
826 public: | 831 public: |
827 explicit KeyedLoadStubCompiler(Isolate* isolate) | 832 explicit KeyedLoadStubCompiler(Isolate* isolate) |
828 : BaseLoadStubCompiler(isolate, registers()) { } | 833 : BaseLoadStubCompiler(isolate, Code::KEYED_LOAD_IC, registers()) { } |
829 | 834 |
830 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); | 835 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); |
831 | 836 |
832 void CompileElementHandlers(MapHandleList* receiver_maps, | 837 void CompileElementHandlers(MapHandleList* receiver_maps, |
833 CodeHandleList* handlers); | 838 CodeHandleList* handlers); |
834 | 839 |
835 static void GenerateLoadDictionaryElement(MacroAssembler* masm); | 840 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
836 | 841 |
842 static Register* registers(); | |
843 | |
837 private: | 844 private: |
838 static Register* registers(); | |
839 virtual Code::Kind kind() { return Code::KEYED_LOAD_IC; } | |
840 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | |
841 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | |
842 return code->ic_state() == MONOMORPHIC | |
843 ? Logger::KEYED_LOAD_IC_TAG : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; | |
844 } | |
845 virtual void JitEvent(Handle<Name> name, Handle<Code> code); | |
846 virtual void GenerateNameCheck(Handle<Name> name, | 845 virtual void GenerateNameCheck(Handle<Name> name, |
847 Register name_reg, | 846 Register name_reg, |
848 Label* miss); | 847 Label* miss); |
849 }; | 848 }; |
850 | 849 |
851 | 850 |
852 class BaseStoreStubCompiler: public BaseLoadStoreStubCompiler { | 851 class BaseStoreStubCompiler: public BaseLoadStoreStubCompiler { |
853 public: | 852 public: |
854 BaseStoreStubCompiler(Isolate* isolate, | 853 BaseStoreStubCompiler(Isolate* isolate, |
855 StrictModeFlag strict_mode, | 854 Code::Kind kind, |
856 Register* registers) | 855 StrictModeFlag strict_mode) |
857 : BaseLoadStoreStubCompiler(isolate, registers), | 856 : BaseLoadStoreStubCompiler(isolate, kind, GetRegisters(kind)), |
858 strict_mode_(strict_mode) { } | 857 strict_mode_(strict_mode) { } |
859 | 858 |
860 virtual ~BaseStoreStubCompiler() { } | 859 virtual ~BaseStoreStubCompiler() { } |
861 | 860 |
862 Handle<Code> CompileStoreTransition(Handle<JSObject> object, | 861 Handle<Code> CompileStoreTransition(Handle<JSObject> object, |
863 LookupResult* lookup, | 862 LookupResult* lookup, |
864 Handle<Map> transition, | 863 Handle<Map> transition, |
865 Handle<Name> name); | 864 Handle<Name> name); |
866 | 865 |
867 Handle<Code> CompileStoreField(Handle<JSObject> object, | 866 Handle<Code> CompileStoreField(Handle<JSObject> object, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
945 virtual Code::ExtraICState extra_state() { return strict_mode_; } | 944 virtual Code::ExtraICState extra_state() { return strict_mode_; } |
946 | 945 |
947 private: | 946 private: |
948 StrictModeFlag strict_mode_; | 947 StrictModeFlag strict_mode_; |
949 }; | 948 }; |
950 | 949 |
951 | 950 |
952 class StoreStubCompiler: public BaseStoreStubCompiler { | 951 class StoreStubCompiler: public BaseStoreStubCompiler { |
953 public: | 952 public: |
954 StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode) | 953 StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode) |
955 : BaseStoreStubCompiler(isolate, strict_mode, registers()) { } | 954 : BaseStoreStubCompiler(isolate, Code::STORE_IC, strict_mode) { } |
956 | 955 |
957 | 956 |
958 Handle<Code> CompileStoreCallback(Handle<JSObject> object, | 957 Handle<Code> CompileStoreCallback(Handle<JSObject> object, |
959 Handle<JSObject> holder, | 958 Handle<JSObject> holder, |
960 Handle<Name> name, | 959 Handle<Name> name, |
961 Handle<ExecutableAccessorInfo> callback); | 960 Handle<ExecutableAccessorInfo> callback); |
962 | 961 |
963 static void GenerateStoreViaSetter(MacroAssembler* masm, | 962 static void GenerateStoreViaSetter(MacroAssembler* masm, |
964 Handle<JSFunction> setter); | 963 Handle<JSFunction> setter); |
965 | 964 |
966 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, | 965 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, |
967 Handle<JSObject> holder, | 966 Handle<JSObject> holder, |
968 Handle<Name> name, | 967 Handle<Name> name, |
969 Handle<JSFunction> setter); | 968 Handle<JSFunction> setter); |
970 | 969 |
971 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, | 970 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, |
972 Handle<Name> name); | 971 Handle<Name> name); |
973 | 972 |
974 Handle<Code> CompileStoreGlobal(Handle<GlobalObject> object, | 973 Handle<Code> CompileStoreGlobal(Handle<GlobalObject> object, |
975 Handle<PropertyCell> holder, | 974 Handle<PropertyCell> holder, |
976 Handle<Name> name); | 975 Handle<Name> name); |
977 | 976 |
978 private: | |
979 static Register* registers(); | 977 static Register* registers(); |
980 virtual Code::Kind kind() { return Code::STORE_IC; } | |
981 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | |
982 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | |
983 return code->ic_state() == MONOMORPHIC | |
984 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | |
985 } | |
986 virtual void JitEvent(Handle<Name> name, Handle<Code> code); | |
987 }; | 978 }; |
988 | 979 |
989 | 980 |
990 class KeyedStoreStubCompiler: public BaseStoreStubCompiler { | 981 class KeyedStoreStubCompiler: public BaseStoreStubCompiler { |
991 public: | 982 public: |
992 KeyedStoreStubCompiler(Isolate* isolate, | 983 KeyedStoreStubCompiler(Isolate* isolate, |
993 StrictModeFlag strict_mode, | 984 StrictModeFlag strict_mode, |
994 KeyedAccessStoreMode store_mode) | 985 KeyedAccessStoreMode store_mode) |
995 : BaseStoreStubCompiler(isolate, strict_mode, registers()), | 986 : BaseStoreStubCompiler(isolate, Code::KEYED_STORE_IC, strict_mode), |
996 store_mode_(store_mode) { } | 987 store_mode_(store_mode) { } |
997 | 988 |
998 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); | 989 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); |
999 | 990 |
1000 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, | 991 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, |
1001 CodeHandleList* handler_stubs, | 992 CodeHandleList* handler_stubs, |
1002 MapHandleList* transitioned_maps); | 993 MapHandleList* transitioned_maps); |
1003 | 994 |
1004 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); | 995 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); |
1005 | 996 |
1006 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 997 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
1007 | 998 |
999 static Register* registers(); | |
1000 | |
1008 protected: | 1001 protected: |
1009 virtual Code::ExtraICState extra_state() { | 1002 virtual Code::ExtraICState extra_state() { |
1010 return Code::ComputeExtraICState(store_mode_, strict_mode()); | 1003 return Code::ComputeExtraICState(store_mode_, strict_mode()); |
1011 } | 1004 } |
1012 | 1005 |
1013 private: | 1006 private: |
1014 Register transition_map() { | 1007 Register transition_map() { |
1015 return registers()[3]; | 1008 return registers()[3]; |
1016 } | 1009 } |
1017 | 1010 |
1018 static Register* registers(); | |
1019 virtual Code::Kind kind() { return Code::KEYED_STORE_IC; } | |
1020 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | |
1021 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | |
1022 return code->ic_state() == MONOMORPHIC | |
1023 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | |
1024 } | |
1025 virtual void JitEvent(Handle<Name> name, Handle<Code> code); | |
1026 virtual void GenerateNameCheck(Handle<Name> name, | 1011 virtual void GenerateNameCheck(Handle<Name> name, |
1027 Register name_reg, | 1012 Register name_reg, |
1028 Label* miss); | 1013 Label* miss); |
1029 KeyedAccessStoreMode store_mode_; | 1014 KeyedAccessStoreMode store_mode_; |
1030 }; | 1015 }; |
1031 | 1016 |
1032 | 1017 |
1033 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 1018 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call |
1034 // IC stubs. | 1019 // IC stubs. |
1035 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 1020 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1194 Handle<JSFunction> constant_function_; | 1179 Handle<JSFunction> constant_function_; |
1195 bool is_simple_api_call_; | 1180 bool is_simple_api_call_; |
1196 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1181 Handle<FunctionTemplateInfo> expected_receiver_type_; |
1197 Handle<CallHandlerInfo> api_call_info_; | 1182 Handle<CallHandlerInfo> api_call_info_; |
1198 }; | 1183 }; |
1199 | 1184 |
1200 | 1185 |
1201 } } // namespace v8::internal | 1186 } } // namespace v8::internal |
1202 | 1187 |
1203 #endif // V8_STUB_CACHE_H_ | 1188 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |