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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } else if (kind_ == Code::STORE_IC) { | 515 } else if (kind_ == Code::STORE_IC) { |
516 return code->ic_state() == MONOMORPHIC | 516 return code->ic_state() == MONOMORPHIC |
517 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | 517 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; |
518 } else { | 518 } else { |
519 return code->ic_state() == MONOMORPHIC | 519 return code->ic_state() == MONOMORPHIC |
520 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | 520 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
521 } | 521 } |
522 } | 522 } |
523 void JitEvent(Handle<Name> name, Handle<Code> code); | 523 void JitEvent(Handle<Name> name, Handle<Code> code); |
524 | 524 |
525 virtual Register receiver() = 0; | 525 Register receiver() { return registers_[0]; } |
526 virtual Register name() = 0; | 526 Register name() { return registers_[1]; } |
527 virtual Register scratch1() = 0; | 527 Register scratch1() { return registers_[2]; } |
528 virtual Register scratch2() = 0; | 528 Register scratch2() { return registers_[3]; } |
529 virtual Register scratch3() = 0; | 529 Register scratch3() { return registers_[4]; } |
530 | 530 |
531 void InitializeRegisters(); | 531 void InitializeRegisters(); |
532 | 532 |
533 bool IncludesNumberType(TypeHandleList* types); | 533 bool IncludesNumberType(TypeHandleList* types); |
534 | 534 |
535 Code::Kind kind_; | 535 Code::Kind kind_; |
536 InlineCacheHolderFlag cache_holder_; | 536 InlineCacheHolderFlag cache_holder_; |
537 Register* registers_; | 537 Register* registers_; |
538 }; | 538 }; |
539 | 539 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 Handle<Code> CompileLoadViaGetter(Handle<HeapType> type, | 576 Handle<Code> CompileLoadViaGetter(Handle<HeapType> type, |
577 Handle<JSObject> holder, | 577 Handle<JSObject> holder, |
578 Handle<Name> name, | 578 Handle<Name> name, |
579 Handle<JSFunction> getter); | 579 Handle<JSFunction> getter); |
580 | 580 |
581 static void GenerateLoadViaGetter(MacroAssembler* masm, | 581 static void GenerateLoadViaGetter(MacroAssembler* masm, |
582 Handle<HeapType> type, | 582 Handle<HeapType> type, |
583 Register receiver, | 583 Register receiver, |
584 Handle<JSFunction> getter); | 584 Handle<JSFunction> getter); |
585 | 585 |
| 586 static void GenerateLoadViaGetterForDeopt(MacroAssembler* masm) { |
| 587 GenerateLoadViaGetter( |
| 588 masm, Handle<HeapType>::null(), no_reg, Handle<JSFunction>()); |
| 589 } |
| 590 |
586 Handle<Code> CompileLoadNonexistent(Handle<HeapType> type, | 591 Handle<Code> CompileLoadNonexistent(Handle<HeapType> type, |
587 Handle<JSObject> last, | 592 Handle<JSObject> last, |
588 Handle<Name> name); | 593 Handle<Name> name); |
589 | 594 |
590 Handle<Code> CompileLoadGlobal(Handle<HeapType> type, | 595 Handle<Code> CompileLoadGlobal(Handle<HeapType> type, |
591 Handle<GlobalObject> holder, | 596 Handle<GlobalObject> holder, |
592 Handle<PropertyCell> cell, | 597 Handle<PropertyCell> cell, |
593 Handle<Name> name, | 598 Handle<Name> name, |
594 bool is_dont_delete); | 599 bool is_dont_delete); |
595 | 600 |
596 static Register* registers(); | |
597 | |
598 protected: | 601 protected: |
599 ContextualMode contextual_mode() { | 602 ContextualMode contextual_mode() { |
600 return LoadIC::GetContextualMode(extra_state()); | 603 return LoadIC::GetContextualMode(extra_state()); |
601 } | 604 } |
602 | 605 |
603 virtual Register HandlerFrontendHeader(Handle<HeapType> type, | 606 virtual Register HandlerFrontendHeader(Handle<HeapType> type, |
604 Register object_reg, | 607 Register object_reg, |
605 Handle<JSObject> holder, | 608 Handle<JSObject> holder, |
606 Handle<Name> name, | 609 Handle<Name> name, |
607 Label* miss); | 610 Label* miss); |
(...skipping 21 matching lines...) Expand all Loading... |
629 void GenerateLoadInterceptor(Register holder_reg, | 632 void GenerateLoadInterceptor(Register holder_reg, |
630 Handle<Object> object, | 633 Handle<Object> object, |
631 Handle<JSObject> holder, | 634 Handle<JSObject> holder, |
632 LookupResult* lookup, | 635 LookupResult* lookup, |
633 Handle<Name> name); | 636 Handle<Name> name); |
634 void GenerateLoadPostInterceptor(Register reg, | 637 void GenerateLoadPostInterceptor(Register reg, |
635 Handle<JSObject> interceptor_holder, | 638 Handle<JSObject> interceptor_holder, |
636 Handle<Name> name, | 639 Handle<Name> name, |
637 LookupResult* lookup); | 640 LookupResult* lookup); |
638 | 641 |
639 virtual Register receiver() { return registers_[0]; } | 642 private: |
640 virtual Register name() { return registers_[1]; } | 643 static Register* registers(); |
641 virtual Register scratch1() { return registers_[2]; } | |
642 virtual Register scratch2() { return registers_[3]; } | |
643 virtual Register scratch3() { return registers_[4]; } | |
644 Register scratch4() { return registers_[5]; } | 644 Register scratch4() { return registers_[5]; } |
| 645 friend class BaseLoadStoreStubCompiler; |
645 }; | 646 }; |
646 | 647 |
647 | 648 |
648 class KeyedLoadStubCompiler: public LoadStubCompiler { | 649 class KeyedLoadStubCompiler: public LoadStubCompiler { |
649 public: | 650 public: |
650 KeyedLoadStubCompiler(Isolate* isolate, | 651 KeyedLoadStubCompiler(Isolate* isolate, |
651 ExtraICState extra_ic_state = kNoExtraICState, | 652 ExtraICState extra_ic_state = kNoExtraICState, |
652 InlineCacheHolderFlag cache_holder = OWN_MAP) | 653 InlineCacheHolderFlag cache_holder = OWN_MAP) |
653 : LoadStubCompiler(isolate, extra_ic_state, cache_holder, | 654 : LoadStubCompiler(isolate, extra_ic_state, cache_holder, |
654 Code::KEYED_LOAD_IC) { } | 655 Code::KEYED_LOAD_IC) { } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 Handle<Name> name, | 720 Handle<Name> name, |
720 Handle<ExecutableAccessorInfo> callback); | 721 Handle<ExecutableAccessorInfo> callback); |
721 | 722 |
722 Handle<Code> CompileStoreCallback(Handle<JSObject> object, | 723 Handle<Code> CompileStoreCallback(Handle<JSObject> object, |
723 Handle<JSObject> holder, | 724 Handle<JSObject> holder, |
724 Handle<Name> name, | 725 Handle<Name> name, |
725 const CallOptimization& call_optimization); | 726 const CallOptimization& call_optimization); |
726 | 727 |
727 static void GenerateStoreViaSetter(MacroAssembler* masm, | 728 static void GenerateStoreViaSetter(MacroAssembler* masm, |
728 Handle<HeapType> type, | 729 Handle<HeapType> type, |
| 730 Register receiver, |
729 Handle<JSFunction> setter); | 731 Handle<JSFunction> setter); |
730 | 732 |
| 733 static void GenerateStoreViaSetterForDeopt(MacroAssembler* masm) { |
| 734 GenerateStoreViaSetter( |
| 735 masm, Handle<HeapType>::null(), no_reg, Handle<JSFunction>()); |
| 736 } |
| 737 |
731 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, | 738 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, |
732 Handle<JSObject> holder, | 739 Handle<JSObject> holder, |
733 Handle<Name> name, | 740 Handle<Name> name, |
734 Handle<JSFunction> setter); | 741 Handle<JSFunction> setter); |
735 | 742 |
736 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, | 743 Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, |
737 Handle<Name> name); | 744 Handle<Name> name); |
738 | 745 |
739 static Builtins::Name SlowBuiltin(Code::Kind kind) { | 746 static Builtins::Name SlowBuiltin(Code::Kind kind) { |
740 switch (kind) { | 747 switch (kind) { |
741 case Code::STORE_IC: return Builtins::kStoreIC_Slow; | 748 case Code::STORE_IC: return Builtins::kStoreIC_Slow; |
742 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; | 749 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; |
743 default: UNREACHABLE(); | 750 default: UNREACHABLE(); |
744 } | 751 } |
745 return Builtins::kStoreIC_Slow; | 752 return Builtins::kStoreIC_Slow; |
746 } | 753 } |
747 | 754 |
748 protected: | 755 protected: |
749 virtual Register HandlerFrontendHeader(Handle<HeapType> type, | 756 virtual Register HandlerFrontendHeader(Handle<HeapType> type, |
750 Register object_reg, | 757 Register object_reg, |
751 Handle<JSObject> holder, | 758 Handle<JSObject> holder, |
752 Handle<Name> name, | 759 Handle<Name> name, |
753 Label* miss); | 760 Label* miss); |
754 | 761 |
755 virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss); | 762 virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss); |
756 void GenerateRestoreName(MacroAssembler* masm, | 763 void GenerateRestoreName(MacroAssembler* masm, |
757 Label* label, | 764 Label* label, |
758 Handle<Name> name); | 765 Handle<Name> name); |
759 | 766 |
760 virtual Register receiver() { return registers_[0]; } | 767 private: |
761 virtual Register name() { return registers_[1]; } | |
762 Register value() { return registers_[2]; } | |
763 virtual Register scratch1() { return registers_[3]; } | |
764 virtual Register scratch2() { return registers_[4]; } | |
765 virtual Register scratch3() { return registers_[5]; } | |
766 | |
767 protected: | |
768 static Register* registers(); | 768 static Register* registers(); |
769 | 769 static Register value(); |
770 private: | |
771 friend class BaseLoadStoreStubCompiler; | 770 friend class BaseLoadStoreStubCompiler; |
772 }; | 771 }; |
773 | 772 |
774 | 773 |
775 class KeyedStoreStubCompiler: public StoreStubCompiler { | 774 class KeyedStoreStubCompiler: public StoreStubCompiler { |
776 public: | 775 public: |
777 KeyedStoreStubCompiler(Isolate* isolate, | 776 KeyedStoreStubCompiler(Isolate* isolate, |
778 ExtraICState extra_ic_state) | 777 ExtraICState extra_ic_state) |
779 : StoreStubCompiler(isolate, extra_ic_state, Code::KEYED_STORE_IC) {} | 778 : StoreStubCompiler(isolate, extra_ic_state, Code::KEYED_STORE_IC) {} |
780 | 779 |
781 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); | 780 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); |
782 | 781 |
783 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, | 782 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, |
784 CodeHandleList* handler_stubs, | 783 CodeHandleList* handler_stubs, |
785 MapHandleList* transitioned_maps); | 784 MapHandleList* transitioned_maps); |
786 | 785 |
787 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); | 786 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); |
788 | 787 |
789 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 788 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
790 | 789 |
791 private: | 790 private: |
792 static Register* registers(); | 791 static Register* registers(); |
793 | 792 |
794 KeyedAccessStoreMode store_mode() { | 793 KeyedAccessStoreMode store_mode() { |
795 return KeyedStoreIC::GetKeyedAccessStoreMode(extra_state()); | 794 return KeyedStoreIC::GetKeyedAccessStoreMode(extra_state()); |
796 } | 795 } |
797 | 796 |
798 Register transition_map() { | 797 Register transition_map() { return scratch1(); } |
799 return registers()[3]; | |
800 } | |
801 | 798 |
802 friend class BaseLoadStoreStubCompiler; | 799 friend class BaseLoadStoreStubCompiler; |
803 }; | 800 }; |
804 | 801 |
805 | 802 |
806 // Holds information about possible function call optimizations. | 803 // Holds information about possible function call optimizations. |
807 class CallOptimization BASE_EMBEDDED { | 804 class CallOptimization BASE_EMBEDDED { |
808 public: | 805 public: |
809 explicit CallOptimization(LookupResult* lookup); | 806 explicit CallOptimization(LookupResult* lookup); |
810 | 807 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 Handle<JSFunction> constant_function_; | 853 Handle<JSFunction> constant_function_; |
857 bool is_simple_api_call_; | 854 bool is_simple_api_call_; |
858 Handle<FunctionTemplateInfo> expected_receiver_type_; | 855 Handle<FunctionTemplateInfo> expected_receiver_type_; |
859 Handle<CallHandlerInfo> api_call_info_; | 856 Handle<CallHandlerInfo> api_call_info_; |
860 }; | 857 }; |
861 | 858 |
862 | 859 |
863 } } // namespace v8::internal | 860 } } // namespace v8::internal |
864 | 861 |
865 #endif // V8_STUB_CACHE_H_ | 862 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |