OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_IC_H_ | 5 #ifndef V8_IC_H_ |
6 #define V8_IC_H_ | 6 #define V8_IC_H_ |
7 | 7 |
8 #include "macro-assembler.h" | 8 #include "macro-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Isolate* isolate() const { return isolate_; } | 153 Isolate* isolate() const { return isolate_; } |
154 | 154 |
155 // Get the shared function info of the caller. | 155 // Get the shared function info of the caller. |
156 SharedFunctionInfo* GetSharedFunctionInfo() const; | 156 SharedFunctionInfo* GetSharedFunctionInfo() const; |
157 // Get the code object of the caller. | 157 // Get the code object of the caller. |
158 Code* GetCode() const; | 158 Code* GetCode() const; |
159 // Get the original (non-breakpointed) code object of the caller. | 159 // Get the original (non-breakpointed) code object of the caller. |
160 Code* GetOriginalCode() const; | 160 Code* GetOriginalCode() const; |
161 | 161 |
162 // Set the call-site target. | 162 // Set the call-site target. |
163 void set_target(Code* code) { | 163 void set_target(Code* code, |
| 164 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) { |
164 #ifdef VERIFY_HEAP | 165 #ifdef VERIFY_HEAP |
165 code->VerifyEmbeddedObjectsDependency(); | 166 code->VerifyEmbeddedObjectsDependency(); |
166 #endif | 167 #endif |
167 SetTargetAtAddress(address(), code, constant_pool()); | 168 SetTargetAtAddress(address(), code, constant_pool(), icache_flush_mode); |
168 target_set_ = true; | 169 target_set_ = true; |
169 } | 170 } |
170 | 171 |
171 bool is_target_set() { return target_set_; } | 172 bool is_target_set() { return target_set_; } |
172 | 173 |
173 #ifdef DEBUG | 174 #ifdef DEBUG |
174 char TransitionMarkFromState(IC::State state); | 175 char TransitionMarkFromState(IC::State state); |
175 | 176 |
176 void TraceIC(const char* type, Handle<Object> name); | 177 void TraceIC(const char* type, Handle<Object> name); |
177 #endif | 178 #endif |
178 | 179 |
179 MaybeHandle<Object> TypeError(const char* type, | 180 MaybeHandle<Object> TypeError(const char* type, |
180 Handle<Object> object, | 181 Handle<Object> object, |
181 Handle<Object> key); | 182 Handle<Object> key); |
182 MaybeHandle<Object> ReferenceError(const char* type, Handle<String> name); | 183 MaybeHandle<Object> ReferenceError(const char* type, Handle<String> name); |
183 | 184 |
184 // Access the target code for the given IC address. | 185 // Access the target code for the given IC address. |
185 static inline Code* GetTargetAtAddress(Address address, | 186 static inline Code* GetTargetAtAddress(Address address, |
186 ConstantPoolArray* constant_pool); | 187 ConstantPoolArray* constant_pool); |
187 static inline void SetTargetAtAddress(Address address, | 188 static inline void SetTargetAtAddress(Address address, |
188 Code* target, | 189 Code* target, |
189 ConstantPoolArray* constant_pool); | 190 ConstantPoolArray* constant_pool, |
| 191 ICacheFlushMode icache_flush_mode = |
| 192 FLUSH_ICACHE_IF_NEEDED); |
190 static void PostPatching(Address address, Code* target, Code* old_target); | 193 static void PostPatching(Address address, Code* target, Code* old_target); |
191 | 194 |
192 // Compute the handler either by compiling or by retrieving a cached version. | 195 // Compute the handler either by compiling or by retrieving a cached version. |
193 Handle<Code> ComputeHandler(LookupResult* lookup, | 196 Handle<Code> ComputeHandler(LookupResult* lookup, |
194 Handle<Object> object, | 197 Handle<Object> object, |
195 Handle<String> name, | 198 Handle<String> name, |
196 Handle<Object> value = Handle<Code>::null()); | 199 Handle<Object> value = Handle<Code>::null()); |
197 virtual Handle<Code> CompileHandler(LookupResult* lookup, | 200 virtual Handle<Code> CompileHandler(LookupResult* lookup, |
198 Handle<Object> object, | 201 Handle<Object> object, |
199 Handle<String> name, | 202 Handle<String> name, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 451 |
449 static Handle<Code> initialize_stub(Isolate* isolate, | 452 static Handle<Code> initialize_stub(Isolate* isolate, |
450 ExtraICState extra_state); | 453 ExtraICState extra_state); |
451 | 454 |
452 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, | 455 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, |
453 Handle<String> name); | 456 Handle<String> name); |
454 | 457 |
455 protected: | 458 protected: |
456 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 459 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
457 | 460 |
458 void set_target(Code* code) { | 461 void set_target(Code* code, |
| 462 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) { |
459 // The contextual mode must be preserved across IC patching. | 463 // The contextual mode must be preserved across IC patching. |
460 ASSERT(GetContextualMode(code->extra_ic_state()) == | 464 ASSERT(GetContextualMode(code->extra_ic_state()) == |
461 GetContextualMode(target()->extra_ic_state())); | 465 GetContextualMode(target()->extra_ic_state())); |
462 | 466 |
463 IC::set_target(code); | 467 IC::set_target(code, icache_flush_mode); |
464 } | 468 } |
465 | 469 |
466 virtual Handle<Code> slow_stub() const { | 470 virtual Handle<Code> slow_stub() const { |
467 return isolate()->builtins()->LoadIC_Slow(); | 471 return isolate()->builtins()->LoadIC_Slow(); |
468 } | 472 } |
469 | 473 |
470 virtual Handle<Code> megamorphic_stub(); | 474 virtual Handle<Code> megamorphic_stub(); |
471 | 475 |
472 // Update the inline cache and the global stub cache based on the | 476 // Update the inline cache and the global stub cache based on the |
473 // lookup result. | 477 // lookup result. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 Handle<JSObject> receiver, | 651 Handle<JSObject> receiver, |
648 Handle<String> name, | 652 Handle<String> name, |
649 Handle<Object> value); | 653 Handle<Object> value); |
650 virtual Handle<Code> CompileHandler(LookupResult* lookup, | 654 virtual Handle<Code> CompileHandler(LookupResult* lookup, |
651 Handle<Object> object, | 655 Handle<Object> object, |
652 Handle<String> name, | 656 Handle<String> name, |
653 Handle<Object> value, | 657 Handle<Object> value, |
654 InlineCacheHolderFlag cache_holder); | 658 InlineCacheHolderFlag cache_holder); |
655 | 659 |
656 private: | 660 private: |
657 void set_target(Code* code) { | 661 void set_target(Code* code, |
| 662 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) { |
658 // Strict mode must be preserved across IC patching. | 663 // Strict mode must be preserved across IC patching. |
659 ASSERT(GetStrictMode(code->extra_ic_state()) == | 664 ASSERT(GetStrictMode(code->extra_ic_state()) == |
660 GetStrictMode(target()->extra_ic_state())); | 665 GetStrictMode(target()->extra_ic_state())); |
661 IC::set_target(code); | 666 IC::set_target(code, icache_flush_mode); |
662 } | 667 } |
663 | 668 |
664 static void Clear(Isolate* isolate, | 669 static void Clear(Isolate* isolate, |
665 Address address, | 670 Address address, |
666 Code* target, | 671 Code* target, |
667 ConstantPoolArray* constant_pool); | 672 ConstantPoolArray* constant_pool); |
668 | 673 |
669 friend class IC; | 674 friend class IC; |
670 }; | 675 }; |
671 | 676 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 1035 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
1031 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 1036 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
1032 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 1037 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
1033 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 1038 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
1034 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 1039 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
1035 | 1040 |
1036 | 1041 |
1037 } } // namespace v8::internal | 1042 } } // namespace v8::internal |
1038 | 1043 |
1039 #endif // V8_IC_H_ | 1044 #endif // V8_IC_H_ |
OLD | NEW |