| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 | 192 |
| 193 class CallICBase: public IC { | 193 class CallICBase: public IC { |
| 194 protected: | 194 protected: |
| 195 CallICBase(Code::Kind kind, Isolate* isolate) | 195 CallICBase(Code::Kind kind, Isolate* isolate) |
| 196 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} | 196 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} |
| 197 | 197 |
| 198 public: | 198 public: |
| 199 MUST_USE_RESULT MaybeObject* LoadFunction(State state, | 199 MUST_USE_RESULT MaybeObject* LoadFunction(State state, |
| 200 Code::ExtraICState extra_ic_state, |
| 200 Handle<Object> object, | 201 Handle<Object> object, |
| 201 Handle<String> name); | 202 Handle<String> name); |
| 202 | 203 |
| 203 protected: | 204 protected: |
| 204 Code::Kind kind_; | 205 Code::Kind kind_; |
| 205 | 206 |
| 207 bool TryUpdateExtraICState(LookupResult* lookup, |
| 208 Handle<Object> object, |
| 209 Code::ExtraICState* extra_ic_state); |
| 210 |
| 211 MUST_USE_RESULT MaybeObject* ComputeMonomorphicStub( |
| 212 LookupResult* lookup, |
| 213 State state, |
| 214 Code::ExtraICState extra_ic_state, |
| 215 Handle<Object> object, |
| 216 Handle<String> name); |
| 217 |
| 206 // Update the inline cache and the global stub cache based on the | 218 // Update the inline cache and the global stub cache based on the |
| 207 // lookup result. | 219 // lookup result. |
| 208 void UpdateCaches(LookupResult* lookup, | 220 void UpdateCaches(LookupResult* lookup, |
| 209 State state, | 221 State state, |
| 222 Code::ExtraICState extra_ic_state, |
| 210 Handle<Object> object, | 223 Handle<Object> object, |
| 211 Handle<String> name); | 224 Handle<String> name); |
| 212 | 225 |
| 213 // Returns a JSFunction if the object can be called as a function, | 226 // Returns a JSFunction if the object can be called as a function, |
| 214 // and patches the stack to be ready for the call. | 227 // and patches the stack to be ready for the call. |
| 215 // Otherwise, it returns the undefined value. | 228 // Otherwise, it returns the undefined value. |
| 216 Object* TryCallAsFunction(Object* object); | 229 Object* TryCallAsFunction(Object* object); |
| 217 | 230 |
| 218 void ReceiverToObject(Handle<Object> object); | 231 void ReceiverToObject(Handle<Object> object); |
| 219 | 232 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 286 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 274 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 287 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 275 GenerateMiss(masm); | 288 GenerateMiss(masm); |
| 276 } | 289 } |
| 277 static void GenerateMiss(MacroAssembler* masm); | 290 static void GenerateMiss(MacroAssembler* masm); |
| 278 static void GenerateMegamorphic(MacroAssembler* masm); | 291 static void GenerateMegamorphic(MacroAssembler* masm); |
| 279 static void GenerateNormal(MacroAssembler* masm); | 292 static void GenerateNormal(MacroAssembler* masm); |
| 280 | 293 |
| 281 // Specialized code generator routines. | 294 // Specialized code generator routines. |
| 282 static void GenerateArrayLength(MacroAssembler* masm); | 295 static void GenerateArrayLength(MacroAssembler* masm); |
| 283 static void GenerateStringLength(MacroAssembler* masm); | 296 static void GenerateStringLength(MacroAssembler* masm, |
| 297 bool support_wrappers); |
| 284 static void GenerateFunctionPrototype(MacroAssembler* masm); | 298 static void GenerateFunctionPrototype(MacroAssembler* masm); |
| 285 | 299 |
| 286 // Clear the use of the inlined version. | 300 // Clear the use of the inlined version. |
| 287 static void ClearInlinedVersion(Address address); | 301 static void ClearInlinedVersion(Address address); |
| 288 | 302 |
| 289 // The offset from the inlined patch site to the start of the | 303 // The offset from the inlined patch site to the start of the |
| 290 // inlined load instruction. It is architecture-dependent, and not | 304 // inlined load instruction. It is architecture-dependent, and not |
| 291 // used on ARM. | 305 // used on ARM. |
| 292 static const int kOffsetToLoadInstruction; | 306 static const int kOffsetToLoadInstruction; |
| 293 | 307 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // Code generator routines. | 353 // Code generator routines. |
| 340 static void GenerateMiss(MacroAssembler* masm); | 354 static void GenerateMiss(MacroAssembler* masm); |
| 341 static void GenerateRuntimeGetProperty(MacroAssembler* masm); | 355 static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
| 342 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 356 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 343 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 357 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 344 GenerateMiss(masm); | 358 GenerateMiss(masm); |
| 345 } | 359 } |
| 346 static void GenerateGeneric(MacroAssembler* masm); | 360 static void GenerateGeneric(MacroAssembler* masm); |
| 347 static void GenerateString(MacroAssembler* masm); | 361 static void GenerateString(MacroAssembler* masm); |
| 348 | 362 |
| 349 // Generators for external array types. See objects.h. | |
| 350 // These are similar to the generic IC; they optimize the case of | |
| 351 // operating upon external array types but fall back to the runtime | |
| 352 // for all other types. | |
| 353 static void GenerateExternalArray(MacroAssembler* masm, | |
| 354 ExternalArrayType array_type); | |
| 355 static void GenerateIndexedInterceptor(MacroAssembler* masm); | 363 static void GenerateIndexedInterceptor(MacroAssembler* masm); |
| 356 | 364 |
| 357 // Clear the use of the inlined version. | 365 // Clear the use of the inlined version. |
| 358 static void ClearInlinedVersion(Address address); | 366 static void ClearInlinedVersion(Address address); |
| 359 | 367 |
| 360 // Bit mask to be tested against bit field for the cases when | 368 // Bit mask to be tested against bit field for the cases when |
| 361 // generic stub should go into slow case. | 369 // generic stub should go into slow case. |
| 362 // Access check is necessary explicitly since generic stub does not perform | 370 // Access check is necessary explicitly since generic stub does not perform |
| 363 // map checks. | 371 // map checks. |
| 364 static const int kSlowCaseBitFieldMask = | 372 static const int kSlowCaseBitFieldMask = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 385 Builtins::KeyedLoadIC_Generic); | 393 Builtins::KeyedLoadIC_Generic); |
| 386 } | 394 } |
| 387 Code* pre_monomorphic_stub() { | 395 Code* pre_monomorphic_stub() { |
| 388 return isolate()->builtins()->builtin( | 396 return isolate()->builtins()->builtin( |
| 389 Builtins::KeyedLoadIC_PreMonomorphic); | 397 Builtins::KeyedLoadIC_PreMonomorphic); |
| 390 } | 398 } |
| 391 Code* string_stub() { | 399 Code* string_stub() { |
| 392 return isolate()->builtins()->builtin( | 400 return isolate()->builtins()->builtin( |
| 393 Builtins::KeyedLoadIC_String); | 401 Builtins::KeyedLoadIC_String); |
| 394 } | 402 } |
| 395 Code* external_array_stub(JSObject::ElementsKind elements_kind); | |
| 396 | 403 |
| 397 Code* indexed_interceptor_stub() { | 404 Code* indexed_interceptor_stub() { |
| 398 return isolate()->builtins()->builtin( | 405 return isolate()->builtins()->builtin( |
| 399 Builtins::KeyedLoadIC_IndexedInterceptor); | 406 Builtins::KeyedLoadIC_IndexedInterceptor); |
| 400 } | 407 } |
| 401 | 408 |
| 402 static void Clear(Address address, Code* target); | 409 static void Clear(Address address, Code* target); |
| 403 | 410 |
| 404 // Support for patching the map that is checked in an inlined | 411 // Support for patching the map that is checked in an inlined |
| 405 // version of keyed load. | 412 // version of keyed load. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 Handle<Object> object, | 482 Handle<Object> object, |
| 476 Handle<Object> name, | 483 Handle<Object> name, |
| 477 Handle<Object> value); | 484 Handle<Object> value); |
| 478 | 485 |
| 479 // Code generators for stub routines. Only called once at startup. | 486 // Code generators for stub routines. Only called once at startup. |
| 480 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 487 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 481 static void GenerateMiss(MacroAssembler* masm); | 488 static void GenerateMiss(MacroAssembler* masm); |
| 482 static void GenerateRuntimeSetProperty(MacroAssembler* masm); | 489 static void GenerateRuntimeSetProperty(MacroAssembler* masm); |
| 483 static void GenerateGeneric(MacroAssembler* masm); | 490 static void GenerateGeneric(MacroAssembler* masm); |
| 484 | 491 |
| 485 // Generators for external array types. See objects.h. | |
| 486 // These are similar to the generic IC; they optimize the case of | |
| 487 // operating upon external array types but fall back to the runtime | |
| 488 // for all other types. | |
| 489 static void GenerateExternalArray(MacroAssembler* masm, | |
| 490 ExternalArrayType array_type); | |
| 491 | |
| 492 // Clear the inlined version so the IC is always hit. | 492 // Clear the inlined version so the IC is always hit. |
| 493 static void ClearInlinedVersion(Address address); | 493 static void ClearInlinedVersion(Address address); |
| 494 | 494 |
| 495 // Restore the inlined version so the fast case can get hit. | 495 // Restore the inlined version so the fast case can get hit. |
| 496 static void RestoreInlinedVersion(Address address); | 496 static void RestoreInlinedVersion(Address address); |
| 497 | 497 |
| 498 private: | 498 private: |
| 499 // Update the inline cache. | 499 // Update the inline cache. |
| 500 void UpdateCaches(LookupResult* lookup, | 500 void UpdateCaches(LookupResult* lookup, |
| 501 State state, | 501 State state, |
| 502 Handle<JSObject> receiver, | 502 Handle<JSObject> receiver, |
| 503 Handle<String> name, | 503 Handle<String> name, |
| 504 Handle<Object> value); | 504 Handle<Object> value); |
| 505 | 505 |
| 506 // Stub accessors. | 506 // Stub accessors. |
| 507 static Code* initialize_stub() { | 507 static Code* initialize_stub() { |
| 508 return Isolate::Current()->builtins()->builtin( | 508 return Isolate::Current()->builtins()->builtin( |
| 509 Builtins::KeyedStoreIC_Initialize); | 509 Builtins::KeyedStoreIC_Initialize); |
| 510 } | 510 } |
| 511 Code* megamorphic_stub() { | 511 Code* megamorphic_stub() { |
| 512 return isolate()->builtins()->builtin( | 512 return isolate()->builtins()->builtin( |
| 513 Builtins::KeyedStoreIC_Generic); | 513 Builtins::KeyedStoreIC_Generic); |
| 514 } | 514 } |
| 515 Code* generic_stub() { | 515 Code* generic_stub() { |
| 516 return isolate()->builtins()->builtin( | 516 return isolate()->builtins()->builtin( |
| 517 Builtins::KeyedStoreIC_Generic); | 517 Builtins::KeyedStoreIC_Generic); |
| 518 } | 518 } |
| 519 Code* external_array_stub(JSObject::ElementsKind elements_kind); | |
| 520 | 519 |
| 521 static void Clear(Address address, Code* target); | 520 static void Clear(Address address, Code* target); |
| 522 | 521 |
| 523 // Support for patching the map that is checked in an inlined | 522 // Support for patching the map that is checked in an inlined |
| 524 // version of keyed store. | 523 // version of keyed store. |
| 525 // The address is the patch point for the IC call | 524 // The address is the patch point for the IC call |
| 526 // (Assembler::kCallTargetAddressOffset before the end of | 525 // (Assembler::kCallTargetAddressOffset before the end of |
| 527 // the call/return address). | 526 // the call/return address). |
| 528 // The map is the new map that the inlined code should check against. | 527 // The map is the new map that the inlined code should check against. |
| 529 static bool PatchInlinedStore(Address address, Object* map); | 528 static bool PatchInlinedStore(Address address, Object* map); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 619 |
| 621 Token::Value op_; | 620 Token::Value op_; |
| 622 }; | 621 }; |
| 623 | 622 |
| 624 // Helper for TRBinaryOpIC and CompareIC. | 623 // Helper for TRBinaryOpIC and CompareIC. |
| 625 void PatchInlinedSmiCode(Address address); | 624 void PatchInlinedSmiCode(Address address); |
| 626 | 625 |
| 627 } } // namespace v8::internal | 626 } } // namespace v8::internal |
| 628 | 627 |
| 629 #endif // V8_IC_H_ | 628 #endif // V8_IC_H_ |
| OLD | NEW |