| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 Failure* TypeError(const char* type, | 160 Failure* TypeError(const char* type, |
| 161 Handle<Object> object, | 161 Handle<Object> object, |
| 162 Handle<Object> key); | 162 Handle<Object> key); |
| 163 Failure* ReferenceError(const char* type, Handle<String> name); | 163 Failure* ReferenceError(const char* type, Handle<String> name); |
| 164 | 164 |
| 165 // Access the target code for the given IC address. | 165 // Access the target code for the given IC address. |
| 166 static inline Code* GetTargetAtAddress(Address address); | 166 static inline Code* GetTargetAtAddress(Address address); |
| 167 static inline void SetTargetAtAddress(Address address, Code* target); | 167 static inline void SetTargetAtAddress(Address address, Code* target); |
| 168 static void PostPatching(Address address, Code* target, Code* old_target); | 168 static void PostPatching(Address address, Code* target, Code* old_target); |
| 169 | 169 |
| 170 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 170 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 171 Handle<Code> handler, | 171 Handle<Code> handler, |
| 172 Handle<String> name, | 172 Handle<String> name, |
| 173 StrictModeFlag strict_mode) { | 173 StrictModeFlag strict_mode) { |
| 174 set_target(*handler); | 174 set_target(*handler); |
| 175 } | 175 } |
| 176 bool UpdatePolymorphicIC(State state, | 176 bool UpdatePolymorphicIC(State state, |
| 177 Handle<HeapObject> receiver, | 177 Handle<JSObject> receiver, |
| 178 Handle<String> name, | 178 Handle<String> name, |
| 179 Handle<Code> code, | 179 Handle<Code> code, |
| 180 StrictModeFlag strict_mode); | 180 StrictModeFlag strict_mode); |
| 181 | 181 |
| 182 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, | 182 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
| 183 CodeHandleList* handlers, | 183 CodeHandleList* handlers, |
| 184 int number_of_valid_maps, | 184 int number_of_valid_maps, |
| 185 Handle<Name> name, | 185 Handle<Name> name, |
| 186 StrictModeFlag strict_mode) { | 186 StrictModeFlag strict_mode) { |
| 187 UNREACHABLE(); | 187 UNREACHABLE(); |
| 188 return Handle<Code>::null(); | 188 return Handle<Code>::null(); |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 void CopyICToMegamorphicCache(Handle<String> name); | 191 void CopyICToMegamorphicCache(Handle<String> name); |
| 192 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); | 192 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); |
| 193 void PatchCache(State state, | 193 void PatchCache(State state, |
| 194 StrictModeFlag strict_mode, | 194 StrictModeFlag strict_mode, |
| 195 Handle<HeapObject> receiver, | 195 Handle<JSObject> receiver, |
| 196 Handle<String> name, | 196 Handle<String> name, |
| 197 Handle<Code> code); | 197 Handle<Code> code); |
| 198 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); | 198 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); |
| 199 virtual Handle<Code> megamorphic_stub() { | 199 virtual Handle<Code> megamorphic_stub() { |
| 200 UNREACHABLE(); | 200 UNREACHABLE(); |
| 201 return Handle<Code>::null(); | 201 return Handle<Code>::null(); |
| 202 } | 202 } |
| 203 virtual Handle<Code> megamorphic_stub_strict() { | 203 virtual Handle<Code> megamorphic_stub_strict() { |
| 204 UNREACHABLE(); | 204 UNREACHABLE(); |
| 205 return Handle<Code>::null(); | 205 return Handle<Code>::null(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 static void GenerateNormal(MacroAssembler* masm); | 381 static void GenerateNormal(MacroAssembler* masm); |
| 382 static void GenerateRuntimeGetProperty(MacroAssembler* masm); | 382 static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
| 383 | 383 |
| 384 MUST_USE_RESULT MaybeObject* Load(State state, | 384 MUST_USE_RESULT MaybeObject* Load(State state, |
| 385 Handle<Object> object, | 385 Handle<Object> object, |
| 386 Handle<String> name); | 386 Handle<String> name); |
| 387 | 387 |
| 388 protected: | 388 protected: |
| 389 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 389 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 390 | 390 |
| 391 virtual Handle<Code> slow_stub() const { | 391 virtual Handle<Code> generic_stub() const { |
| 392 return isolate()->builtins()->LoadIC_Slow(); | 392 return isolate()->builtins()->LoadIC_Slow(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 virtual Handle<Code> megamorphic_stub() { | 395 virtual Handle<Code> megamorphic_stub() { |
| 396 return isolate()->builtins()->LoadIC_Megamorphic(); | 396 return isolate()->builtins()->LoadIC_Megamorphic(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 // Update the inline cache and the global stub cache based on the | 399 // Update the inline cache and the global stub cache based on the |
| 400 // lookup result. | 400 // lookup result. |
| 401 void UpdateCaches(LookupResult* lookup, | 401 void UpdateCaches(LookupResult* lookup, |
| 402 State state, | 402 State state, |
| 403 Handle<Object> object, | 403 Handle<Object> object, |
| 404 Handle<String> name); | 404 Handle<String> name); |
| 405 | 405 |
| 406 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 406 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 407 Handle<Code> handler, | 407 Handle<Code> handler, |
| 408 Handle<String> name, | 408 Handle<String> name, |
| 409 StrictModeFlag strict_mode); | 409 StrictModeFlag strict_mode); |
| 410 | 410 |
| 411 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, | 411 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
| 412 CodeHandleList* handlers, | 412 CodeHandleList* handlers, |
| 413 int number_of_valid_maps, | 413 int number_of_valid_maps, |
| 414 Handle<Name> name, | 414 Handle<Name> name, |
| 415 StrictModeFlag strict_mode); | 415 StrictModeFlag strict_mode); |
| 416 | 416 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } | 476 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } |
| 477 | 477 |
| 478 Handle<Code> LoadElementStub(Handle<JSObject> receiver); | 478 Handle<Code> LoadElementStub(Handle<JSObject> receiver); |
| 479 | 479 |
| 480 virtual Handle<Code> megamorphic_stub() { | 480 virtual Handle<Code> megamorphic_stub() { |
| 481 return isolate()->builtins()->KeyedLoadIC_Generic(); | 481 return isolate()->builtins()->KeyedLoadIC_Generic(); |
| 482 } | 482 } |
| 483 virtual Handle<Code> generic_stub() const { | 483 virtual Handle<Code> generic_stub() const { |
| 484 return isolate()->builtins()->KeyedLoadIC_Generic(); | 484 return isolate()->builtins()->KeyedLoadIC_Generic(); |
| 485 } | 485 } |
| 486 virtual Handle<Code> slow_stub() const { | |
| 487 return isolate()->builtins()->KeyedLoadIC_Slow(); | |
| 488 } | |
| 489 | 486 |
| 490 // Update the inline cache. | 487 // Update the inline cache. |
| 491 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 488 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 492 Handle<Code> handler, | 489 Handle<Code> handler, |
| 493 Handle<String> name, | 490 Handle<String> name, |
| 494 StrictModeFlag strict_mode); | 491 StrictModeFlag strict_mode); |
| 495 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
| 496 Handle<JSObject> receiver, | 493 Handle<JSObject> receiver, |
| 497 Handle<String> name); | 494 Handle<String> name); |
| 498 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
| 499 | 496 |
| 500 private: | 497 private: |
| 501 // Stub accessors. | 498 // Stub accessors. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 virtual Handle<Code> pre_monomorphic_stub_strict() const { | 567 virtual Handle<Code> pre_monomorphic_stub_strict() const { |
| 571 return isolate()->builtins()->StoreIC_PreMonomorphic_Strict(); | 568 return isolate()->builtins()->StoreIC_PreMonomorphic_Strict(); |
| 572 } | 569 } |
| 573 virtual Handle<Code> global_proxy_stub() { | 570 virtual Handle<Code> global_proxy_stub() { |
| 574 return isolate()->builtins()->StoreIC_GlobalProxy(); | 571 return isolate()->builtins()->StoreIC_GlobalProxy(); |
| 575 } | 572 } |
| 576 virtual Handle<Code> global_proxy_stub_strict() { | 573 virtual Handle<Code> global_proxy_stub_strict() { |
| 577 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); | 574 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
| 578 } | 575 } |
| 579 | 576 |
| 580 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 577 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 581 Handle<Code> handler, | 578 Handle<Code> handler, |
| 582 Handle<String> name, | 579 Handle<String> name, |
| 583 StrictModeFlag strict_mode); | 580 StrictModeFlag strict_mode); |
| 584 | 581 |
| 585 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, | 582 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
| 586 CodeHandleList* handlers, | 583 CodeHandleList* handlers, |
| 587 int number_of_valid_maps, | 584 int number_of_valid_maps, |
| 588 Handle<Name> name, | 585 Handle<Name> name, |
| 589 StrictModeFlag strict_mode); | 586 StrictModeFlag strict_mode); |
| 590 | 587 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 return isolate()->builtins()->KeyedStoreIC_Generic(); | 682 return isolate()->builtins()->KeyedStoreIC_Generic(); |
| 686 } | 683 } |
| 687 virtual Handle<Code> megamorphic_stub_strict() { | 684 virtual Handle<Code> megamorphic_stub_strict() { |
| 688 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 685 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
| 689 } | 686 } |
| 690 | 687 |
| 691 Handle<Code> StoreElementStub(Handle<JSObject> receiver, | 688 Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
| 692 KeyedAccessStoreMode store_mode, | 689 KeyedAccessStoreMode store_mode, |
| 693 StrictModeFlag strict_mode); | 690 StrictModeFlag strict_mode); |
| 694 | 691 |
| 695 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 692 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 696 Handle<Code> handler, | 693 Handle<Code> handler, |
| 697 Handle<String> name, | 694 Handle<String> name, |
| 698 StrictModeFlag strict_mode); | 695 StrictModeFlag strict_mode); |
| 699 | 696 |
| 700 private: | 697 private: |
| 701 void set_target(Code* code) { | 698 void set_target(Code* code) { |
| 702 // Strict mode must be preserved across IC patching. | 699 // Strict mode must be preserved across IC patching. |
| 703 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 700 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
| 704 Code::GetStrictMode(target()->extra_ic_state())); | 701 Code::GetStrictMode(target()->extra_ic_state())); |
| 705 IC::set_target(code); | 702 IC::set_target(code); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 867 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 868 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 872 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 869 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 873 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 870 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 874 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 875 | 872 |
| 876 | 873 |
| 877 } } // namespace v8::internal | 874 } } // namespace v8::internal |
| 878 | 875 |
| 879 #endif // V8_IC_H_ | 876 #endif // V8_IC_H_ |
| OLD | NEW |