| 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 "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 Handle<Code> ComputeHandler(LookupIterator* lookup, Handle<Object> object, | 186 Handle<Code> ComputeHandler(LookupIterator* lookup, Handle<Object> object, |
| 187 Handle<Name> name, | 187 Handle<Name> name, |
| 188 Handle<Object> value = Handle<Code>::null()); | 188 Handle<Object> value = Handle<Code>::null()); |
| 189 virtual Handle<Code> CompileHandler(LookupIterator* lookup, | 189 virtual Handle<Code> CompileHandler(LookupIterator* lookup, |
| 190 Handle<Object> object, | 190 Handle<Object> object, |
| 191 Handle<Name> name, Handle<Object> value, | 191 Handle<Name> name, Handle<Object> value, |
| 192 CacheHolderFlag cache_holder) { | 192 CacheHolderFlag cache_holder) { |
| 193 UNREACHABLE(); | 193 UNREACHABLE(); |
| 194 return Handle<Code>::null(); | 194 return Handle<Code>::null(); |
| 195 } | 195 } |
| 196 // Temporary copy of the above, but using a LookupResult. | |
| 197 // TODO(jkummerow): Migrate callers to LookupIterator and delete these. | |
| 198 Handle<Code> ComputeStoreHandler(LookupResult* lookup, Handle<Object> object, | |
| 199 Handle<Name> name, | |
| 200 Handle<Object> value = Handle<Code>::null()); | |
| 201 virtual Handle<Code> CompileStoreHandler(LookupResult* lookup, | |
| 202 Handle<Object> object, | |
| 203 Handle<Name> name, | |
| 204 Handle<Object> value, | |
| 205 CacheHolderFlag cache_holder) { | |
| 206 UNREACHABLE(); | |
| 207 return Handle<Code>::null(); | |
| 208 } | |
| 209 | 196 |
| 210 void UpdateMonomorphicIC(Handle<Code> handler, Handle<Name> name); | 197 void UpdateMonomorphicIC(Handle<Code> handler, Handle<Name> name); |
| 211 bool UpdatePolymorphicIC(Handle<Name> name, Handle<Code> code); | 198 bool UpdatePolymorphicIC(Handle<Name> name, Handle<Code> code); |
| 212 void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code); | 199 void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code); |
| 213 | 200 |
| 214 void CopyICToMegamorphicCache(Handle<Name> name); | 201 void CopyICToMegamorphicCache(Handle<Name> name); |
| 215 bool IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map); | 202 bool IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map); |
| 216 void PatchCache(Handle<Name> name, Handle<Code> code); | 203 void PatchCache(Handle<Name> name, Handle<Code> code); |
| 217 Code::Kind kind() const { return kind_; } | 204 Code::Kind kind() const { return kind_; } |
| 218 Code::Kind handler_kind() const { | 205 Code::Kind handler_kind() const { |
| 219 if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC; | 206 if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC; |
| 220 DCHECK(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC || | 207 DCHECK(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC || |
| 221 kind_ == Code::KEYED_STORE_IC); | 208 kind_ == Code::KEYED_STORE_IC); |
| 222 return kind_; | 209 return kind_; |
| 223 } | 210 } |
| 224 virtual Handle<Code> megamorphic_stub() { | 211 virtual Handle<Code> megamorphic_stub() { |
| 225 UNREACHABLE(); | 212 UNREACHABLE(); |
| 226 return Handle<Code>::null(); | 213 return Handle<Code>::null(); |
| 227 } | 214 } |
| 228 | 215 |
| 229 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, | 216 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, |
| 230 Handle<String> name); | 217 Handle<String> name); |
| 231 | 218 |
| 232 ExtraICState extra_ic_state() const { return extra_ic_state_; } | 219 ExtraICState extra_ic_state() const { return extra_ic_state_; } |
| 233 void set_extra_ic_state(ExtraICState state) { | 220 void set_extra_ic_state(ExtraICState state) { |
| 234 extra_ic_state_ = state; | 221 extra_ic_state_ = state; |
| 235 } | 222 } |
| 236 | 223 |
| 237 Handle<HeapType> receiver_type() { return receiver_type_; } | 224 Handle<HeapType> receiver_type() { return receiver_type_; } |
| 225 void update_receiver_type(Handle<Object> receiver) { |
| 226 receiver_type_ = CurrentTypeOf(receiver, isolate_); |
| 227 } |
| 238 | 228 |
| 239 void TargetMaps(MapHandleList* list) { | 229 void TargetMaps(MapHandleList* list) { |
| 240 FindTargetMaps(); | 230 FindTargetMaps(); |
| 241 for (int i = 0; i < target_maps_.length(); i++) { | 231 for (int i = 0; i < target_maps_.length(); i++) { |
| 242 list->Add(target_maps_.at(i)); | 232 list->Add(target_maps_.at(i)); |
| 243 } | 233 } |
| 244 } | 234 } |
| 245 | 235 |
| 246 void TargetTypes(TypeHandleList* list) { | 236 void TargetTypes(TypeHandleList* list) { |
| 247 FindTargetMaps(); | 237 FindTargetMaps(); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 static Handle<Code> initialize_stub(Isolate* isolate, | 616 static Handle<Code> initialize_stub(Isolate* isolate, |
| 627 StrictMode strict_mode); | 617 StrictMode strict_mode); |
| 628 | 618 |
| 629 MUST_USE_RESULT MaybeHandle<Object> Store( | 619 MUST_USE_RESULT MaybeHandle<Object> Store( |
| 630 Handle<Object> object, | 620 Handle<Object> object, |
| 631 Handle<Name> name, | 621 Handle<Name> name, |
| 632 Handle<Object> value, | 622 Handle<Object> value, |
| 633 JSReceiver::StoreFromKeyed store_mode = | 623 JSReceiver::StoreFromKeyed store_mode = |
| 634 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); | 624 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); |
| 635 | 625 |
| 626 bool LookupForWrite(Handle<Object> object, Handle<Name> name, |
| 627 Handle<Object> value, LookupIterator* it, |
| 628 JSReceiver::StoreFromKeyed store_mode); |
| 629 |
| 636 protected: | 630 protected: |
| 637 virtual Handle<Code> megamorphic_stub(); | 631 virtual Handle<Code> megamorphic_stub(); |
| 638 | 632 |
| 639 // Stub accessors. | 633 // Stub accessors. |
| 640 virtual Handle<Code> generic_stub() const; | 634 virtual Handle<Code> generic_stub() const; |
| 641 | 635 |
| 642 virtual Handle<Code> slow_stub() const { | 636 virtual Handle<Code> slow_stub() const { |
| 643 return isolate()->builtins()->StoreIC_Slow(); | 637 return isolate()->builtins()->StoreIC_Slow(); |
| 644 } | 638 } |
| 645 | 639 |
| 646 virtual Handle<Code> pre_monomorphic_stub() const { | 640 virtual Handle<Code> pre_monomorphic_stub() const { |
| 647 return pre_monomorphic_stub(isolate(), strict_mode()); | 641 return pre_monomorphic_stub(isolate(), strict_mode()); |
| 648 } | 642 } |
| 649 | 643 |
| 650 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, | 644 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
| 651 StrictMode strict_mode); | 645 StrictMode strict_mode); |
| 652 | 646 |
| 653 // Update the inline cache and the global stub cache based on the | 647 // Update the inline cache and the global stub cache based on the |
| 654 // lookup result. | 648 // lookup result. |
| 655 void UpdateCaches(LookupResult* lookup, | 649 void UpdateCaches(LookupIterator* lookup, Handle<JSObject> receiver, |
| 656 Handle<JSObject> receiver, | 650 Handle<Name> name, Handle<Object> value); |
| 657 Handle<Name> name, | 651 virtual Handle<Code> CompileHandler(LookupIterator* lookup, |
| 658 Handle<Object> value); | 652 Handle<Object> object, Handle<Name> name, |
| 659 virtual Handle<Code> CompileStoreHandler(LookupResult* lookup, | 653 Handle<Object> value, |
| 660 Handle<Object> object, | 654 CacheHolderFlag cache_holder); |
| 661 Handle<Name> name, | |
| 662 Handle<Object> value, | |
| 663 CacheHolderFlag cache_holder); | |
| 664 | 655 |
| 665 private: | 656 private: |
| 666 void set_target(Code* code) { | 657 void set_target(Code* code) { |
| 667 // Strict mode must be preserved across IC patching. | 658 // Strict mode must be preserved across IC patching. |
| 668 DCHECK(GetStrictMode(code->extra_ic_state()) == | 659 DCHECK(GetStrictMode(code->extra_ic_state()) == |
| 669 GetStrictMode(target()->extra_ic_state())); | 660 GetStrictMode(target()->extra_ic_state())); |
| 670 IC::set_target(code); | 661 IC::set_target(code); |
| 671 } | 662 } |
| 672 | 663 |
| 673 static void Clear(Isolate* isolate, | 664 static void Clear(Isolate* isolate, |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 1031 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
| 1041 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 1032 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
| 1042 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 1033 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
| 1043 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 1034 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
| 1044 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 1035 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
| 1045 | 1036 |
| 1046 | 1037 |
| 1047 } } // namespace v8::internal | 1038 } } // namespace v8::internal |
| 1048 | 1039 |
| 1049 #endif // V8_IC_H_ | 1040 #endif // V8_IC_H_ |
| OLD | NEW |