| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 Handle<Code> ComputeLoadInterceptor(Handle<Name> name, | 133 Handle<Code> ComputeLoadInterceptor(Handle<Name> name, |
| 134 Handle<JSObject> object, | 134 Handle<JSObject> object, |
| 135 Handle<JSObject> holder); | 135 Handle<JSObject> holder); |
| 136 | 136 |
| 137 Handle<Code> ComputeLoadNormal(Handle<Name> name, | 137 Handle<Code> ComputeLoadNormal(Handle<Name> name, |
| 138 Handle<JSObject> object); | 138 Handle<JSObject> object); |
| 139 | 139 |
| 140 Handle<Code> ComputeLoadGlobal(Handle<Name> name, | 140 Handle<Code> ComputeLoadGlobal(Handle<Name> name, |
| 141 Handle<JSObject> object, | 141 Handle<JSObject> object, |
| 142 Handle<GlobalObject> holder, | 142 Handle<GlobalObject> holder, |
| 143 Handle<JSGlobalPropertyCell> cell, | 143 Handle<PropertyCell> cell, |
| 144 bool is_dont_delete); | 144 bool is_dont_delete); |
| 145 | 145 |
| 146 // --- | 146 // --- |
| 147 | 147 |
| 148 Handle<Code> ComputeKeyedLoadField(Handle<Name> name, | 148 Handle<Code> ComputeKeyedLoadField(Handle<Name> name, |
| 149 Handle<JSObject> object, | 149 Handle<JSObject> object, |
| 150 Handle<JSObject> holder, | 150 Handle<JSObject> holder, |
| 151 PropertyIndex field_index, | 151 PropertyIndex field_index, |
| 152 Representation representation); | 152 Representation representation); |
| 153 | 153 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 176 Handle<Code> ComputeStoreTransition(Handle<Name> name, | 176 Handle<Code> ComputeStoreTransition(Handle<Name> name, |
| 177 Handle<JSObject> object, | 177 Handle<JSObject> object, |
| 178 LookupResult* lookup, | 178 LookupResult* lookup, |
| 179 Handle<Map> transition, | 179 Handle<Map> transition, |
| 180 StrictModeFlag strict_mode); | 180 StrictModeFlag strict_mode); |
| 181 | 181 |
| 182 Handle<Code> ComputeStoreNormal(StrictModeFlag strict_mode); | 182 Handle<Code> ComputeStoreNormal(StrictModeFlag strict_mode); |
| 183 | 183 |
| 184 Handle<Code> ComputeStoreGlobal(Handle<Name> name, | 184 Handle<Code> ComputeStoreGlobal(Handle<Name> name, |
| 185 Handle<GlobalObject> object, | 185 Handle<GlobalObject> object, |
| 186 Handle<JSGlobalPropertyCell> cell, | 186 Handle<PropertyCell> cell, |
| 187 StrictModeFlag strict_mode); | 187 StrictModeFlag strict_mode); |
| 188 | 188 |
| 189 Handle<Code> ComputeStoreCallback(Handle<Name> name, | 189 Handle<Code> ComputeStoreCallback(Handle<Name> name, |
| 190 Handle<JSObject> object, | 190 Handle<JSObject> object, |
| 191 Handle<JSObject> holder, | 191 Handle<JSObject> holder, |
| 192 Handle<ExecutableAccessorInfo> callback, | 192 Handle<ExecutableAccessorInfo> callback, |
| 193 StrictModeFlag strict_mode); | 193 StrictModeFlag strict_mode); |
| 194 | 194 |
| 195 Handle<Code> ComputeStoreViaSetter(Handle<Name> name, | 195 Handle<Code> ComputeStoreViaSetter(Handle<Name> name, |
| 196 Handle<JSObject> object, | 196 Handle<JSObject> object, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 Handle<Name> name, | 244 Handle<Name> name, |
| 245 Handle<Object> object, | 245 Handle<Object> object, |
| 246 Handle<JSObject> holder); | 246 Handle<JSObject> holder); |
| 247 | 247 |
| 248 Handle<Code> ComputeCallGlobal(int argc, | 248 Handle<Code> ComputeCallGlobal(int argc, |
| 249 Code::Kind, | 249 Code::Kind, |
| 250 Code::ExtraICState extra_state, | 250 Code::ExtraICState extra_state, |
| 251 Handle<Name> name, | 251 Handle<Name> name, |
| 252 Handle<JSObject> object, | 252 Handle<JSObject> object, |
| 253 Handle<GlobalObject> holder, | 253 Handle<GlobalObject> holder, |
| 254 Handle<JSGlobalPropertyCell> cell, | 254 Handle<PropertyCell> cell, |
| 255 Handle<JSFunction> function); | 255 Handle<JSFunction> function); |
| 256 | 256 |
| 257 // --- | 257 // --- |
| 258 | 258 |
| 259 Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode); | 259 Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode); |
| 260 | 260 |
| 261 Handle<Code> ComputeKeyedCallInitialize(int argc); | 261 Handle<Code> ComputeKeyedCallInitialize(int argc); |
| 262 | 262 |
| 263 Handle<Code> ComputeCallPreMonomorphic(int argc, | 263 Handle<Code> ComputeCallPreMonomorphic(int argc, |
| 264 Code::Kind kind, | 264 Code::Kind kind, |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 static void GenerateLoadViaGetter(MacroAssembler* masm, | 758 static void GenerateLoadViaGetter(MacroAssembler* masm, |
| 759 Handle<JSFunction> getter); | 759 Handle<JSFunction> getter); |
| 760 | 760 |
| 761 Handle<Code> CompileLoadViaGetter(Handle<JSObject> object, | 761 Handle<Code> CompileLoadViaGetter(Handle<JSObject> object, |
| 762 Handle<JSObject> holder, | 762 Handle<JSObject> holder, |
| 763 Handle<Name> name, | 763 Handle<Name> name, |
| 764 Handle<JSFunction> getter); | 764 Handle<JSFunction> getter); |
| 765 | 765 |
| 766 Handle<Code> CompileLoadGlobal(Handle<JSObject> object, | 766 Handle<Code> CompileLoadGlobal(Handle<JSObject> object, |
| 767 Handle<GlobalObject> holder, | 767 Handle<GlobalObject> holder, |
| 768 Handle<JSGlobalPropertyCell> cell, | 768 Handle<PropertyCell> cell, |
| 769 Handle<Name> name, | 769 Handle<Name> name, |
| 770 bool is_dont_delete); | 770 bool is_dont_delete); |
| 771 | 771 |
| 772 static Register receiver() { return registers()[0]; } | 772 static Register receiver() { return registers()[0]; } |
| 773 | 773 |
| 774 private: | 774 private: |
| 775 static Register* registers(); | 775 static Register* registers(); |
| 776 virtual Code::Kind kind() { return Code::LOAD_IC; } | 776 virtual Code::Kind kind() { return Code::LOAD_IC; } |
| 777 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | 777 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 778 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | 778 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 883 |
| 884 Handle<Code> CompileStoreViaSetter(Handle<Name> name, | 884 Handle<Code> CompileStoreViaSetter(Handle<Name> name, |
| 885 Handle<JSObject> object, | 885 Handle<JSObject> object, |
| 886 Handle<JSObject> holder, | 886 Handle<JSObject> holder, |
| 887 Handle<JSFunction> setter); | 887 Handle<JSFunction> setter); |
| 888 | 888 |
| 889 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, | 889 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, |
| 890 Handle<Name> name); | 890 Handle<Name> name); |
| 891 | 891 |
| 892 Handle<Code> CompileStoreGlobal(Handle<GlobalObject> object, | 892 Handle<Code> CompileStoreGlobal(Handle<GlobalObject> object, |
| 893 Handle<JSGlobalPropertyCell> holder, | 893 Handle<PropertyCell> holder, |
| 894 Handle<Name> name); | 894 Handle<Name> name); |
| 895 | 895 |
| 896 private: | 896 private: |
| 897 static Register* registers(); | 897 static Register* registers(); |
| 898 virtual Code::Kind kind() { return Code::STORE_IC; } | 898 virtual Code::Kind kind() { return Code::STORE_IC; } |
| 899 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { | 899 virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 900 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; | 900 if (!code->is_inline_cache_stub()) return Logger::STUB_TAG; |
| 901 return code->ic_state() == MONOMORPHIC | 901 return code->ic_state() == MONOMORPHIC |
| 902 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | 902 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; |
| 903 } | 903 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 | 962 |
| 963 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 963 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call |
| 964 // IC stubs. | 964 // IC stubs. |
| 965 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 965 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
| 966 V(ArrayPush) \ | 966 V(ArrayPush) \ |
| 967 V(ArrayPop) \ | 967 V(ArrayPop) \ |
| 968 V(StringCharCodeAt) \ | 968 V(StringCharCodeAt) \ |
| 969 V(StringCharAt) \ | 969 V(StringCharAt) \ |
| 970 V(StringFromCharCode) \ | 970 V(StringFromCharCode) \ |
| 971 V(MathFloor) \ | 971 V(MathFloor) \ |
| 972 V(MathAbs) | 972 V(MathAbs) \ |
| 973 V(ArrayCode) |
| 974 |
| 975 |
| 976 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ |
| 977 V(ArrayCode) |
| 973 | 978 |
| 974 | 979 |
| 975 class CallOptimization; | 980 class CallOptimization; |
| 976 | 981 |
| 977 class CallStubCompiler: public StubCompiler { | 982 class CallStubCompiler: public StubCompiler { |
| 978 public: | 983 public: |
| 979 CallStubCompiler(Isolate* isolate, | 984 CallStubCompiler(Isolate* isolate, |
| 980 int argc, | 985 int argc, |
| 981 Code::Kind kind, | 986 Code::Kind kind, |
| 982 Code::ExtraICState extra_state, | 987 Code::ExtraICState extra_state, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1000 Handle<Name> name, | 1005 Handle<Name> name, |
| 1001 CheckType check, | 1006 CheckType check, |
| 1002 Handle<JSFunction> function); | 1007 Handle<JSFunction> function); |
| 1003 | 1008 |
| 1004 Handle<Code> CompileCallInterceptor(Handle<JSObject> object, | 1009 Handle<Code> CompileCallInterceptor(Handle<JSObject> object, |
| 1005 Handle<JSObject> holder, | 1010 Handle<JSObject> holder, |
| 1006 Handle<Name> name); | 1011 Handle<Name> name); |
| 1007 | 1012 |
| 1008 Handle<Code> CompileCallGlobal(Handle<JSObject> object, | 1013 Handle<Code> CompileCallGlobal(Handle<JSObject> object, |
| 1009 Handle<GlobalObject> holder, | 1014 Handle<GlobalObject> holder, |
| 1010 Handle<JSGlobalPropertyCell> cell, | 1015 Handle<PropertyCell> cell, |
| 1011 Handle<JSFunction> function, | 1016 Handle<JSFunction> function, |
| 1012 Handle<Name> name); | 1017 Handle<Name> name); |
| 1013 | 1018 |
| 1014 static bool HasCustomCallGenerator(Handle<JSFunction> function); | 1019 static bool HasCustomCallGenerator(Handle<JSFunction> function); |
| 1020 static bool CanBeCached(Handle<JSFunction> function); |
| 1015 | 1021 |
| 1016 private: | 1022 private: |
| 1017 // Compiles a custom call constant/global IC. For constant calls cell is | 1023 // Compiles a custom call constant/global IC. For constant calls cell is |
| 1018 // NULL. Returns an empty handle if there is no custom call code for the | 1024 // NULL. Returns an empty handle if there is no custom call code for the |
| 1019 // given function. | 1025 // given function. |
| 1020 Handle<Code> CompileCustomCall(Handle<Object> object, | 1026 Handle<Code> CompileCustomCall(Handle<Object> object, |
| 1021 Handle<JSObject> holder, | 1027 Handle<JSObject> holder, |
| 1022 Handle<JSGlobalPropertyCell> cell, | 1028 Handle<Cell> cell, |
| 1023 Handle<JSFunction> function, | 1029 Handle<JSFunction> function, |
| 1024 Handle<String> name); | 1030 Handle<String> name, |
| 1031 Code::StubType type); |
| 1025 | 1032 |
| 1026 #define DECLARE_CALL_GENERATOR(name) \ | 1033 #define DECLARE_CALL_GENERATOR(name) \ |
| 1027 Handle<Code> Compile##name##Call(Handle<Object> object, \ | 1034 Handle<Code> Compile##name##Call(Handle<Object> object, \ |
| 1028 Handle<JSObject> holder, \ | 1035 Handle<JSObject> holder, \ |
| 1029 Handle<JSGlobalPropertyCell> cell, \ | 1036 Handle<Cell> cell, \ |
| 1030 Handle<JSFunction> function, \ | 1037 Handle<JSFunction> function, \ |
| 1031 Handle<String> fname); | 1038 Handle<String> fname, \ |
| 1039 Code::StubType type); |
| 1032 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 1040 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) |
| 1033 #undef DECLARE_CALL_GENERATOR | 1041 #undef DECLARE_CALL_GENERATOR |
| 1034 | 1042 |
| 1035 Handle<Code> CompileFastApiCall(const CallOptimization& optimization, | 1043 Handle<Code> CompileFastApiCall(const CallOptimization& optimization, |
| 1036 Handle<Object> object, | 1044 Handle<Object> object, |
| 1037 Handle<JSObject> holder, | 1045 Handle<JSObject> holder, |
| 1038 Handle<JSGlobalPropertyCell> cell, | 1046 Handle<Cell> cell, |
| 1039 Handle<JSFunction> function, | 1047 Handle<JSFunction> function, |
| 1040 Handle<String> name); | 1048 Handle<String> name); |
| 1041 | 1049 |
| 1042 Handle<Code> GetCode(Code::StubType type, Handle<Name> name); | 1050 Handle<Code> GetCode(Code::StubType type, Handle<Name> name); |
| 1043 Handle<Code> GetCode(Handle<JSFunction> function); | 1051 Handle<Code> GetCode(Handle<JSFunction> function); |
| 1044 | 1052 |
| 1045 const ParameterCount& arguments() { return arguments_; } | 1053 const ParameterCount& arguments() { return arguments_; } |
| 1046 | 1054 |
| 1047 void GenerateNameCheck(Handle<Name> name, Label* miss); | 1055 void GenerateNameCheck(Handle<Name> name, Label* miss); |
| 1048 | 1056 |
| 1049 void GenerateGlobalReceiverCheck(Handle<JSObject> object, | 1057 void GenerateGlobalReceiverCheck(Handle<JSObject> object, |
| 1050 Handle<JSObject> holder, | 1058 Handle<JSObject> holder, |
| 1051 Handle<Name> name, | 1059 Handle<Name> name, |
| 1052 Label* miss); | 1060 Label* miss); |
| 1053 | 1061 |
| 1054 // Generates code to load the function from the cell checking that | 1062 // Generates code to load the function from the cell checking that |
| 1055 // it still contains the same function. | 1063 // it still contains the same function. |
| 1056 void GenerateLoadFunctionFromCell(Handle<JSGlobalPropertyCell> cell, | 1064 void GenerateLoadFunctionFromCell(Handle<Cell> cell, |
| 1057 Handle<JSFunction> function, | 1065 Handle<JSFunction> function, |
| 1058 Label* miss); | 1066 Label* miss); |
| 1059 | 1067 |
| 1060 // Generates a jump to CallIC miss stub. | 1068 // Generates a jump to CallIC miss stub. |
| 1061 void GenerateMissBranch(); | 1069 void GenerateMissBranch(); |
| 1062 | 1070 |
| 1063 const ParameterCount arguments_; | 1071 const ParameterCount arguments_; |
| 1064 const Code::Kind kind_; | 1072 const Code::Kind kind_; |
| 1065 const Code::ExtraICState extra_state_; | 1073 const Code::ExtraICState extra_state_; |
| 1066 const InlineCacheHolderFlag cache_holder_; | 1074 const InlineCacheHolderFlag cache_holder_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 Handle<JSFunction> constant_function_; | 1120 Handle<JSFunction> constant_function_; |
| 1113 bool is_simple_api_call_; | 1121 bool is_simple_api_call_; |
| 1114 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1122 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1115 Handle<CallHandlerInfo> api_call_info_; | 1123 Handle<CallHandlerInfo> api_call_info_; |
| 1116 }; | 1124 }; |
| 1117 | 1125 |
| 1118 | 1126 |
| 1119 } } // namespace v8::internal | 1127 } } // namespace v8::internal |
| 1120 | 1128 |
| 1121 #endif // V8_STUB_CACHE_H_ | 1129 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |