Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: src/stub-cache.h

Issue 23984002: load ics for js api accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 41
42 42
43 // The stub cache is used for megamorphic calls and property accesses. 43 // The stub cache is used for megamorphic calls and property accesses.
44 // It maps (map, name, type)->Code* 44 // It maps (map, name, type)->Code*
45 45
46 // The design of the table uses the inline cache stubs used for 46 // The design of the table uses the inline cache stubs used for
47 // mono-morphic calls. The beauty of this, we do not have to 47 // mono-morphic calls. The beauty of this, we do not have to
48 // invalidate the cache whenever a prototype map is changed. The stub 48 // invalidate the cache whenever a prototype map is changed. The stub
49 // validates the map chain as in the mono-morphic case. 49 // validates the map chain as in the mono-morphic case.
50 50
51
52 class CallOptimization;
51 class SmallMapList; 53 class SmallMapList;
52 class StubCache; 54 class StubCache;
53 55
54 56
55 class SCTableReference { 57 class SCTableReference {
56 public: 58 public:
57 Address address() const { return address_; } 59 Address address() const { return address_; }
58 60
59 private: 61 private:
60 explicit SCTableReference(Address address) : address_(address) {} 62 explicit SCTableReference(Address address) : address_(address) {}
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 Handle<JSObject> object, 131 Handle<JSObject> object,
130 Handle<JSObject> holder, 132 Handle<JSObject> holder,
131 PropertyIndex field_index, 133 PropertyIndex field_index,
132 Representation representation); 134 Representation representation);
133 135
134 Handle<Code> ComputeLoadCallback(Handle<Name> name, 136 Handle<Code> ComputeLoadCallback(Handle<Name> name,
135 Handle<JSObject> object, 137 Handle<JSObject> object,
136 Handle<JSObject> holder, 138 Handle<JSObject> holder,
137 Handle<ExecutableAccessorInfo> callback); 139 Handle<ExecutableAccessorInfo> callback);
138 140
141 Handle<Code> ComputeLoadCallback(Handle<Name> name,
142 Handle<JSObject> object,
143 Handle<JSObject> holder,
144 const CallOptimization& call_optimization);
145
139 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, 146 Handle<Code> ComputeLoadViaGetter(Handle<Name> name,
140 Handle<JSObject> object, 147 Handle<JSObject> object,
141 Handle<JSObject> holder, 148 Handle<JSObject> holder,
142 Handle<JSFunction> getter); 149 Handle<JSFunction> getter);
143 150
144 Handle<Code> ComputeLoadConstant(Handle<Name> name, 151 Handle<Code> ComputeLoadConstant(Handle<Name> name,
145 Handle<JSObject> object, 152 Handle<JSObject> object,
146 Handle<JSObject> holder, 153 Handle<JSObject> holder,
147 Handle<Object> value); 154 Handle<Object> value);
148 155
(...skipping 17 matching lines...) Expand all
166 Handle<JSObject> holder, 173 Handle<JSObject> holder,
167 PropertyIndex field_index, 174 PropertyIndex field_index,
168 Representation representation); 175 Representation representation);
169 176
170 Handle<Code> ComputeKeyedLoadCallback( 177 Handle<Code> ComputeKeyedLoadCallback(
171 Handle<Name> name, 178 Handle<Name> name,
172 Handle<JSObject> object, 179 Handle<JSObject> object,
173 Handle<JSObject> holder, 180 Handle<JSObject> holder,
174 Handle<ExecutableAccessorInfo> callback); 181 Handle<ExecutableAccessorInfo> callback);
175 182
183 Handle<Code> ComputeKeyedLoadCallback(
184 Handle<Name> name,
185 Handle<JSObject> object,
186 Handle<JSObject> holder,
187 const CallOptimization& call_optimization);
188
176 Handle<Code> ComputeKeyedLoadConstant(Handle<Name> name, 189 Handle<Code> ComputeKeyedLoadConstant(Handle<Name> name,
177 Handle<JSObject> object, 190 Handle<JSObject> object,
178 Handle<JSObject> holder, 191 Handle<JSObject> holder,
179 Handle<Object> value); 192 Handle<Object> value);
180 193
181 Handle<Code> ComputeKeyedLoadInterceptor(Handle<Name> name, 194 Handle<Code> ComputeKeyedLoadInterceptor(Handle<Name> name,
182 Handle<JSObject> object, 195 Handle<JSObject> object,
183 Handle<JSObject> holder); 196 Handle<JSObject> holder);
184 197
185 // --- 198 // ---
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 Handle<JSObject> holder, 711 Handle<JSObject> holder,
699 Handle<Name> name, 712 Handle<Name> name,
700 PropertyIndex index, 713 PropertyIndex index,
701 Representation representation); 714 Representation representation);
702 715
703 Handle<Code> CompileLoadCallback(Handle<JSObject> object, 716 Handle<Code> CompileLoadCallback(Handle<JSObject> object,
704 Handle<JSObject> holder, 717 Handle<JSObject> holder,
705 Handle<Name> name, 718 Handle<Name> name,
706 Handle<ExecutableAccessorInfo> callback); 719 Handle<ExecutableAccessorInfo> callback);
707 720
721 Handle<Code> CompileLoadCallback(Handle<JSObject> object,
722 Handle<JSObject> holder,
723 Handle<Name> name,
724 const CallOptimization& call_optimization);
725
708 Handle<Code> CompileLoadConstant(Handle<JSObject> object, 726 Handle<Code> CompileLoadConstant(Handle<JSObject> object,
709 Handle<JSObject> holder, 727 Handle<JSObject> holder,
710 Handle<Name> name, 728 Handle<Name> name,
711 Handle<Object> value); 729 Handle<Object> value);
712 730
713 Handle<Code> CompileLoadInterceptor(Handle<JSObject> object, 731 Handle<Code> CompileLoadInterceptor(Handle<JSObject> object,
714 Handle<JSObject> holder, 732 Handle<JSObject> holder,
715 Handle<Name> name); 733 Handle<Name> name);
716 734
717 protected: 735 protected:
718 virtual Register HandlerFrontendHeader(Handle<JSObject> object, 736 virtual Register HandlerFrontendHeader(Handle<JSObject> object,
719 Register object_reg, 737 Register object_reg,
720 Handle<JSObject> holder, 738 Handle<JSObject> holder,
721 Handle<Name> name, 739 Handle<Name> name,
722 Label* miss); 740 Label* miss);
723 741
724 virtual void HandlerFrontendFooter(Handle<Name> name, 742 virtual void HandlerFrontendFooter(Handle<Name> name,
725 Label* success, 743 Label* success,
726 Label* miss); 744 Label* miss);
727 745
728 Register CallbackHandlerFrontend(Handle<JSObject> object, 746 Register CallbackHandlerFrontend(Handle<JSObject> object,
729 Register object_reg, 747 Register object_reg,
730 Handle<JSObject> holder, 748 Handle<JSObject> holder,
731 Handle<Name> name, 749 Handle<Name> name,
732 Label* success, 750 Label* success,
733 Handle<ExecutableAccessorInfo> callback); 751 Handle<Object> callback);
734 void NonexistentHandlerFrontend(Handle<JSObject> object, 752 void NonexistentHandlerFrontend(Handle<JSObject> object,
735 Handle<JSObject> last, 753 Handle<JSObject> last,
736 Handle<Name> name, 754 Handle<Name> name,
737 Label* success, 755 Label* success,
738 Handle<GlobalObject> global); 756 Handle<GlobalObject> global);
739 757
740 void GenerateLoadField(Register reg, 758 void GenerateLoadField(Register reg,
741 Handle<JSObject> holder, 759 Handle<JSObject> holder,
742 PropertyIndex field, 760 PropertyIndex field,
743 Representation representation); 761 Representation representation);
744 void GenerateLoadConstant(Handle<Object> value); 762 void GenerateLoadConstant(Handle<Object> value);
745 void GenerateLoadCallback(Register reg, 763 void GenerateLoadCallback(Register reg,
746 Handle<ExecutableAccessorInfo> callback); 764 Handle<ExecutableAccessorInfo> callback);
765 void GenerateLoadCallback(const CallOptimization& call_optimization);
747 void GenerateLoadInterceptor(Register holder_reg, 766 void GenerateLoadInterceptor(Register holder_reg,
748 Handle<JSObject> object, 767 Handle<JSObject> object,
749 Handle<JSObject> holder, 768 Handle<JSObject> holder,
750 LookupResult* lookup, 769 LookupResult* lookup,
751 Handle<Name> name); 770 Handle<Name> name);
752 void GenerateLoadPostInterceptor(Register reg, 771 void GenerateLoadPostInterceptor(Register reg,
753 Handle<JSObject> interceptor_holder, 772 Handle<JSObject> interceptor_holder,
754 Handle<Name> name, 773 Handle<Name> name,
755 LookupResult* lookup); 774 LookupResult* lookup);
756 775
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 V(StringFromCharCode) \ 1040 V(StringFromCharCode) \
1022 V(MathFloor) \ 1041 V(MathFloor) \
1023 V(MathAbs) \ 1042 V(MathAbs) \
1024 V(ArrayCode) 1043 V(ArrayCode)
1025 1044
1026 1045
1027 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ 1046 #define SITE_SPECIFIC_CALL_GENERATORS(V) \
1028 V(ArrayCode) 1047 V(ArrayCode)
1029 1048
1030 1049
1031 class CallOptimization;
1032
1033 class CallStubCompiler: public StubCompiler { 1050 class CallStubCompiler: public StubCompiler {
1034 public: 1051 public:
1035 CallStubCompiler(Isolate* isolate, 1052 CallStubCompiler(Isolate* isolate,
1036 int argc, 1053 int argc,
1037 Code::Kind kind, 1054 Code::Kind kind,
1038 Code::ExtraICState extra_state, 1055 Code::ExtraICState extra_state,
1039 InlineCacheHolderFlag cache_holder); 1056 InlineCacheHolderFlag cache_holder);
1040 1057
1041 Handle<Code> CompileCallField(Handle<JSObject> object, 1058 Handle<Code> CompileCallField(Handle<JSObject> object,
1042 Handle<JSObject> holder, 1059 Handle<JSObject> holder,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 Handle<CallHandlerInfo> api_call_info() const { 1171 Handle<CallHandlerInfo> api_call_info() const {
1155 ASSERT(is_simple_api_call()); 1172 ASSERT(is_simple_api_call());
1156 return api_call_info_; 1173 return api_call_info_;
1157 } 1174 }
1158 1175
1159 // Returns the depth of the object having the expected type in the 1176 // Returns the depth of the object having the expected type in the
1160 // prototype chain between the two arguments. 1177 // prototype chain between the two arguments.
1161 int GetPrototypeDepthOfExpectedType(Handle<JSObject> object, 1178 int GetPrototypeDepthOfExpectedType(Handle<JSObject> object,
1162 Handle<JSObject> holder) const; 1179 Handle<JSObject> holder) const;
1163 1180
1181 bool IsCompatibleReceiver(Object* receiver) {
1182 ASSERT(is_simple_api_call());
1183 if (expected_receiver_type_.is_null()) return true;
1184 return receiver->IsInstanceOf(*expected_receiver_type_);
1185 }
1186
1164 private: 1187 private:
1165 void Initialize(Handle<JSFunction> function); 1188 void Initialize(Handle<JSFunction> function);
1166 1189
1167 // Determines whether the given function can be called using the 1190 // Determines whether the given function can be called using the
1168 // fast api call builtin. 1191 // fast api call builtin.
1169 void AnalyzePossibleApiFunction(Handle<JSFunction> function); 1192 void AnalyzePossibleApiFunction(Handle<JSFunction> function);
1170 1193
1171 Handle<JSFunction> constant_function_; 1194 Handle<JSFunction> constant_function_;
1172 bool is_simple_api_call_; 1195 bool is_simple_api_call_;
1173 Handle<FunctionTemplateInfo> expected_receiver_type_; 1196 Handle<FunctionTemplateInfo> expected_receiver_type_;
1174 Handle<CallHandlerInfo> api_call_info_; 1197 Handle<CallHandlerInfo> api_call_info_;
1175 }; 1198 };
1176 1199
1177 1200
1178 } } // namespace v8::internal 1201 } } // namespace v8::internal
1179 1202
1180 #endif // V8_STUB_CACHE_H_ 1203 #endif // V8_STUB_CACHE_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698