| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 void Initialize(); | 78 void Initialize(); |
| 79 | 79 |
| 80 Handle<JSObject> StubHolder(Handle<JSObject> receiver, | 80 Handle<JSObject> StubHolder(Handle<JSObject> receiver, |
| 81 Handle<JSObject> holder); | 81 Handle<JSObject> holder); |
| 82 | 82 |
| 83 Handle<Code> FindIC(Handle<Name> name, | 83 Handle<Code> FindIC(Handle<Name> name, |
| 84 Handle<Map> stub_holder_map, | 84 Handle<Map> stub_holder_map, |
| 85 Code::Kind kind, | 85 Code::Kind kind, |
| 86 Code::ExtraICState extra_state = Code::kNoExtraICState, | 86 ExtraICState extra_state = kNoExtraICState, |
| 87 InlineCacheHolderFlag cache_holder = OWN_MAP); | 87 InlineCacheHolderFlag cache_holder = OWN_MAP); |
| 88 | 88 |
| 89 Handle<Code> FindHandler(Handle<Name> name, | 89 Handle<Code> FindHandler(Handle<Name> name, |
| 90 Handle<Map> map, | 90 Handle<Map> map, |
| 91 Code::Kind kind, | 91 Code::Kind kind, |
| 92 InlineCacheHolderFlag cache_holder = OWN_MAP, | 92 InlineCacheHolderFlag cache_holder = OWN_MAP, |
| 93 StrictModeFlag strict_mode = kNonStrictMode); | 93 StrictModeFlag strict_mode = kNonStrictMode); |
| 94 | 94 |
| 95 Handle<Code> ComputeMonomorphicIC(Handle<Name> name, | 95 Handle<Code> ComputeMonomorphicIC(Handle<Name> name, |
| 96 Handle<Type> type, | 96 Handle<Type> type, |
| 97 Handle<Code> handler, | 97 Handle<Code> handler, |
| 98 StrictModeFlag strict_mode); | 98 ExtraICState extra_ic_state); |
| 99 | 99 |
| 100 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type); | 100 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type); |
| 101 | 101 |
| 102 Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); | 102 Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); |
| 103 | 103 |
| 104 Handle<Code> ComputeKeyedStoreElement(Handle<Map> receiver_map, | 104 Handle<Code> ComputeKeyedStoreElement(Handle<Map> receiver_map, |
| 105 StrictModeFlag strict_mode, | 105 StrictModeFlag strict_mode, |
| 106 KeyedAccessStoreMode store_mode); | 106 KeyedAccessStoreMode store_mode); |
| 107 | 107 |
| 108 Handle<Code> ComputeCallField(int argc, | 108 Handle<Code> ComputeCallField(int argc, |
| 109 Code::Kind, | 109 Code::Kind, |
| 110 Code::ExtraICState extra_state, | 110 ExtraICState extra_state, |
| 111 Handle<Name> name, | 111 Handle<Name> name, |
| 112 Handle<Object> object, | 112 Handle<Object> object, |
| 113 Handle<JSObject> holder, | 113 Handle<JSObject> holder, |
| 114 PropertyIndex index); | 114 PropertyIndex index); |
| 115 | 115 |
| 116 Handle<Code> ComputeCallConstant(int argc, | 116 Handle<Code> ComputeCallConstant(int argc, |
| 117 Code::Kind, | 117 Code::Kind, |
| 118 Code::ExtraICState extra_state, | 118 ExtraICState extra_state, |
| 119 Handle<Name> name, | 119 Handle<Name> name, |
| 120 Handle<Object> object, | 120 Handle<Object> object, |
| 121 Handle<JSObject> holder, | 121 Handle<JSObject> holder, |
| 122 Handle<JSFunction> function); | 122 Handle<JSFunction> function); |
| 123 | 123 |
| 124 Handle<Code> ComputeCallInterceptor(int argc, | 124 Handle<Code> ComputeCallInterceptor(int argc, |
| 125 Code::Kind, | 125 Code::Kind, |
| 126 Code::ExtraICState extra_state, | 126 ExtraICState extra_state, |
| 127 Handle<Name> name, | 127 Handle<Name> name, |
| 128 Handle<Object> object, | 128 Handle<Object> object, |
| 129 Handle<JSObject> holder); | 129 Handle<JSObject> holder); |
| 130 | 130 |
| 131 Handle<Code> ComputeCallGlobal(int argc, | 131 Handle<Code> ComputeCallGlobal(int argc, |
| 132 Code::Kind, | 132 Code::Kind, |
| 133 Code::ExtraICState extra_state, | 133 ExtraICState extra_state, |
| 134 Handle<Name> name, | 134 Handle<Name> name, |
| 135 Handle<JSObject> object, | 135 Handle<JSObject> object, |
| 136 Handle<GlobalObject> holder, | 136 Handle<GlobalObject> holder, |
| 137 Handle<PropertyCell> cell, | 137 Handle<PropertyCell> cell, |
| 138 Handle<JSFunction> function); | 138 Handle<JSFunction> function); |
| 139 | 139 |
| 140 // --- | 140 // --- |
| 141 | 141 |
| 142 Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode); | 142 Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode); |
| 143 | 143 |
| 144 Handle<Code> ComputeKeyedCallInitialize(int argc); | 144 Handle<Code> ComputeKeyedCallInitialize(int argc); |
| 145 | 145 |
| 146 Handle<Code> ComputeCallPreMonomorphic(int argc, | 146 Handle<Code> ComputeCallPreMonomorphic(int argc, |
| 147 Code::Kind kind, | 147 Code::Kind kind, |
| 148 Code::ExtraICState extra_state); | 148 ExtraICState extra_state); |
| 149 | 149 |
| 150 Handle<Code> ComputeCallNormal(int argc, | 150 Handle<Code> ComputeCallNormal(int argc, |
| 151 Code::Kind kind, | 151 Code::Kind kind, |
| 152 Code::ExtraICState state); | 152 ExtraICState state); |
| 153 | 153 |
| 154 Handle<Code> ComputeCallArguments(int argc); | 154 Handle<Code> ComputeCallArguments(int argc); |
| 155 | 155 |
| 156 Handle<Code> ComputeCallMegamorphic(int argc, | 156 Handle<Code> ComputeCallMegamorphic(int argc, |
| 157 Code::Kind kind, | 157 Code::Kind kind, |
| 158 Code::ExtraICState state); | 158 ExtraICState state); |
| 159 | 159 |
| 160 Handle<Code> ComputeCallMiss(int argc, | 160 Handle<Code> ComputeCallMiss(int argc, |
| 161 Code::Kind kind, | 161 Code::Kind kind, |
| 162 Code::ExtraICState state); | 162 ExtraICState state); |
| 163 | 163 |
| 164 // --- | 164 // --- |
| 165 | 165 |
| 166 Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, | 166 Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, |
| 167 CompareNilICStub& stub); | 167 CompareNilICStub& stub); |
| 168 | 168 |
| 169 // --- | 169 // --- |
| 170 | 170 |
| 171 Handle<Code> ComputeLoadElementPolymorphic(MapHandleList* receiver_maps); | 171 Handle<Code> ComputeLoadElementPolymorphic(MapHandleList* receiver_maps); |
| 172 Handle<Code> ComputeStoreElementPolymorphic(MapHandleList* receiver_maps, | 172 Handle<Code> ComputeStoreElementPolymorphic(MapHandleList* receiver_maps, |
| 173 KeyedAccessStoreMode store_mode, | 173 KeyedAccessStoreMode store_mode, |
| 174 StrictModeFlag strict_mode); | 174 StrictModeFlag strict_mode); |
| 175 | 175 |
| 176 Handle<Code> ComputePolymorphicIC(TypeHandleList* types, | 176 Handle<Code> ComputePolymorphicIC(TypeHandleList* types, |
| 177 CodeHandleList* handlers, | 177 CodeHandleList* handlers, |
| 178 int number_of_valid_maps, | 178 int number_of_valid_maps, |
| 179 Handle<Name> name, | 179 Handle<Name> name, |
| 180 StrictModeFlag strict_mode); | 180 ExtraICState extra_ic_state); |
| 181 | 181 |
| 182 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 182 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
| 183 Code* FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind); | 183 Code* FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind); |
| 184 | 184 |
| 185 #ifdef ENABLE_DEBUGGER_SUPPORT | 185 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 186 Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind); | 186 Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind); |
| 187 | 187 |
| 188 Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind); | 188 Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind); |
| 189 #endif | 189 #endif |
| 190 | 190 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } else if (kind_ == Code::STORE_IC) { | 583 } else if (kind_ == Code::STORE_IC) { |
| 584 return code->ic_state() == MONOMORPHIC | 584 return code->ic_state() == MONOMORPHIC |
| 585 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | 585 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; |
| 586 } else { | 586 } else { |
| 587 return code->ic_state() == MONOMORPHIC | 587 return code->ic_state() == MONOMORPHIC |
| 588 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | 588 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 void JitEvent(Handle<Name> name, Handle<Code> code); | 591 void JitEvent(Handle<Name> name, Handle<Code> code); |
| 592 | 592 |
| 593 virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } | 593 virtual ExtraICState extra_state() { return kNoExtraICState; } |
| 594 virtual Register receiver() = 0; | 594 virtual Register receiver() = 0; |
| 595 virtual Register name() = 0; | 595 virtual Register name() = 0; |
| 596 virtual Register scratch1() = 0; | 596 virtual Register scratch1() = 0; |
| 597 virtual Register scratch2() = 0; | 597 virtual Register scratch2() = 0; |
| 598 virtual Register scratch3() = 0; | 598 virtual Register scratch3() = 0; |
| 599 | 599 |
| 600 void InitializeRegisters(); | 600 void InitializeRegisters(); |
| 601 | 601 |
| 602 bool IncludesNumberType(TypeHandleList* types); | 602 bool IncludesNumberType(TypeHandleList* types); |
| 603 | 603 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 Label* label, | 821 Label* label, |
| 822 Handle<Name> name); | 822 Handle<Name> name); |
| 823 | 823 |
| 824 virtual Register receiver() { return registers_[0]; } | 824 virtual Register receiver() { return registers_[0]; } |
| 825 virtual Register name() { return registers_[1]; } | 825 virtual Register name() { return registers_[1]; } |
| 826 Register value() { return registers_[2]; } | 826 Register value() { return registers_[2]; } |
| 827 virtual Register scratch1() { return registers_[3]; } | 827 virtual Register scratch1() { return registers_[3]; } |
| 828 virtual Register scratch2() { return registers_[4]; } | 828 virtual Register scratch2() { return registers_[4]; } |
| 829 virtual Register scratch3() { return registers_[5]; } | 829 virtual Register scratch3() { return registers_[5]; } |
| 830 StrictModeFlag strict_mode() { return strict_mode_; } | 830 StrictModeFlag strict_mode() { return strict_mode_; } |
| 831 virtual Code::ExtraICState extra_state() { return strict_mode_; } | 831 virtual ExtraICState extra_state() { |
| 832 return StoreIC::ComputeExtraICState(strict_mode_); |
| 833 } |
| 832 | 834 |
| 833 protected: | 835 protected: |
| 834 static Register* registers(); | 836 static Register* registers(); |
| 835 | 837 |
| 836 private: | 838 private: |
| 837 StrictModeFlag strict_mode_; | 839 StrictModeFlag strict_mode_; |
| 838 friend class BaseLoadStoreStubCompiler; | 840 friend class BaseLoadStoreStubCompiler; |
| 839 }; | 841 }; |
| 840 | 842 |
| 841 | 843 |
| 842 class KeyedStoreStubCompiler: public StoreStubCompiler { | 844 class KeyedStoreStubCompiler: public StoreStubCompiler { |
| 843 public: | 845 public: |
| 844 KeyedStoreStubCompiler(Isolate* isolate, | 846 KeyedStoreStubCompiler(Isolate* isolate, |
| 845 StrictModeFlag strict_mode, | 847 StrictModeFlag strict_mode, |
| 846 KeyedAccessStoreMode store_mode) | 848 KeyedAccessStoreMode store_mode) |
| 847 : StoreStubCompiler(isolate, strict_mode, Code::KEYED_STORE_IC), | 849 : StoreStubCompiler(isolate, strict_mode, Code::KEYED_STORE_IC), |
| 848 store_mode_(store_mode) { } | 850 store_mode_(store_mode) { } |
| 849 | 851 |
| 850 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); | 852 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); |
| 851 | 853 |
| 852 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, | 854 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, |
| 853 CodeHandleList* handler_stubs, | 855 CodeHandleList* handler_stubs, |
| 854 MapHandleList* transitioned_maps); | 856 MapHandleList* transitioned_maps); |
| 855 | 857 |
| 856 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); | 858 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); |
| 857 | 859 |
| 858 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 860 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
| 859 | 861 |
| 860 protected: | 862 protected: |
| 861 virtual Code::ExtraICState extra_state() { | 863 virtual ExtraICState extra_state() { |
| 862 return Code::ComputeExtraICState(store_mode_, strict_mode()); | 864 return KeyedStoreIC::ComputeExtraICState(strict_mode(), store_mode_); |
| 863 } | 865 } |
| 864 static Register* registers(); | 866 static Register* registers(); |
| 865 | 867 |
| 866 private: | 868 private: |
| 867 Register transition_map() { | 869 Register transition_map() { |
| 868 return registers()[3]; | 870 return registers()[3]; |
| 869 } | 871 } |
| 870 | 872 |
| 871 virtual void GenerateNameCheck(Handle<Name> name, | 873 virtual void GenerateNameCheck(Handle<Name> name, |
| 872 Register name_reg, | 874 Register name_reg, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 891 | 893 |
| 892 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ | 894 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ |
| 893 V(ArrayCode) | 895 V(ArrayCode) |
| 894 | 896 |
| 895 | 897 |
| 896 class CallStubCompiler: public StubCompiler { | 898 class CallStubCompiler: public StubCompiler { |
| 897 public: | 899 public: |
| 898 CallStubCompiler(Isolate* isolate, | 900 CallStubCompiler(Isolate* isolate, |
| 899 int argc, | 901 int argc, |
| 900 Code::Kind kind, | 902 Code::Kind kind, |
| 901 Code::ExtraICState extra_state, | 903 ExtraICState extra_state, |
| 902 InlineCacheHolderFlag cache_holder = OWN_MAP); | 904 InlineCacheHolderFlag cache_holder = OWN_MAP); |
| 903 | 905 |
| 904 Handle<Code> CompileCallField(Handle<JSObject> object, | 906 Handle<Code> CompileCallField(Handle<JSObject> object, |
| 905 Handle<JSObject> holder, | 907 Handle<JSObject> holder, |
| 906 PropertyIndex index, | 908 PropertyIndex index, |
| 907 Handle<Name> name); | 909 Handle<Name> name); |
| 908 | 910 |
| 909 void CompileHandlerFrontend(Handle<Object> object, | 911 void CompileHandlerFrontend(Handle<Object> object, |
| 910 Handle<JSObject> holder, | 912 Handle<JSObject> holder, |
| 911 Handle<Name> name, | 913 Handle<Name> name, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 // it still contains the same function. | 978 // it still contains the same function. |
| 977 void GenerateLoadFunctionFromCell(Handle<Cell> cell, | 979 void GenerateLoadFunctionFromCell(Handle<Cell> cell, |
| 978 Handle<JSFunction> function, | 980 Handle<JSFunction> function, |
| 979 Label* miss); | 981 Label* miss); |
| 980 | 982 |
| 981 // Generates a jump to CallIC miss stub. | 983 // Generates a jump to CallIC miss stub. |
| 982 void GenerateMissBranch(); | 984 void GenerateMissBranch(); |
| 983 | 985 |
| 984 const ParameterCount arguments_; | 986 const ParameterCount arguments_; |
| 985 const Code::Kind kind_; | 987 const Code::Kind kind_; |
| 986 const Code::ExtraICState extra_state_; | 988 const ExtraICState extra_state_; |
| 987 const InlineCacheHolderFlag cache_holder_; | 989 const InlineCacheHolderFlag cache_holder_; |
| 988 }; | 990 }; |
| 989 | 991 |
| 990 | 992 |
| 991 // Holds information about possible function call optimizations. | 993 // Holds information about possible function call optimizations. |
| 992 class CallOptimization BASE_EMBEDDED { | 994 class CallOptimization BASE_EMBEDDED { |
| 993 public: | 995 public: |
| 994 explicit CallOptimization(LookupResult* lookup); | 996 explicit CallOptimization(LookupResult* lookup); |
| 995 | 997 |
| 996 explicit CallOptimization(Handle<JSFunction> function); | 998 explicit CallOptimization(Handle<JSFunction> function); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 Handle<JSFunction> constant_function_; | 1041 Handle<JSFunction> constant_function_; |
| 1040 bool is_simple_api_call_; | 1042 bool is_simple_api_call_; |
| 1041 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1043 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1042 Handle<CallHandlerInfo> api_call_info_; | 1044 Handle<CallHandlerInfo> api_call_info_; |
| 1043 }; | 1045 }; |
| 1044 | 1046 |
| 1045 | 1047 |
| 1046 } } // namespace v8::internal | 1048 } } // namespace v8::internal |
| 1047 | 1049 |
| 1048 #endif // V8_STUB_CACHE_H_ | 1050 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |