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

Side by Side Diff: src/ic.h

Issue 2280007: Extend CallIC to support non-constant names.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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/ia32/virtual-frame-ia32.cc ('k') | src/ic.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 26 matching lines...) Expand all
37 // store is in dictionary case. 37 // store is in dictionary case.
38 enum DictionaryCheck { CHECK_DICTIONARY, DICTIONARY_CHECK_DONE }; 38 enum DictionaryCheck { CHECK_DICTIONARY, DICTIONARY_CHECK_DONE };
39 39
40 40
41 // IC_UTIL_LIST defines all utility functions called from generated 41 // IC_UTIL_LIST defines all utility functions called from generated
42 // inline caching code. The argument for the macro, ICU, is the function name. 42 // inline caching code. The argument for the macro, ICU, is the function name.
43 #define IC_UTIL_LIST(ICU) \ 43 #define IC_UTIL_LIST(ICU) \
44 ICU(LoadIC_Miss) \ 44 ICU(LoadIC_Miss) \
45 ICU(KeyedLoadIC_Miss) \ 45 ICU(KeyedLoadIC_Miss) \
46 ICU(CallIC_Miss) \ 46 ICU(CallIC_Miss) \
47 ICU(KeyedCallIC_Miss) \
47 ICU(StoreIC_Miss) \ 48 ICU(StoreIC_Miss) \
48 ICU(StoreIC_ArrayLength) \ 49 ICU(StoreIC_ArrayLength) \
49 ICU(SharedStoreIC_ExtendStorage) \ 50 ICU(SharedStoreIC_ExtendStorage) \
50 ICU(KeyedStoreIC_Miss) \ 51 ICU(KeyedStoreIC_Miss) \
51 /* Utilities for IC stubs. */ \ 52 /* Utilities for IC stubs. */ \
52 ICU(LoadCallbackProperty) \ 53 ICU(LoadCallbackProperty) \
53 ICU(StoreCallbackProperty) \ 54 ICU(StoreCallbackProperty) \
54 ICU(LoadPropertyWithInterceptorOnly) \ 55 ICU(LoadPropertyWithInterceptorOnly) \
55 ICU(LoadPropertyWithInterceptorForLoad) \ 56 ICU(LoadPropertyWithInterceptorForLoad) \
56 ICU(LoadPropertyWithInterceptorForCall) \ 57 ICU(LoadPropertyWithInterceptorForCall) \
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #ifdef DEBUG 141 #ifdef DEBUG
141 static void TraceIC(const char* type, 142 static void TraceIC(const char* type,
142 Handle<String> name, 143 Handle<String> name,
143 State old_state, 144 State old_state,
144 Code* new_target, 145 Code* new_target,
145 const char* extra_info = ""); 146 const char* extra_info = "");
146 #endif 147 #endif
147 148
148 static Failure* TypeError(const char* type, 149 static Failure* TypeError(const char* type,
149 Handle<Object> object, 150 Handle<Object> object,
150 Handle<String> name); 151 Handle<Object> key);
151 static Failure* ReferenceError(const char* type, Handle<String> name); 152 static Failure* ReferenceError(const char* type, Handle<String> name);
152 153
153 // Access the target code for the given IC address. 154 // Access the target code for the given IC address.
154 static inline Code* GetTargetAtAddress(Address address); 155 static inline Code* GetTargetAtAddress(Address address);
155 static inline void SetTargetAtAddress(Address address, Code* target); 156 static inline void SetTargetAtAddress(Address address, Code* target);
156 157
157 private: 158 private:
158 // Frame pointer for the frame that uses (calls) the IC. 159 // Frame pointer for the frame that uses (calls) the IC.
159 Address fp_; 160 Address fp_;
160 161
(...skipping 16 matching lines...) Expand all
177 178
178 Address address() const { return address_; } 179 Address address() const { return address_; }
179 180
180 IC::UtilityId id() const { return id_; } 181 IC::UtilityId id() const { return id_; }
181 private: 182 private:
182 Address address_; 183 Address address_;
183 IC::UtilityId id_; 184 IC::UtilityId id_;
184 }; 185 };
185 186
186 187
187 class CallIC: public IC { 188 class CallICBase: public IC {
189 protected:
190 explicit CallICBase(Code::Kind kind) : IC(EXTRA_CALL_FRAME), kind_(kind) {}
191
188 public: 192 public:
189 CallIC() : IC(EXTRA_CALL_FRAME) { ASSERT(target()->is_call_stub()); }
190
191 Object* LoadFunction(State state, Handle<Object> object, Handle<String> name); 193 Object* LoadFunction(State state, Handle<Object> object, Handle<String> name);
192 194
195 protected:
196 Code::Kind kind_;
193 197
194 // Code generator routines.
195 static void GenerateInitialize(MacroAssembler* masm, int argc) {
196 GenerateMiss(masm, argc);
197 }
198 static void GenerateMiss(MacroAssembler* masm, int argc);
199 static void GenerateMegamorphic(MacroAssembler* masm, int argc);
200 static void GenerateNormal(MacroAssembler* masm, int argc);
201
202 private:
203 // Update the inline cache and the global stub cache based on the 198 // Update the inline cache and the global stub cache based on the
204 // lookup result. 199 // lookup result.
205 void UpdateCaches(LookupResult* lookup, 200 void UpdateCaches(LookupResult* lookup,
206 State state, 201 State state,
207 Handle<Object> object, 202 Handle<Object> object,
208 Handle<String> name); 203 Handle<String> name);
209 204
210 // Returns a JSFunction if the object can be called as a function, 205 // Returns a JSFunction if the object can be called as a function,
211 // and patches the stack to be ready for the call. 206 // and patches the stack to be ready for the call.
212 // Otherwise, it returns the undefined value. 207 // Otherwise, it returns the undefined value.
213 Object* TryCallAsFunction(Object* object); 208 Object* TryCallAsFunction(Object* object);
214 209
215 void ReceiverToObject(Handle<Object> object); 210 void ReceiverToObject(Handle<Object> object);
216 211
217 static void Clear(Address address, Code* target); 212 static void Clear(Address address, Code* target);
218 friend class IC; 213 friend class IC;
219 }; 214 };
220 215
221 216
217 class CallIC: public CallICBase {
218 public:
219 CallIC() : CallICBase(Code::CALL_IC) { ASSERT(target()->is_call_stub()); }
220
221 // Code generator routines.
222 static void GenerateInitialize(MacroAssembler* masm, int argc) {
223 GenerateMiss(masm, argc);
224 }
225 static void GenerateMiss(MacroAssembler* masm, int argc);
226 static void GenerateMegamorphic(MacroAssembler* masm, int argc);
227 static void GenerateNormal(MacroAssembler* masm, int argc);
228 };
229
230
231 class KeyedCallIC: public CallICBase {
232 public:
233 KeyedCallIC() : CallICBase(Code::KEYED_CALL_IC) {
234 ASSERT(target()->is_keyed_call_stub());
235 }
236
237 Object* LoadFunction(State state, Handle<Object> object, Handle<Object> key);
238
239 // Code generator routines.
240 static void GenerateInitialize(MacroAssembler* masm, int argc) {
241 GenerateMiss(masm, argc);
242 }
243 static void GenerateMiss(MacroAssembler* masm, int argc);
244 static void GenerateMegamorphic(MacroAssembler* masm, int argc);
245 static void GenerateNormal(MacroAssembler* masm, int argc);
246 };
247
248
222 class LoadIC: public IC { 249 class LoadIC: public IC {
223 public: 250 public:
224 LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); } 251 LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); }
225 252
226 Object* Load(State state, Handle<Object> object, Handle<String> name); 253 Object* Load(State state, Handle<Object> object, Handle<String> name);
227 254
228 // Code generator routines. 255 // Code generator routines.
229 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 256 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
230 static void GeneratePreMonomorphic(MacroAssembler* masm) { 257 static void GeneratePreMonomorphic(MacroAssembler* masm) {
231 GenerateMiss(masm); 258 GenerateMiss(masm);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 static const char* GetName(TypeInfo type_info); 492 static const char* GetName(TypeInfo type_info);
466 493
467 static State ToState(TypeInfo type_info); 494 static State ToState(TypeInfo type_info);
468 495
469 static TypeInfo GetTypeInfo(Object* left, Object* right); 496 static TypeInfo GetTypeInfo(Object* left, Object* right);
470 }; 497 };
471 498
472 } } // namespace v8::internal 499 } } // namespace v8::internal
473 500
474 #endif // V8_IC_H_ 501 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698