| 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 } | 127 } |
| 128 | 128 |
| 129 bool SlowIsUndeclaredGlobal() { | 129 bool SlowIsUndeclaredGlobal() { |
| 130 return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT; | 130 return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Determines which map must be used for keeping the code stub. | 133 // Determines which map must be used for keeping the code stub. |
| 134 // These methods should not be called with undefined or null. | 134 // These methods should not be called with undefined or null. |
| 135 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, | 135 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, |
| 136 JSObject* holder); | 136 JSObject* holder); |
| 137 static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object, | |
| 138 JSObject* holder); | |
| 139 static inline JSObject* GetCodeCacheHolder(Isolate* isolate, | 137 static inline JSObject* GetCodeCacheHolder(Isolate* isolate, |
| 140 Object* object, | 138 Object* object, |
| 141 InlineCacheHolderFlag holder); | 139 InlineCacheHolderFlag holder); |
| 142 | 140 |
| 143 static bool IsCleared(Code* code) { | 141 static bool IsCleared(Code* code) { |
| 144 InlineCacheState state = code->ic_state(); | 142 InlineCacheState state = code->ic_state(); |
| 145 return state == UNINITIALIZED || state == PREMONOMORPHIC; | 143 return state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 146 } | 144 } |
| 147 | 145 |
| 148 protected: | 146 protected: |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 569 |
| 572 // Update the inline cache and the global stub cache based on the | 570 // Update the inline cache and the global stub cache based on the |
| 573 // lookup result. | 571 // lookup result. |
| 574 void UpdateCaches(LookupResult* lookup, | 572 void UpdateCaches(LookupResult* lookup, |
| 575 Handle<JSObject> receiver, | 573 Handle<JSObject> receiver, |
| 576 Handle<String> name, | 574 Handle<String> name, |
| 577 Handle<Object> value); | 575 Handle<Object> value); |
| 578 // Compute the code stub for this store; used for rewriting to | 576 // Compute the code stub for this store; used for rewriting to |
| 579 // monomorphic state and making sure that the code stub is in the | 577 // monomorphic state and making sure that the code stub is in the |
| 580 // stub cache. | 578 // stub cache. |
| 581 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, | 579 virtual Handle<Code> ComputeStoreHandler(LookupResult* lookup, |
| 582 Handle<JSObject> receiver, | 580 Handle<JSObject> receiver, |
| 583 Handle<String> name, | 581 Handle<String> name, |
| 584 Handle<Object> value); | 582 Handle<Object> value); |
| 585 | 583 |
| 586 private: | 584 private: |
| 587 void set_target(Code* code) { | 585 void set_target(Code* code) { |
| 588 // Strict mode must be preserved across IC patching. | 586 // Strict mode must be preserved across IC patching. |
| 589 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 587 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
| 590 Code::GetStrictMode(target()->extra_ic_state())); | 588 Code::GetStrictMode(target()->extra_ic_state())); |
| 591 IC::set_target(code); | 589 IC::set_target(code); |
| 592 } | 590 } |
| 593 | 591 |
| 594 static Handle<Code> initialize_stub(Isolate* isolate, | 592 static Handle<Code> initialize_stub(Isolate* isolate, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); | 640 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); |
| 643 static void GenerateSlow(MacroAssembler* masm); | 641 static void GenerateSlow(MacroAssembler* masm); |
| 644 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 642 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 645 StrictModeFlag strict_mode); | 643 StrictModeFlag strict_mode); |
| 646 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); | 644 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); |
| 647 static void GenerateNonStrictArguments(MacroAssembler* masm); | 645 static void GenerateNonStrictArguments(MacroAssembler* masm); |
| 648 | 646 |
| 649 protected: | 647 protected: |
| 650 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 648 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
| 651 | 649 |
| 652 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, | 650 virtual Handle<Code> ComputeStoreHandler(LookupResult* lookup, |
| 653 Handle<JSObject> receiver, | 651 Handle<JSObject> receiver, |
| 654 Handle<String> name, | 652 Handle<String> name, |
| 655 Handle<Object> value); | 653 Handle<Object> value); |
| 656 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 654 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
| 657 | 655 |
| 658 virtual Handle<Code> pre_monomorphic_stub() { | 656 virtual Handle<Code> pre_monomorphic_stub() { |
| 659 return pre_monomorphic_stub(isolate(), strict_mode()); | 657 return pre_monomorphic_stub(isolate(), strict_mode()); |
| 660 } | 658 } |
| 661 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, | 659 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
| 662 StrictModeFlag strict_mode) { | 660 StrictModeFlag strict_mode) { |
| 663 if (strict_mode == kStrictMode) { | 661 if (strict_mode == kStrictMode) { |
| 664 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); | 662 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); |
| 665 } else { | 663 } else { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 855 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 856 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 854 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 857 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 855 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 856 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 859 | 857 |
| 860 | 858 |
| 861 } } // namespace v8::internal | 859 } } // namespace v8::internal |
| 862 | 860 |
| 863 #endif // V8_IC_H_ | 861 #endif // V8_IC_H_ |
| OLD | NEW |