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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Failure* TypeError(const char* type, | 165 Failure* TypeError(const char* type, |
166 Handle<Object> object, | 166 Handle<Object> object, |
167 Handle<Object> key); | 167 Handle<Object> key); |
168 Failure* ReferenceError(const char* type, Handle<String> name); | 168 Failure* ReferenceError(const char* type, Handle<String> name); |
169 | 169 |
170 // Access the target code for the given IC address. | 170 // Access the target code for the given IC address. |
171 static inline Code* GetTargetAtAddress(Address address); | 171 static inline Code* GetTargetAtAddress(Address address); |
172 static inline void SetTargetAtAddress(Address address, Code* target); | 172 static inline void SetTargetAtAddress(Address address, Code* target); |
173 static void PostPatching(Address address, Code* target, Code* old_target); | 173 static void PostPatching(Address address, Code* target, Code* old_target); |
174 | 174 |
175 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | 175 void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
176 Handle<Code> handler, | 176 Handle<Code> handler, |
177 Handle<String> name, | 177 Handle<String> name, |
178 StrictModeFlag strict_mode) { | 178 StrictModeFlag strict_mode); |
179 set_target(*handler); | 179 |
180 } | |
181 bool UpdatePolymorphicIC(State state, | 180 bool UpdatePolymorphicIC(State state, |
182 Handle<HeapObject> receiver, | 181 Handle<HeapObject> receiver, |
183 Handle<String> name, | 182 Handle<String> name, |
184 Handle<Code> code, | 183 Handle<Code> code, |
185 StrictModeFlag strict_mode); | 184 StrictModeFlag strict_mode); |
186 | 185 |
187 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, | |
188 CodeHandleList* handlers, | |
189 int number_of_valid_maps, | |
190 Handle<Name> name, | |
191 StrictModeFlag strict_mode) { | |
192 UNREACHABLE(); | |
193 return Handle<Code>::null(); | |
194 }; | |
195 | |
196 void CopyICToMegamorphicCache(Handle<String> name); | 186 void CopyICToMegamorphicCache(Handle<String> name); |
197 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); | 187 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); |
198 void PatchCache(State state, | 188 void PatchCache(State state, |
199 StrictModeFlag strict_mode, | 189 StrictModeFlag strict_mode, |
200 Handle<HeapObject> receiver, | 190 Handle<HeapObject> receiver, |
201 Handle<String> name, | 191 Handle<String> name, |
202 Handle<Code> code); | 192 Handle<Code> code); |
203 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); | 193 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); |
204 virtual Handle<Code> megamorphic_stub() { | 194 virtual Handle<Code> megamorphic_stub() { |
205 UNREACHABLE(); | 195 UNREACHABLE(); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 return isolate()->builtins()->LoadIC_Megamorphic(); | 391 return isolate()->builtins()->LoadIC_Megamorphic(); |
402 } | 392 } |
403 | 393 |
404 // Update the inline cache and the global stub cache based on the | 394 // Update the inline cache and the global stub cache based on the |
405 // lookup result. | 395 // lookup result. |
406 void UpdateCaches(LookupResult* lookup, | 396 void UpdateCaches(LookupResult* lookup, |
407 State state, | 397 State state, |
408 Handle<Object> object, | 398 Handle<Object> object, |
409 Handle<String> name); | 399 Handle<String> name); |
410 | 400 |
411 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | |
412 Handle<Code> handler, | |
413 Handle<String> name, | |
414 StrictModeFlag strict_mode); | |
415 | |
416 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, | |
417 CodeHandleList* handlers, | |
418 int number_of_valid_maps, | |
419 Handle<Name> name, | |
420 StrictModeFlag strict_mode); | |
421 | |
422 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 401 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
423 Handle<JSObject> receiver, | 402 Handle<JSObject> receiver, |
424 Handle<String> name); | 403 Handle<String> name); |
425 | 404 |
426 private: | 405 private: |
427 // Stub accessors. | 406 // Stub accessors. |
428 static Handle<Code> initialize_stub(Isolate* isolate) { | 407 static Handle<Code> initialize_stub(Isolate* isolate) { |
429 return isolate->builtins()->LoadIC_Initialize(); | 408 return isolate->builtins()->LoadIC_Initialize(); |
430 } | 409 } |
431 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { | 410 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 return isolate()->builtins()->KeyedLoadIC_Generic(); | 468 return isolate()->builtins()->KeyedLoadIC_Generic(); |
490 } | 469 } |
491 virtual Handle<Code> generic_stub() const { | 470 virtual Handle<Code> generic_stub() const { |
492 return isolate()->builtins()->KeyedLoadIC_Generic(); | 471 return isolate()->builtins()->KeyedLoadIC_Generic(); |
493 } | 472 } |
494 virtual Handle<Code> slow_stub() const { | 473 virtual Handle<Code> slow_stub() const { |
495 return isolate()->builtins()->KeyedLoadIC_Slow(); | 474 return isolate()->builtins()->KeyedLoadIC_Slow(); |
496 } | 475 } |
497 | 476 |
498 // Update the inline cache. | 477 // Update the inline cache. |
499 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | |
500 Handle<Code> handler, | |
501 Handle<String> name, | |
502 StrictModeFlag strict_mode); | |
503 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 478 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
504 Handle<JSObject> receiver, | 479 Handle<JSObject> receiver, |
505 Handle<String> name); | 480 Handle<String> name); |
506 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 481 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
507 | 482 |
508 private: | 483 private: |
509 // Stub accessors. | 484 // Stub accessors. |
510 static Handle<Code> initialize_stub(Isolate* isolate) { | 485 static Handle<Code> initialize_stub(Isolate* isolate) { |
511 return isolate->builtins()->KeyedLoadIC_Initialize(); | 486 return isolate->builtins()->KeyedLoadIC_Initialize(); |
512 } | 487 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 static Handle<Code> pre_monomorphic_stub_strict(Isolate* isolate) { | 562 static Handle<Code> pre_monomorphic_stub_strict(Isolate* isolate) { |
588 return isolate->builtins()->StoreIC_PreMonomorphic_Strict(); | 563 return isolate->builtins()->StoreIC_PreMonomorphic_Strict(); |
589 } | 564 } |
590 virtual Handle<Code> global_proxy_stub() { | 565 virtual Handle<Code> global_proxy_stub() { |
591 return isolate()->builtins()->StoreIC_GlobalProxy(); | 566 return isolate()->builtins()->StoreIC_GlobalProxy(); |
592 } | 567 } |
593 virtual Handle<Code> global_proxy_stub_strict() { | 568 virtual Handle<Code> global_proxy_stub_strict() { |
594 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); | 569 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
595 } | 570 } |
596 | 571 |
597 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | |
598 Handle<Code> handler, | |
599 Handle<String> name, | |
600 StrictModeFlag strict_mode); | |
601 | |
602 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, | |
603 CodeHandleList* handlers, | |
604 int number_of_valid_maps, | |
605 Handle<Name> name, | |
606 StrictModeFlag strict_mode); | |
607 | |
608 // Update the inline cache and the global stub cache based on the | 572 // Update the inline cache and the global stub cache based on the |
609 // lookup result. | 573 // lookup result. |
610 void UpdateCaches(LookupResult* lookup, | 574 void UpdateCaches(LookupResult* lookup, |
611 State state, | 575 State state, |
612 StrictModeFlag strict_mode, | 576 StrictModeFlag strict_mode, |
613 Handle<JSObject> receiver, | 577 Handle<JSObject> receiver, |
614 Handle<String> name, | 578 Handle<String> name, |
615 Handle<Object> value); | 579 Handle<Object> value); |
616 // Compute the code stub for this store; used for rewriting to | 580 // Compute the code stub for this store; used for rewriting to |
617 // monomorphic state and making sure that the code stub is in the | 581 // monomorphic state and making sure that the code stub is in the |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 return isolate()->builtins()->KeyedStoreIC_Generic(); | 672 return isolate()->builtins()->KeyedStoreIC_Generic(); |
709 } | 673 } |
710 virtual Handle<Code> megamorphic_stub_strict() { | 674 virtual Handle<Code> megamorphic_stub_strict() { |
711 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 675 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
712 } | 676 } |
713 | 677 |
714 Handle<Code> StoreElementStub(Handle<JSObject> receiver, | 678 Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
715 KeyedAccessStoreMode store_mode, | 679 KeyedAccessStoreMode store_mode, |
716 StrictModeFlag strict_mode); | 680 StrictModeFlag strict_mode); |
717 | 681 |
718 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, | |
719 Handle<Code> handler, | |
720 Handle<String> name, | |
721 StrictModeFlag strict_mode); | |
722 | |
723 private: | 682 private: |
724 void set_target(Code* code) { | 683 void set_target(Code* code) { |
725 // Strict mode must be preserved across IC patching. | 684 // Strict mode must be preserved across IC patching. |
726 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 685 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
727 Code::GetStrictMode(target()->extra_ic_state())); | 686 Code::GetStrictMode(target()->extra_ic_state())); |
728 IC::set_target(code); | 687 IC::set_target(code); |
729 } | 688 } |
730 | 689 |
731 // Stub accessors. | 690 // Stub accessors. |
732 static Handle<Code> initialize_stub(Isolate* isolate) { | 691 static Handle<Code> initialize_stub(Isolate* isolate) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
894 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
895 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 854 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
896 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 855 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
897 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 856 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
898 | 857 |
899 | 858 |
900 } } // namespace v8::internal | 859 } } // namespace v8::internal |
901 | 860 |
902 #endif // V8_IC_H_ | 861 #endif // V8_IC_H_ |
OLD | NEW |