| OLD | NEW |
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // Determines which map must be used for keeping the code stub. | 127 // Determines which map must be used for keeping the code stub. |
| 128 // These methods should not be called with undefined or null. | 128 // These methods should not be called with undefined or null. |
| 129 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, | 129 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, |
| 130 JSObject* holder); | 130 JSObject* holder); |
| 131 static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object, | 131 static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object, |
| 132 JSObject* holder); | 132 JSObject* holder); |
| 133 static inline JSObject* GetCodeCacheHolder(Isolate* isolate, | 133 static inline JSObject* GetCodeCacheHolder(Isolate* isolate, |
| 134 Object* object, | 134 Object* object, |
| 135 InlineCacheHolderFlag holder); | 135 InlineCacheHolderFlag holder); |
| 136 | 136 |
| 137 static bool IsCleared(Code* code) { |
| 138 InlineCacheState state = code->ic_state(); |
| 139 return state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 140 } |
| 141 |
| 137 protected: | 142 protected: |
| 138 Address fp() const { return fp_; } | 143 Address fp() const { return fp_; } |
| 139 Address pc() const { return *pc_address_; } | 144 Address pc() const { return *pc_address_; } |
| 140 Isolate* isolate() const { return isolate_; } | 145 Isolate* isolate() const { return isolate_; } |
| 141 | 146 |
| 142 #ifdef ENABLE_DEBUGGER_SUPPORT | 147 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 143 // Computes the address in the original code when the code running is | 148 // Computes the address in the original code when the code running is |
| 144 // containing break points (calls to DebugBreakXXX builtins). | 149 // containing break points (calls to DebugBreakXXX builtins). |
| 145 Address OriginalCodeAddress() const; | 150 Address OriginalCodeAddress() const; |
| 146 #endif | 151 #endif |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 421 |
| 417 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 422 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
| 418 Handle<JSObject> receiver, | 423 Handle<JSObject> receiver, |
| 419 Handle<String> name); | 424 Handle<String> name); |
| 420 | 425 |
| 421 private: | 426 private: |
| 422 // Stub accessors. | 427 // Stub accessors. |
| 423 static Handle<Code> initialize_stub(Isolate* isolate) { | 428 static Handle<Code> initialize_stub(Isolate* isolate) { |
| 424 return isolate->builtins()->LoadIC_Initialize(); | 429 return isolate->builtins()->LoadIC_Initialize(); |
| 425 } | 430 } |
| 431 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
| 432 return isolate->builtins()->LoadIC_PreMonomorphic(); |
| 433 } |
| 426 virtual Handle<Code> pre_monomorphic_stub() { | 434 virtual Handle<Code> pre_monomorphic_stub() { |
| 427 return isolate()->builtins()->LoadIC_PreMonomorphic(); | 435 return pre_monomorphic_stub(isolate()); |
| 428 } | 436 } |
| 429 | 437 |
| 430 static void Clear(Isolate* isolate, Address address, Code* target); | 438 static void Clear(Isolate* isolate, Address address, Code* target); |
| 431 | 439 |
| 432 friend class IC; | 440 friend class IC; |
| 433 }; | 441 }; |
| 434 | 442 |
| 435 | 443 |
| 436 enum ICMissMode { | 444 enum ICMissMode { |
| 437 MISS_FORCE_GENERIC, | 445 MISS_FORCE_GENERIC, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 503 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
| 496 Handle<JSObject> receiver, | 504 Handle<JSObject> receiver, |
| 497 Handle<String> name); | 505 Handle<String> name); |
| 498 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 506 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
| 499 | 507 |
| 500 private: | 508 private: |
| 501 // Stub accessors. | 509 // Stub accessors. |
| 502 static Handle<Code> initialize_stub(Isolate* isolate) { | 510 static Handle<Code> initialize_stub(Isolate* isolate) { |
| 503 return isolate->builtins()->KeyedLoadIC_Initialize(); | 511 return isolate->builtins()->KeyedLoadIC_Initialize(); |
| 504 } | 512 } |
| 513 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
| 514 return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); |
| 515 } |
| 505 virtual Handle<Code> pre_monomorphic_stub() { | 516 virtual Handle<Code> pre_monomorphic_stub() { |
| 506 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic(); | 517 return pre_monomorphic_stub(isolate()); |
| 507 } | 518 } |
| 508 Handle<Code> indexed_interceptor_stub() { | 519 Handle<Code> indexed_interceptor_stub() { |
| 509 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); | 520 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); |
| 510 } | 521 } |
| 511 Handle<Code> non_strict_arguments_stub() { | 522 Handle<Code> non_strict_arguments_stub() { |
| 512 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); | 523 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); |
| 513 } | 524 } |
| 514 Handle<Code> string_stub() { | 525 Handle<Code> string_stub() { |
| 515 return isolate()->builtins()->KeyedLoadIC_String(); | 526 return isolate()->builtins()->KeyedLoadIC_String(); |
| 516 } | 527 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // Stub accessors. | 568 // Stub accessors. |
| 558 virtual Handle<Code> megamorphic_stub_strict() { | 569 virtual Handle<Code> megamorphic_stub_strict() { |
| 559 return isolate()->builtins()->StoreIC_Megamorphic_Strict(); | 570 return isolate()->builtins()->StoreIC_Megamorphic_Strict(); |
| 560 } | 571 } |
| 561 virtual Handle<Code> generic_stub() const { | 572 virtual Handle<Code> generic_stub() const { |
| 562 return isolate()->builtins()->StoreIC_Generic(); | 573 return isolate()->builtins()->StoreIC_Generic(); |
| 563 } | 574 } |
| 564 virtual Handle<Code> generic_stub_strict() const { | 575 virtual Handle<Code> generic_stub_strict() const { |
| 565 return isolate()->builtins()->StoreIC_Generic_Strict(); | 576 return isolate()->builtins()->StoreIC_Generic_Strict(); |
| 566 } | 577 } |
| 567 virtual Handle<Code> pre_monomorphic_stub() const { | 578 virtual Handle<Code> pre_monomorphic_stub() { |
| 568 return isolate()->builtins()->StoreIC_PreMonomorphic(); | 579 return pre_monomorphic_stub(isolate()); |
| 569 } | 580 } |
| 570 virtual Handle<Code> pre_monomorphic_stub_strict() const { | 581 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
| 571 return isolate()->builtins()->StoreIC_PreMonomorphic_Strict(); | 582 return isolate->builtins()->StoreIC_PreMonomorphic(); |
| 583 } |
| 584 virtual Handle<Code> pre_monomorphic_stub_strict() { |
| 585 return pre_monomorphic_stub_strict(isolate()); |
| 586 } |
| 587 static Handle<Code> pre_monomorphic_stub_strict(Isolate* isolate) { |
| 588 return isolate->builtins()->StoreIC_PreMonomorphic_Strict(); |
| 572 } | 589 } |
| 573 virtual Handle<Code> global_proxy_stub() { | 590 virtual Handle<Code> global_proxy_stub() { |
| 574 return isolate()->builtins()->StoreIC_GlobalProxy(); | 591 return isolate()->builtins()->StoreIC_GlobalProxy(); |
| 575 } | 592 } |
| 576 virtual Handle<Code> global_proxy_stub_strict() { | 593 virtual Handle<Code> global_proxy_stub_strict() { |
| 577 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); | 594 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
| 578 } | 595 } |
| 579 | 596 |
| 580 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 597 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
| 581 Handle<Code> handler, | 598 Handle<Code> handler, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 protected: | 685 protected: |
| 669 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 686 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
| 670 | 687 |
| 671 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, | 688 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
| 672 StrictModeFlag strict_mode, | 689 StrictModeFlag strict_mode, |
| 673 Handle<JSObject> receiver, | 690 Handle<JSObject> receiver, |
| 674 Handle<String> name, | 691 Handle<String> name, |
| 675 Handle<Object> value); | 692 Handle<Object> value); |
| 676 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 693 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
| 677 | 694 |
| 678 virtual Handle<Code> pre_monomorphic_stub() const { | 695 virtual Handle<Code> pre_monomorphic_stub() { |
| 679 return isolate()->builtins()->KeyedStoreIC_PreMonomorphic(); | 696 return pre_monomorphic_stub(isolate()); |
| 680 } | 697 } |
| 681 virtual Handle<Code> pre_monomorphic_stub_strict() const { | 698 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
| 682 return isolate()->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); | 699 return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); |
| 700 } |
| 701 virtual Handle<Code> pre_monomorphic_stub_strict() { |
| 702 return pre_monomorphic_stub_strict(isolate()); |
| 703 } |
| 704 static Handle<Code> pre_monomorphic_stub_strict(Isolate* isolate) { |
| 705 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); |
| 683 } | 706 } |
| 684 virtual Handle<Code> megamorphic_stub() { | 707 virtual Handle<Code> megamorphic_stub() { |
| 685 return isolate()->builtins()->KeyedStoreIC_Generic(); | 708 return isolate()->builtins()->KeyedStoreIC_Generic(); |
| 686 } | 709 } |
| 687 virtual Handle<Code> megamorphic_stub_strict() { | 710 virtual Handle<Code> megamorphic_stub_strict() { |
| 688 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 711 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
| 689 } | 712 } |
| 690 | 713 |
| 691 Handle<Code> StoreElementStub(Handle<JSObject> receiver, | 714 Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
| 692 KeyedAccessStoreMode store_mode, | 715 KeyedAccessStoreMode store_mode, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 893 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 894 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 872 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 895 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 873 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 896 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 874 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 897 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 875 | 898 |
| 876 | 899 |
| 877 } } // namespace v8::internal | 900 } } // namespace v8::internal |
| 878 | 901 |
| 879 #endif // V8_IC_H_ | 902 #endif // V8_IC_H_ |
| OLD | NEW |