| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 void Initialize(); | 78 void Initialize(); |
| 79 | 79 |
| 80 Handle<JSObject> StubHolder(Handle<JSObject> receiver, | 80 Handle<JSObject> StubHolder(Handle<JSObject> receiver, |
| 81 Handle<JSObject> holder); | 81 Handle<JSObject> holder); |
| 82 | 82 |
| 83 Handle<Code> FindIC(Handle<Name> name, | 83 Handle<Code> FindIC(Handle<Name> name, |
| 84 Handle<Map> stub_holder_map, | 84 Handle<Map> stub_holder_map, |
| 85 Code::Kind kind, | 85 Code::Kind kind, |
| 86 Code::ExtraICState extra_state = Code::kNoExtraICState, | 86 ExtraICState extra_state = kNoExtraICState, |
| 87 InlineCacheHolderFlag cache_holder = OWN_MAP); | 87 InlineCacheHolderFlag cache_holder = OWN_MAP); |
| 88 | 88 |
| 89 Handle<Code> FindHandler(Handle<Name> name, | 89 Handle<Code> FindHandler(Handle<Name> name, |
| 90 Handle<Map> map, | 90 Handle<Map> map, |
| 91 Code::Kind kind, | 91 Code::Kind kind, |
| 92 InlineCacheHolderFlag cache_holder = OWN_MAP, | 92 InlineCacheHolderFlag cache_holder = OWN_MAP); |
| 93 StrictModeFlag strict_mode = kNonStrictMode); | |
| 94 | 93 |
| 95 Handle<Code> ComputeMonomorphicIC(Handle<Name> name, | 94 Handle<Code> ComputeMonomorphicIC(Handle<Name> name, |
| 96 Handle<Type> type, | 95 Handle<Type> type, |
| 97 Handle<Code> handler, | 96 Handle<Code> handler, |
| 98 StrictModeFlag strict_mode); | 97 ExtraICState extra_ic_state); |
| 99 | 98 |
| 100 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type); | 99 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type); |
| 101 | 100 |
| 102 Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); | 101 Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); |
| 103 | 102 |
| 104 Handle<Code> ComputeKeyedStoreElement(Handle<Map> receiver_map, | 103 Handle<Code> ComputeKeyedStoreElement(Handle<Map> receiver_map, |
| 105 StrictModeFlag strict_mode, | 104 StrictModeFlag strict_mode, |
| 106 KeyedAccessStoreMode store_mode); | 105 KeyedAccessStoreMode store_mode); |
| 107 | 106 |
| 108 Handle<Code> ComputeCallField(int argc, | 107 Handle<Code> ComputeCallField(int argc, |
| 109 Code::Kind, | 108 Code::Kind, |
| 110 Code::ExtraICState extra_state, | 109 ExtraICState extra_state, |
| 111 Handle<Name> name, | 110 Handle<Name> name, |
| 112 Handle<Object> object, | 111 Handle<Object> object, |
| 113 Handle<JSObject> holder, | 112 Handle<JSObject> holder, |
| 114 PropertyIndex index); | 113 PropertyIndex index); |
| 115 | 114 |
| 116 Handle<Code> ComputeCallConstant(int argc, | 115 Handle<Code> ComputeCallConstant(int argc, |
| 117 Code::Kind, | 116 Code::Kind, |
| 118 Code::ExtraICState extra_state, | 117 ExtraICState extra_state, |
| 119 Handle<Name> name, | 118 Handle<Name> name, |
| 120 Handle<Object> object, | 119 Handle<Object> object, |
| 121 Handle<JSObject> holder, | 120 Handle<JSObject> holder, |
| 122 Handle<JSFunction> function); | 121 Handle<JSFunction> function); |
| 123 | 122 |
| 124 Handle<Code> ComputeCallInterceptor(int argc, | 123 Handle<Code> ComputeCallInterceptor(int argc, |
| 125 Code::Kind, | 124 Code::Kind, |
| 126 Code::ExtraICState extra_state, | 125 ExtraICState extra_state, |
| 127 Handle<Name> name, | 126 Handle<Name> name, |
| 128 Handle<Object> object, | 127 Handle<Object> object, |
| 129 Handle<JSObject> holder); | 128 Handle<JSObject> holder); |
| 130 | 129 |
| 131 Handle<Code> ComputeCallGlobal(int argc, | 130 Handle<Code> ComputeCallGlobal(int argc, |
| 132 Code::Kind, | 131 Code::Kind, |
| 133 Code::ExtraICState extra_state, | 132 ExtraICState extra_state, |
| 134 Handle<Name> name, | 133 Handle<Name> name, |
| 135 Handle<JSObject> object, | 134 Handle<JSObject> object, |
| 136 Handle<GlobalObject> holder, | 135 Handle<GlobalObject> holder, |
| 137 Handle<PropertyCell> cell, | 136 Handle<PropertyCell> cell, |
| 138 Handle<JSFunction> function); | 137 Handle<JSFunction> function); |
| 139 | 138 |
| 140 // --- | 139 // --- |
| 141 | 140 |
| 142 Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode); | 141 Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode); |
| 143 | 142 |
| 144 Handle<Code> ComputeKeyedCallInitialize(int argc); | 143 Handle<Code> ComputeKeyedCallInitialize(int argc); |
| 145 | 144 |
| 146 Handle<Code> ComputeCallPreMonomorphic(int argc, | 145 Handle<Code> ComputeCallPreMonomorphic(int argc, |
| 147 Code::Kind kind, | 146 Code::Kind kind, |
| 148 Code::ExtraICState extra_state); | 147 ExtraICState extra_state); |
| 149 | 148 |
| 150 Handle<Code> ComputeCallNormal(int argc, | 149 Handle<Code> ComputeCallNormal(int argc, |
| 151 Code::Kind kind, | 150 Code::Kind kind, |
| 152 Code::ExtraICState state); | 151 ExtraICState state); |
| 153 | 152 |
| 154 Handle<Code> ComputeCallArguments(int argc); | 153 Handle<Code> ComputeCallArguments(int argc); |
| 155 | 154 |
| 156 Handle<Code> ComputeCallMegamorphic(int argc, | 155 Handle<Code> ComputeCallMegamorphic(int argc, |
| 157 Code::Kind kind, | 156 Code::Kind kind, |
| 158 Code::ExtraICState state); | 157 ExtraICState state); |
| 159 | 158 |
| 160 Handle<Code> ComputeCallMiss(int argc, | 159 Handle<Code> ComputeCallMiss(int argc, |
| 161 Code::Kind kind, | 160 Code::Kind kind, |
| 162 Code::ExtraICState state); | 161 ExtraICState state); |
| 163 | 162 |
| 164 // --- | 163 // --- |
| 165 | 164 |
| 166 Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, | 165 Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, |
| 167 CompareNilICStub& stub); | 166 CompareNilICStub& stub); |
| 168 | 167 |
| 169 // --- | 168 // --- |
| 170 | 169 |
| 171 Handle<Code> ComputeLoadElementPolymorphic(MapHandleList* receiver_maps); | 170 Handle<Code> ComputeLoadElementPolymorphic(MapHandleList* receiver_maps); |
| 172 Handle<Code> ComputeStoreElementPolymorphic(MapHandleList* receiver_maps, | 171 Handle<Code> ComputeStoreElementPolymorphic(MapHandleList* receiver_maps, |
| 173 KeyedAccessStoreMode store_mode, | 172 KeyedAccessStoreMode store_mode, |
| 174 StrictModeFlag strict_mode); | 173 StrictModeFlag strict_mode); |
| 175 | 174 |
| 176 Handle<Code> ComputePolymorphicIC(TypeHandleList* types, | 175 Handle<Code> ComputePolymorphicIC(TypeHandleList* types, |
| 177 CodeHandleList* handlers, | 176 CodeHandleList* handlers, |
| 178 int number_of_valid_maps, | 177 int number_of_valid_maps, |
| 179 Handle<Name> name, | 178 Handle<Name> name, |
| 180 StrictModeFlag strict_mode); | 179 ExtraICState extra_ic_state); |
| 181 | 180 |
| 182 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 181 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
| 183 Code* FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind); | 182 Code* FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind); |
| 184 | 183 |
| 185 #ifdef ENABLE_DEBUGGER_SUPPORT | 184 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 186 Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind); | 185 Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind); |
| 187 | 186 |
| 188 Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind); | 187 Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind); |
| 189 #endif | 188 #endif |
| 190 | 189 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } else if (kind_ == Code::STORE_IC) { | 582 } else if (kind_ == Code::STORE_IC) { |
| 584 return code->ic_state() == MONOMORPHIC | 583 return code->ic_state() == MONOMORPHIC |
| 585 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; | 584 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; |
| 586 } else { | 585 } else { |
| 587 return code->ic_state() == MONOMORPHIC | 586 return code->ic_state() == MONOMORPHIC |
| 588 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | 587 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
| 589 } | 588 } |
| 590 } | 589 } |
| 591 void JitEvent(Handle<Name> name, Handle<Code> code); | 590 void JitEvent(Handle<Name> name, Handle<Code> code); |
| 592 | 591 |
| 593 virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } | 592 virtual ExtraICState extra_state() { return kNoExtraICState; } |
| 594 virtual Register receiver() = 0; | 593 virtual Register receiver() = 0; |
| 595 virtual Register name() = 0; | 594 virtual Register name() = 0; |
| 596 virtual Register scratch1() = 0; | 595 virtual Register scratch1() = 0; |
| 597 virtual Register scratch2() = 0; | 596 virtual Register scratch2() = 0; |
| 598 virtual Register scratch3() = 0; | 597 virtual Register scratch3() = 0; |
| 599 | 598 |
| 600 void InitializeRegisters(); | 599 void InitializeRegisters(); |
| 601 | 600 |
| 602 bool IncludesNumberType(TypeHandleList* types); | 601 bool IncludesNumberType(TypeHandleList* types); |
| 603 | 602 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 Label* label, | 820 Label* label, |
| 822 Handle<Name> name); | 821 Handle<Name> name); |
| 823 | 822 |
| 824 virtual Register receiver() { return registers_[0]; } | 823 virtual Register receiver() { return registers_[0]; } |
| 825 virtual Register name() { return registers_[1]; } | 824 virtual Register name() { return registers_[1]; } |
| 826 Register value() { return registers_[2]; } | 825 Register value() { return registers_[2]; } |
| 827 virtual Register scratch1() { return registers_[3]; } | 826 virtual Register scratch1() { return registers_[3]; } |
| 828 virtual Register scratch2() { return registers_[4]; } | 827 virtual Register scratch2() { return registers_[4]; } |
| 829 virtual Register scratch3() { return registers_[5]; } | 828 virtual Register scratch3() { return registers_[5]; } |
| 830 StrictModeFlag strict_mode() { return strict_mode_; } | 829 StrictModeFlag strict_mode() { return strict_mode_; } |
| 831 virtual Code::ExtraICState extra_state() { return strict_mode_; } | 830 virtual ExtraICState extra_state() { |
| 831 return StoreIC::ComputeExtraICState(strict_mode_); |
| 832 } |
| 832 | 833 |
| 833 protected: | 834 protected: |
| 834 static Register* registers(); | 835 static Register* registers(); |
| 835 | 836 |
| 836 private: | 837 private: |
| 837 StrictModeFlag strict_mode_; | 838 StrictModeFlag strict_mode_; |
| 838 friend class BaseLoadStoreStubCompiler; | 839 friend class BaseLoadStoreStubCompiler; |
| 839 }; | 840 }; |
| 840 | 841 |
| 841 | 842 |
| 842 class KeyedStoreStubCompiler: public StoreStubCompiler { | 843 class KeyedStoreStubCompiler: public StoreStubCompiler { |
| 843 public: | 844 public: |
| 844 KeyedStoreStubCompiler(Isolate* isolate, | 845 KeyedStoreStubCompiler(Isolate* isolate, |
| 845 StrictModeFlag strict_mode, | 846 StrictModeFlag strict_mode, |
| 846 KeyedAccessStoreMode store_mode) | 847 KeyedAccessStoreMode store_mode) |
| 847 : StoreStubCompiler(isolate, strict_mode, Code::KEYED_STORE_IC), | 848 : StoreStubCompiler(isolate, strict_mode, Code::KEYED_STORE_IC), |
| 848 store_mode_(store_mode) { } | 849 store_mode_(store_mode) { } |
| 849 | 850 |
| 850 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); | 851 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); |
| 851 | 852 |
| 852 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, | 853 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, |
| 853 CodeHandleList* handler_stubs, | 854 CodeHandleList* handler_stubs, |
| 854 MapHandleList* transitioned_maps); | 855 MapHandleList* transitioned_maps); |
| 855 | 856 |
| 856 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); | 857 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); |
| 857 | 858 |
| 858 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 859 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
| 859 | 860 |
| 860 protected: | 861 protected: |
| 861 virtual Code::ExtraICState extra_state() { | 862 virtual ExtraICState extra_state() { |
| 862 return Code::ComputeExtraICState(store_mode_, strict_mode()); | 863 return KeyedStoreIC::ComputeExtraICState(strict_mode(), store_mode_); |
| 863 } | 864 } |
| 864 static Register* registers(); | 865 static Register* registers(); |
| 865 | 866 |
| 866 private: | 867 private: |
| 867 Register transition_map() { | 868 Register transition_map() { |
| 868 return registers()[3]; | 869 return registers()[3]; |
| 869 } | 870 } |
| 870 | 871 |
| 871 virtual void GenerateNameCheck(Handle<Name> name, | 872 virtual void GenerateNameCheck(Handle<Name> name, |
| 872 Register name_reg, | 873 Register name_reg, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 891 | 892 |
| 892 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ | 893 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ |
| 893 V(ArrayCode) | 894 V(ArrayCode) |
| 894 | 895 |
| 895 | 896 |
| 896 class CallStubCompiler: public StubCompiler { | 897 class CallStubCompiler: public StubCompiler { |
| 897 public: | 898 public: |
| 898 CallStubCompiler(Isolate* isolate, | 899 CallStubCompiler(Isolate* isolate, |
| 899 int argc, | 900 int argc, |
| 900 Code::Kind kind, | 901 Code::Kind kind, |
| 901 Code::ExtraICState extra_state, | 902 ExtraICState extra_state, |
| 902 InlineCacheHolderFlag cache_holder = OWN_MAP); | 903 InlineCacheHolderFlag cache_holder = OWN_MAP); |
| 903 | 904 |
| 904 Handle<Code> CompileCallField(Handle<JSObject> object, | 905 Handle<Code> CompileCallField(Handle<JSObject> object, |
| 905 Handle<JSObject> holder, | 906 Handle<JSObject> holder, |
| 906 PropertyIndex index, | 907 PropertyIndex index, |
| 907 Handle<Name> name); | 908 Handle<Name> name); |
| 908 | 909 |
| 909 void CompileHandlerFrontend(Handle<Object> object, | 910 // Patch the global proxy over the global object if the global object is the |
| 910 Handle<JSObject> holder, | 911 // receiver. |
| 911 Handle<Name> name, | 912 void PatchGlobalProxy(Handle<Object> object); |
| 912 CheckType check); | 913 |
| 914 // Returns the register containing the holder of |name|. |
| 915 Register HandlerFrontendHeader(Handle<Object> object, |
| 916 Handle<JSObject> holder, |
| 917 Handle<Name> name, |
| 918 CheckType check, |
| 919 Label* miss); |
| 920 void HandlerFrontendFooter(Label* miss); |
| 913 | 921 |
| 914 void CompileHandlerBackend(Handle<JSFunction> function); | 922 void CompileHandlerBackend(Handle<JSFunction> function); |
| 915 | 923 |
| 916 Handle<Code> CompileCallConstant(Handle<Object> object, | 924 Handle<Code> CompileCallConstant(Handle<Object> object, |
| 917 Handle<JSObject> holder, | 925 Handle<JSObject> holder, |
| 918 Handle<Name> name, | 926 Handle<Name> name, |
| 919 CheckType check, | 927 CheckType check, |
| 920 Handle<JSFunction> function); | 928 Handle<JSFunction> function); |
| 921 | 929 |
| 922 Handle<Code> CompileCallInterceptor(Handle<JSObject> object, | 930 Handle<Code> CompileCallInterceptor(Handle<JSObject> object, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 Handle<JSFunction> function, | 968 Handle<JSFunction> function, |
| 961 Handle<String> name); | 969 Handle<String> name); |
| 962 | 970 |
| 963 Handle<Code> GetCode(Code::StubType type, Handle<Name> name); | 971 Handle<Code> GetCode(Code::StubType type, Handle<Name> name); |
| 964 Handle<Code> GetCode(Handle<JSFunction> function); | 972 Handle<Code> GetCode(Handle<JSFunction> function); |
| 965 | 973 |
| 966 const ParameterCount& arguments() { return arguments_; } | 974 const ParameterCount& arguments() { return arguments_; } |
| 967 | 975 |
| 968 void GenerateNameCheck(Handle<Name> name, Label* miss); | 976 void GenerateNameCheck(Handle<Name> name, Label* miss); |
| 969 | 977 |
| 970 void GenerateGlobalReceiverCheck(Handle<JSObject> object, | |
| 971 Handle<JSObject> holder, | |
| 972 Handle<Name> name, | |
| 973 Label* miss); | |
| 974 | |
| 975 // Generates code to load the function from the cell checking that | 978 // Generates code to load the function from the cell checking that |
| 976 // it still contains the same function. | 979 // it still contains the same function. |
| 977 void GenerateLoadFunctionFromCell(Handle<Cell> cell, | 980 void GenerateLoadFunctionFromCell(Handle<Cell> cell, |
| 978 Handle<JSFunction> function, | 981 Handle<JSFunction> function, |
| 979 Label* miss); | 982 Label* miss); |
| 980 | 983 |
| 981 // Generates a jump to CallIC miss stub. | 984 // Generates a jump to CallIC miss stub. |
| 982 void GenerateMissBranch(); | 985 void GenerateMissBranch(); |
| 983 | 986 |
| 984 const ParameterCount arguments_; | 987 const ParameterCount arguments_; |
| 985 const Code::Kind kind_; | 988 const Code::Kind kind_; |
| 986 const Code::ExtraICState extra_state_; | 989 const ExtraICState extra_state_; |
| 987 const InlineCacheHolderFlag cache_holder_; | 990 const InlineCacheHolderFlag cache_holder_; |
| 988 }; | 991 }; |
| 989 | 992 |
| 990 | 993 |
| 991 // Holds information about possible function call optimizations. | 994 // Holds information about possible function call optimizations. |
| 992 class CallOptimization BASE_EMBEDDED { | 995 class CallOptimization BASE_EMBEDDED { |
| 993 public: | 996 public: |
| 994 explicit CallOptimization(LookupResult* lookup); | 997 explicit CallOptimization(LookupResult* lookup); |
| 995 | 998 |
| 996 explicit CallOptimization(Handle<JSFunction> function); | 999 explicit CallOptimization(Handle<JSFunction> function); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 Handle<JSFunction> constant_function_; | 1042 Handle<JSFunction> constant_function_; |
| 1040 bool is_simple_api_call_; | 1043 bool is_simple_api_call_; |
| 1041 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1044 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1042 Handle<CallHandlerInfo> api_call_info_; | 1045 Handle<CallHandlerInfo> api_call_info_; |
| 1043 }; | 1046 }; |
| 1044 | 1047 |
| 1045 | 1048 |
| 1046 } } // namespace v8::internal | 1049 } } // namespace v8::internal |
| 1047 | 1050 |
| 1048 #endif // V8_STUB_CACHE_H_ | 1051 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |