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

Side by Side Diff: src/ic.h

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 10 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 27 matching lines...) Expand all
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(StoreIC_Miss) \ 47 ICU(StoreIC_Miss) \
48 ICU(StoreIC_ArrayLength) \
48 ICU(SharedStoreIC_ExtendStorage) \ 49 ICU(SharedStoreIC_ExtendStorage) \
49 ICU(KeyedStoreIC_Miss) \ 50 ICU(KeyedStoreIC_Miss) \
50 /* Utilities for IC stubs. */ \ 51 /* Utilities for IC stubs. */ \
51 ICU(LoadCallbackProperty) \ 52 ICU(LoadCallbackProperty) \
52 ICU(StoreCallbackProperty) \ 53 ICU(StoreCallbackProperty) \
53 ICU(LoadPropertyWithInterceptorOnly) \ 54 ICU(LoadPropertyWithInterceptorOnly) \
54 ICU(LoadPropertyWithInterceptorForLoad) \ 55 ICU(LoadPropertyWithInterceptorForLoad) \
55 ICU(LoadPropertyWithInterceptorForCall) \ 56 ICU(LoadPropertyWithInterceptorForCall) \
57 ICU(KeyedLoadPropertyWithInterceptor) \
56 ICU(StoreInterceptorProperty) 58 ICU(StoreInterceptorProperty)
57 59
58 // 60 //
59 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC, 61 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC,
60 // and KeyedStoreIC. 62 // and KeyedStoreIC.
61 // 63 //
62 class IC { 64 class IC {
63 public: 65 public:
64 66
65 // The ids for utility called from the generated code. 67 // The ids for utility called from the generated code.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 }; 218 };
217 219
218 220
219 class LoadIC: public IC { 221 class LoadIC: public IC {
220 public: 222 public:
221 LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); } 223 LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); }
222 224
223 Object* Load(State state, Handle<Object> object, Handle<String> name); 225 Object* Load(State state, Handle<Object> object, Handle<String> name);
224 226
225 // Code generator routines. 227 // Code generator routines.
226 static void GenerateInitialize(MacroAssembler* masm); 228 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
227 static void GeneratePreMonomorphic(MacroAssembler* masm); 229 static void GeneratePreMonomorphic(MacroAssembler* masm) {
230 GenerateMiss(masm);
231 }
228 static void GenerateMiss(MacroAssembler* masm); 232 static void GenerateMiss(MacroAssembler* masm);
229 static void GenerateMegamorphic(MacroAssembler* masm); 233 static void GenerateMegamorphic(MacroAssembler* masm);
230 static void GenerateNormal(MacroAssembler* masm); 234 static void GenerateNormal(MacroAssembler* masm);
231 235
232 // Specialized code generator routines. 236 // Specialized code generator routines.
233 static void GenerateArrayLength(MacroAssembler* masm); 237 static void GenerateArrayLength(MacroAssembler* masm);
234 static void GenerateStringLength(MacroAssembler* masm); 238 static void GenerateStringLength(MacroAssembler* masm);
235 static void GenerateFunctionPrototype(MacroAssembler* masm); 239 static void GenerateFunctionPrototype(MacroAssembler* masm);
236 240
237 // The offset from the inlined patch site to the start of the 241 // The offset from the inlined patch site to the start of the
238 // inlined load instruction. It is architecture-dependent, and not 242 // inlined load instruction. It is architecture-dependent, and not
239 // used on ARM. 243 // used on ARM.
240 static const int kOffsetToLoadInstruction; 244 static const int kOffsetToLoadInstruction;
241 245
242 private: 246 private:
243 static void Generate(MacroAssembler* masm, const ExternalReference& f);
244
245 // Update the inline cache and the global stub cache based on the 247 // Update the inline cache and the global stub cache based on the
246 // lookup result. 248 // lookup result.
247 void UpdateCaches(LookupResult* lookup, 249 void UpdateCaches(LookupResult* lookup,
248 State state, 250 State state,
249 Handle<Object> object, 251 Handle<Object> object,
250 Handle<String> name); 252 Handle<String> name);
251 253
252 // Stub accessors. 254 // Stub accessors.
253 static Code* megamorphic_stub() { 255 static Code* megamorphic_stub() {
254 return Builtins::builtin(Builtins::LoadIC_Megamorphic); 256 return Builtins::builtin(Builtins::LoadIC_Megamorphic);
(...skipping 17 matching lines...) Expand all
272 274
273 275
274 class KeyedLoadIC: public IC { 276 class KeyedLoadIC: public IC {
275 public: 277 public:
276 KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); } 278 KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); }
277 279
278 Object* Load(State state, Handle<Object> object, Handle<Object> key); 280 Object* Load(State state, Handle<Object> object, Handle<Object> key);
279 281
280 // Code generator routines. 282 // Code generator routines.
281 static void GenerateMiss(MacroAssembler* masm); 283 static void GenerateMiss(MacroAssembler* masm);
282 static void GenerateInitialize(MacroAssembler* masm); 284 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
283 static void GeneratePreMonomorphic(MacroAssembler* masm); 285 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
286 static void GeneratePreMonomorphic(MacroAssembler* masm) {
287 GenerateMiss(masm);
288 }
284 static void GenerateGeneric(MacroAssembler* masm); 289 static void GenerateGeneric(MacroAssembler* masm);
285 static void GenerateString(MacroAssembler* masm); 290 static void GenerateString(MacroAssembler* masm);
286 291
287 // Generators for external array types. See objects.h. 292 // Generators for external array types. See objects.h.
288 // These are similar to the generic IC; they optimize the case of 293 // These are similar to the generic IC; they optimize the case of
289 // operating upon external array types but fall back to the runtime 294 // operating upon external array types but fall back to the runtime
290 // for all other types. 295 // for all other types.
291 static void GenerateExternalArray(MacroAssembler* masm, 296 static void GenerateExternalArray(MacroAssembler* masm,
292 ExternalArrayType array_type); 297 ExternalArrayType array_type);
298 static void GenerateIndexedInterceptor(MacroAssembler* masm);
293 299
294 // Clear the use of the inlined version. 300 // Clear the use of the inlined version.
295 static void ClearInlinedVersion(Address address); 301 static void ClearInlinedVersion(Address address);
296 302
297 private: 303 private:
298 // Bit mask to be tested against bit field for the cases when 304 // Bit mask to be tested against bit field for the cases when
299 // generic stub should go into slow case. 305 // generic stub should go into slow case.
300 // Access check is necessary explicitly since generic stub does not perform 306 // Access check is necessary explicitly since generic stub does not perform
301 // map checks. 307 // map checks.
302 static const int kSlowCaseBitFieldMask = 308 static const int kSlowCaseBitFieldMask =
303 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 309 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
304 310
305 static void Generate(MacroAssembler* masm, const ExternalReference& f);
306
307 // Update the inline cache. 311 // Update the inline cache.
308 void UpdateCaches(LookupResult* lookup, 312 void UpdateCaches(LookupResult* lookup,
309 State state, 313 State state,
310 Handle<Object> object, 314 Handle<Object> object,
311 Handle<String> name); 315 Handle<String> name);
312 316
313 // Stub accessors. 317 // Stub accessors.
314 static Code* initialize_stub() { 318 static Code* initialize_stub() {
315 return Builtins::builtin(Builtins::KeyedLoadIC_Initialize); 319 return Builtins::builtin(Builtins::KeyedLoadIC_Initialize);
316 } 320 }
317 static Code* megamorphic_stub() { 321 static Code* megamorphic_stub() {
318 return Builtins::builtin(Builtins::KeyedLoadIC_Generic); 322 return Builtins::builtin(Builtins::KeyedLoadIC_Generic);
319 } 323 }
320 static Code* generic_stub() { 324 static Code* generic_stub() {
321 return Builtins::builtin(Builtins::KeyedLoadIC_Generic); 325 return Builtins::builtin(Builtins::KeyedLoadIC_Generic);
322 } 326 }
323 static Code* pre_monomorphic_stub() { 327 static Code* pre_monomorphic_stub() {
324 return Builtins::builtin(Builtins::KeyedLoadIC_PreMonomorphic); 328 return Builtins::builtin(Builtins::KeyedLoadIC_PreMonomorphic);
325 } 329 }
326 static Code* string_stub() { 330 static Code* string_stub() {
327 return Builtins::builtin(Builtins::KeyedLoadIC_String); 331 return Builtins::builtin(Builtins::KeyedLoadIC_String);
328 } 332 }
329 static Code* external_array_stub(JSObject::ElementsKind elements_kind); 333 static Code* external_array_stub(JSObject::ElementsKind elements_kind);
330 334
335 static Code* indexed_interceptor_stub() {
336 return Builtins::builtin(Builtins::KeyedLoadIC_IndexedInterceptor);
337 }
338
331 static void Clear(Address address, Code* target); 339 static void Clear(Address address, Code* target);
332 340
333 // Support for patching the map that is checked in an inlined 341 // Support for patching the map that is checked in an inlined
334 // version of keyed load. 342 // version of keyed load.
335 static bool PatchInlinedLoad(Address address, Object* map); 343 static bool PatchInlinedLoad(Address address, Object* map);
336 344
337 friend class IC; 345 friend class IC;
338 }; 346 };
339 347
340 348
341 class StoreIC: public IC { 349 class StoreIC: public IC {
342 public: 350 public:
343 StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); } 351 StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); }
344 352
345 Object* Store(State state, 353 Object* Store(State state,
346 Handle<Object> object, 354 Handle<Object> object,
347 Handle<String> name, 355 Handle<String> name,
348 Handle<Object> value); 356 Handle<Object> value);
349 357
350 // Code generators for stub routines. Only called once at startup. 358 // Code generators for stub routines. Only called once at startup.
351 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 359 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
352 static void GenerateMiss(MacroAssembler* masm); 360 static void GenerateMiss(MacroAssembler* masm);
353 static void GenerateMegamorphic(MacroAssembler* masm); 361 static void GenerateMegamorphic(MacroAssembler* masm);
354 static void GenerateExtendStorage(MacroAssembler* masm); 362 static void GenerateArrayLength(MacroAssembler* masm);
355 363
356 private: 364 private:
357 // Update the inline cache and the global stub cache based on the 365 // Update the inline cache and the global stub cache based on the
358 // lookup result. 366 // lookup result.
359 void UpdateCaches(LookupResult* lookup, 367 void UpdateCaches(LookupResult* lookup,
360 State state, Handle<JSObject> receiver, 368 State state, Handle<JSObject> receiver,
361 Handle<String> name, 369 Handle<String> name,
362 Handle<Object> value); 370 Handle<Object> value);
363 371
364 // Stub accessors. 372 // Stub accessors.
(...skipping 12 matching lines...) Expand all
377 class KeyedStoreIC: public IC { 385 class KeyedStoreIC: public IC {
378 public: 386 public:
379 KeyedStoreIC() : IC(NO_EXTRA_FRAME) { } 387 KeyedStoreIC() : IC(NO_EXTRA_FRAME) { }
380 388
381 Object* Store(State state, 389 Object* Store(State state,
382 Handle<Object> object, 390 Handle<Object> object,
383 Handle<Object> name, 391 Handle<Object> name,
384 Handle<Object> value); 392 Handle<Object> value);
385 393
386 // Code generators for stub routines. Only called once at startup. 394 // Code generators for stub routines. Only called once at startup.
387 static void GenerateInitialize(MacroAssembler* masm); 395 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
388 static void GenerateMiss(MacroAssembler* masm); 396 static void GenerateMiss(MacroAssembler* masm);
397 static void GenerateRuntimeSetProperty(MacroAssembler* masm);
389 static void GenerateGeneric(MacroAssembler* masm); 398 static void GenerateGeneric(MacroAssembler* masm);
390 static void GenerateExtendStorage(MacroAssembler* masm);
391 399
392 // Generators for external array types. See objects.h. 400 // Generators for external array types. See objects.h.
393 // These are similar to the generic IC; they optimize the case of 401 // These are similar to the generic IC; they optimize the case of
394 // operating upon external array types but fall back to the runtime 402 // operating upon external array types but fall back to the runtime
395 // for all other types. 403 // for all other types.
396 static void GenerateExternalArray(MacroAssembler* masm, 404 static void GenerateExternalArray(MacroAssembler* masm,
397 ExternalArrayType array_type); 405 ExternalArrayType array_type);
398 406
399 // Clear the inlined version so the IC is always hit. 407 // Clear the inlined version so the IC is always hit.
400 static void ClearInlinedVersion(Address address); 408 static void ClearInlinedVersion(Address address);
401 409
402 // Restore the inlined version so the fast case can get hit. 410 // Restore the inlined version so the fast case can get hit.
403 static void RestoreInlinedVersion(Address address); 411 static void RestoreInlinedVersion(Address address);
404 412
405 private: 413 private:
406 static void Generate(MacroAssembler* masm, const ExternalReference& f);
407
408 // Update the inline cache. 414 // Update the inline cache.
409 void UpdateCaches(LookupResult* lookup, 415 void UpdateCaches(LookupResult* lookup,
410 State state, 416 State state,
411 Handle<JSObject> receiver, 417 Handle<JSObject> receiver,
412 Handle<String> name, 418 Handle<String> name,
413 Handle<Object> value); 419 Handle<Object> value);
414 420
415 // Stub accessors. 421 // Stub accessors.
416 static Code* initialize_stub() { 422 static Code* initialize_stub() {
417 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize); 423 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize);
(...skipping 16 matching lines...) Expand all
434 // The map is the new map that the inlined code should check against. 440 // The map is the new map that the inlined code should check against.
435 static bool PatchInlinedStore(Address address, Object* map); 441 static bool PatchInlinedStore(Address address, Object* map);
436 442
437 friend class IC; 443 friend class IC;
438 }; 444 };
439 445
440 446
441 } } // namespace v8::internal 447 } } // namespace v8::internal
442 448
443 #endif // V8_IC_H_ 449 #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