OLD | NEW |
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 }; | 216 }; |
217 | 217 |
218 | 218 |
219 class LoadIC: public IC { | 219 class LoadIC: public IC { |
220 public: | 220 public: |
221 LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); } | 221 LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); } |
222 | 222 |
223 Object* Load(State state, Handle<Object> object, Handle<String> name); | 223 Object* Load(State state, Handle<Object> object, Handle<String> name); |
224 | 224 |
225 // Code generator routines. | 225 // Code generator routines. |
226 static void GenerateInitialize(MacroAssembler* masm); | 226 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
227 static void GeneratePreMonomorphic(MacroAssembler* masm); | 227 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 228 GenerateMiss(masm); |
| 229 } |
228 static void GenerateMiss(MacroAssembler* masm); | 230 static void GenerateMiss(MacroAssembler* masm); |
229 static void GenerateMegamorphic(MacroAssembler* masm); | 231 static void GenerateMegamorphic(MacroAssembler* masm); |
230 static void GenerateNormal(MacroAssembler* masm); | 232 static void GenerateNormal(MacroAssembler* masm); |
231 | 233 |
232 // Specialized code generator routines. | 234 // Specialized code generator routines. |
233 static void GenerateArrayLength(MacroAssembler* masm); | 235 static void GenerateArrayLength(MacroAssembler* masm); |
234 static void GenerateStringLength(MacroAssembler* masm); | 236 static void GenerateStringLength(MacroAssembler* masm); |
235 static void GenerateFunctionPrototype(MacroAssembler* masm); | 237 static void GenerateFunctionPrototype(MacroAssembler* masm); |
236 | 238 |
237 // The offset from the inlined patch site to the start of the | 239 // The offset from the inlined patch site to the start of the |
238 // inlined load instruction. It is architecture-dependent, and not | 240 // inlined load instruction. It is architecture-dependent, and not |
239 // used on ARM. | 241 // used on ARM. |
240 static const int kOffsetToLoadInstruction; | 242 static const int kOffsetToLoadInstruction; |
241 | 243 |
242 private: | 244 private: |
243 static void Generate(MacroAssembler* masm, const ExternalReference& f); | |
244 | |
245 // Update the inline cache and the global stub cache based on the | 245 // Update the inline cache and the global stub cache based on the |
246 // lookup result. | 246 // lookup result. |
247 void UpdateCaches(LookupResult* lookup, | 247 void UpdateCaches(LookupResult* lookup, |
248 State state, | 248 State state, |
249 Handle<Object> object, | 249 Handle<Object> object, |
250 Handle<String> name); | 250 Handle<String> name); |
251 | 251 |
252 // Stub accessors. | 252 // Stub accessors. |
253 static Code* megamorphic_stub() { | 253 static Code* megamorphic_stub() { |
254 return Builtins::builtin(Builtins::LoadIC_Megamorphic); | 254 return Builtins::builtin(Builtins::LoadIC_Megamorphic); |
(...skipping 17 matching lines...) Expand all Loading... |
272 | 272 |
273 | 273 |
274 class KeyedLoadIC: public IC { | 274 class KeyedLoadIC: public IC { |
275 public: | 275 public: |
276 KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); } | 276 KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); } |
277 | 277 |
278 Object* Load(State state, Handle<Object> object, Handle<Object> key); | 278 Object* Load(State state, Handle<Object> object, Handle<Object> key); |
279 | 279 |
280 // Code generator routines. | 280 // Code generator routines. |
281 static void GenerateMiss(MacroAssembler* masm); | 281 static void GenerateMiss(MacroAssembler* masm); |
282 static void GenerateInitialize(MacroAssembler* masm); | 282 static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
283 static void GeneratePreMonomorphic(MacroAssembler* masm); | 283 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 284 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 285 GenerateMiss(masm); |
| 286 } |
284 static void GenerateGeneric(MacroAssembler* masm); | 287 static void GenerateGeneric(MacroAssembler* masm); |
285 static void GenerateString(MacroAssembler* masm); | 288 static void GenerateString(MacroAssembler* masm); |
286 | 289 |
287 // Generators for external array types. See objects.h. | 290 // Generators for external array types. See objects.h. |
288 // These are similar to the generic IC; they optimize the case of | 291 // These are similar to the generic IC; they optimize the case of |
289 // operating upon external array types but fall back to the runtime | 292 // operating upon external array types but fall back to the runtime |
290 // for all other types. | 293 // for all other types. |
291 static void GenerateExternalArray(MacroAssembler* masm, | 294 static void GenerateExternalArray(MacroAssembler* masm, |
292 ExternalArrayType array_type); | 295 ExternalArrayType array_type); |
293 | 296 |
294 // Clear the use of the inlined version. | 297 // Clear the use of the inlined version. |
295 static void ClearInlinedVersion(Address address); | 298 static void ClearInlinedVersion(Address address); |
296 | 299 |
297 private: | 300 private: |
298 // Bit mask to be tested against bit field for the cases when | 301 // Bit mask to be tested against bit field for the cases when |
299 // generic stub should go into slow case. | 302 // generic stub should go into slow case. |
300 // Access check is necessary explicitly since generic stub does not perform | 303 // Access check is necessary explicitly since generic stub does not perform |
301 // map checks. | 304 // map checks. |
302 static const int kSlowCaseBitFieldMask = | 305 static const int kSlowCaseBitFieldMask = |
303 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); | 306 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); |
304 | 307 |
305 static void Generate(MacroAssembler* masm, const ExternalReference& f); | |
306 | |
307 // Update the inline cache. | 308 // Update the inline cache. |
308 void UpdateCaches(LookupResult* lookup, | 309 void UpdateCaches(LookupResult* lookup, |
309 State state, | 310 State state, |
310 Handle<Object> object, | 311 Handle<Object> object, |
311 Handle<String> name); | 312 Handle<String> name); |
312 | 313 |
313 // Stub accessors. | 314 // Stub accessors. |
314 static Code* initialize_stub() { | 315 static Code* initialize_stub() { |
315 return Builtins::builtin(Builtins::KeyedLoadIC_Initialize); | 316 return Builtins::builtin(Builtins::KeyedLoadIC_Initialize); |
316 } | 317 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 class KeyedStoreIC: public IC { | 378 class KeyedStoreIC: public IC { |
378 public: | 379 public: |
379 KeyedStoreIC() : IC(NO_EXTRA_FRAME) { } | 380 KeyedStoreIC() : IC(NO_EXTRA_FRAME) { } |
380 | 381 |
381 Object* Store(State state, | 382 Object* Store(State state, |
382 Handle<Object> object, | 383 Handle<Object> object, |
383 Handle<Object> name, | 384 Handle<Object> name, |
384 Handle<Object> value); | 385 Handle<Object> value); |
385 | 386 |
386 // Code generators for stub routines. Only called once at startup. | 387 // Code generators for stub routines. Only called once at startup. |
387 static void GenerateInitialize(MacroAssembler* masm); | 388 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
388 static void GenerateMiss(MacroAssembler* masm); | 389 static void GenerateMiss(MacroAssembler* masm); |
| 390 static void GenerateRuntimeSetProperty(MacroAssembler* masm); |
389 static void GenerateGeneric(MacroAssembler* masm); | 391 static void GenerateGeneric(MacroAssembler* masm); |
390 static void GenerateExtendStorage(MacroAssembler* masm); | 392 static void GenerateExtendStorage(MacroAssembler* masm); |
391 | 393 |
392 // Generators for external array types. See objects.h. | 394 // Generators for external array types. See objects.h. |
393 // These are similar to the generic IC; they optimize the case of | 395 // These are similar to the generic IC; they optimize the case of |
394 // operating upon external array types but fall back to the runtime | 396 // operating upon external array types but fall back to the runtime |
395 // for all other types. | 397 // for all other types. |
396 static void GenerateExternalArray(MacroAssembler* masm, | 398 static void GenerateExternalArray(MacroAssembler* masm, |
397 ExternalArrayType array_type); | 399 ExternalArrayType array_type); |
398 | 400 |
399 // Clear the inlined version so the IC is always hit. | 401 // Clear the inlined version so the IC is always hit. |
400 static void ClearInlinedVersion(Address address); | 402 static void ClearInlinedVersion(Address address); |
401 | 403 |
402 // Restore the inlined version so the fast case can get hit. | 404 // Restore the inlined version so the fast case can get hit. |
403 static void RestoreInlinedVersion(Address address); | 405 static void RestoreInlinedVersion(Address address); |
404 | 406 |
405 private: | 407 private: |
406 static void Generate(MacroAssembler* masm, const ExternalReference& f); | |
407 | |
408 // Update the inline cache. | 408 // Update the inline cache. |
409 void UpdateCaches(LookupResult* lookup, | 409 void UpdateCaches(LookupResult* lookup, |
410 State state, | 410 State state, |
411 Handle<JSObject> receiver, | 411 Handle<JSObject> receiver, |
412 Handle<String> name, | 412 Handle<String> name, |
413 Handle<Object> value); | 413 Handle<Object> value); |
414 | 414 |
415 // Stub accessors. | 415 // Stub accessors. |
416 static Code* initialize_stub() { | 416 static Code* initialize_stub() { |
417 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize); | 417 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize); |
(...skipping 16 matching lines...) Expand all Loading... |
434 // The map is the new map that the inlined code should check against. | 434 // The map is the new map that the inlined code should check against. |
435 static bool PatchInlinedStore(Address address, Object* map); | 435 static bool PatchInlinedStore(Address address, Object* map); |
436 | 436 |
437 friend class IC; | 437 friend class IC; |
438 }; | 438 }; |
439 | 439 |
440 | 440 |
441 } } // namespace v8::internal | 441 } } // namespace v8::internal |
442 | 442 |
443 #endif // V8_IC_H_ | 443 #endif // V8_IC_H_ |
OLD | NEW |