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_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 V(ArgumentsAccess) \ | 23 V(ArgumentsAccess) \ |
24 V(ArrayConstructor) \ | 24 V(ArrayConstructor) \ |
25 V(BinaryOpICWithAllocationSite) \ | 25 V(BinaryOpICWithAllocationSite) \ |
26 V(CallApiFunction) \ | 26 V(CallApiFunction) \ |
27 V(CallApiAccessor) \ | 27 V(CallApiAccessor) \ |
28 V(CallApiGetter) \ | 28 V(CallApiGetter) \ |
29 V(CallConstruct) \ | 29 V(CallConstruct) \ |
30 V(CallFunction) \ | 30 V(CallFunction) \ |
31 V(CallIC) \ | 31 V(CallIC) \ |
32 V(CallIC_Array) \ | 32 V(CallIC_Array) \ |
33 V(CallIC_Round) \ | |
34 V(CallIC_Floor) \ | |
35 V(CallIC_Ceil) \ | |
36 V(CEntry) \ | 33 V(CEntry) \ |
37 V(CompareIC) \ | 34 V(CompareIC) \ |
38 V(DoubleToI) \ | 35 V(DoubleToI) \ |
39 V(FunctionPrototype) \ | 36 V(FunctionPrototype) \ |
40 V(Instanceof) \ | 37 V(Instanceof) \ |
41 V(InternalArrayConstructor) \ | 38 V(InternalArrayConstructor) \ |
42 V(JSEntry) \ | 39 V(JSEntry) \ |
43 V(KeyedLoadICTrampoline) \ | 40 V(KeyedLoadICTrampoline) \ |
44 V(LoadICTrampoline) \ | 41 V(LoadICTrampoline) \ |
45 V(CallICTrampoline) \ | 42 V(CallICTrampoline) \ |
46 V(CallIC_ArrayTrampoline) \ | 43 V(CallIC_ArrayTrampoline) \ |
47 V(CallIC_RoundTrampoline) \ | |
48 V(CallIC_FloorTrampoline) \ | |
49 V(CallIC_CeilTrampoline) \ | |
50 V(LoadIndexedInterceptor) \ | 44 V(LoadIndexedInterceptor) \ |
51 V(LoadIndexedString) \ | 45 V(LoadIndexedString) \ |
52 V(MathPow) \ | 46 V(MathPow) \ |
53 V(ProfileEntryHook) \ | 47 V(ProfileEntryHook) \ |
54 V(RecordWrite) \ | 48 V(RecordWrite) \ |
55 V(RegExpExec) \ | 49 V(RegExpExec) \ |
56 V(StoreArrayLiteralElement) \ | 50 V(StoreArrayLiteralElement) \ |
57 V(StoreBufferOverflow) \ | 51 V(StoreBufferOverflow) \ |
58 V(StoreElement) \ | 52 V(StoreElement) \ |
59 V(StringCompare) \ | 53 V(StringCompare) \ |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 840 } |
847 | 841 |
848 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 842 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
849 | 843 |
850 InlineCacheState GetICState() const override { return DEFAULT; } | 844 InlineCacheState GetICState() const override { return DEFAULT; } |
851 | 845 |
852 ExtraICState GetExtraICState() const final { | 846 ExtraICState GetExtraICState() const final { |
853 return static_cast<ExtraICState>(minor_key_); | 847 return static_cast<ExtraICState>(minor_key_); |
854 } | 848 } |
855 | 849 |
856 static const int kHasReturnedMinusZeroSentinel = 1; | |
857 | |
858 protected: | 850 protected: |
859 bool CallAsMethod() const { | 851 bool CallAsMethod() const { |
860 return state().call_type() == CallICState::METHOD; | 852 return state().call_type() == CallICState::METHOD; |
861 } | 853 } |
862 | 854 |
863 int arg_count() const { return state().arg_count(); } | 855 int arg_count() const { return state().arg_count(); } |
864 | 856 |
865 CallICState state() const { | 857 CallICState state() const { |
866 return CallICState(static_cast<ExtraICState>(minor_key_)); | 858 return CallICState(static_cast<ExtraICState>(minor_key_)); |
867 } | 859 } |
868 | 860 |
869 // Code generation helpers. | 861 // Code generation helpers. |
870 void GenerateMiss(MacroAssembler* masm); | 862 void GenerateMiss(MacroAssembler* masm); |
871 | 863 |
872 private: | 864 private: |
873 void PrintState(std::ostream& os) const override; // NOLINT | 865 void PrintState(std::ostream& os) const override; // NOLINT |
874 | 866 |
875 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); | 867 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); |
876 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | 868 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
877 }; | 869 }; |
878 | 870 |
879 | 871 |
880 class CallIC_RoundStub : public CallICStub { | |
881 public: | |
882 CallIC_RoundStub(Isolate* isolate, const CallICState& state_in) | |
883 : CallICStub(isolate, state_in) {} | |
884 | |
885 InlineCacheState GetICState() const final { return MONOMORPHIC; } | |
886 | |
887 private: | |
888 void PrintState(std::ostream& os) const override; // NOLINT | |
889 | |
890 DEFINE_PLATFORM_CODE_STUB(CallIC_Round, CallICStub); | |
891 }; | |
892 | |
893 | |
894 class CallIC_FloorStub : public CallICStub { | |
895 public: | |
896 CallIC_FloorStub(Isolate* isolate, const CallICState& state_in) | |
897 : CallICStub(isolate, state_in) {} | |
898 | |
899 InlineCacheState GetICState() const final { return MONOMORPHIC; } | |
900 | |
901 private: | |
902 void PrintState(std::ostream& os) const override; // NOLINT | |
903 | |
904 DEFINE_PLATFORM_CODE_STUB(CallIC_Floor, CallICStub); | |
905 }; | |
906 | |
907 | |
908 class CallIC_CeilStub : public CallICStub { | |
909 public: | |
910 CallIC_CeilStub(Isolate* isolate, const CallICState& state_in) | |
911 : CallICStub(isolate, state_in) {} | |
912 | |
913 InlineCacheState GetICState() const final { return MONOMORPHIC; } | |
914 | |
915 private: | |
916 void PrintState(std::ostream& os) const override; // NOLINT | |
917 | |
918 DEFINE_PLATFORM_CODE_STUB(CallIC_Ceil, CallICStub); | |
919 }; | |
920 | |
921 | |
922 class CallIC_ArrayStub: public CallICStub { | 872 class CallIC_ArrayStub: public CallICStub { |
923 public: | 873 public: |
924 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) | 874 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) |
925 : CallICStub(isolate, state_in) {} | 875 : CallICStub(isolate, state_in) {} |
926 | 876 |
927 InlineCacheState GetICState() const final { return MONOMORPHIC; } | 877 InlineCacheState GetICState() const final { return MONOMORPHIC; } |
928 | 878 |
929 private: | 879 private: |
930 void PrintState(std::ostream& os) const override; // NOLINT | 880 void PrintState(std::ostream& os) const override; // NOLINT |
931 | 881 |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { | 2074 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { |
2125 public: | 2075 public: |
2126 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) | 2076 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) |
2127 : CallICTrampolineStub(isolate, state) {} | 2077 : CallICTrampolineStub(isolate, state) {} |
2128 | 2078 |
2129 private: | 2079 private: |
2130 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); | 2080 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); |
2131 }; | 2081 }; |
2132 | 2082 |
2133 | 2083 |
2134 class CallIC_RoundTrampolineStub : public CallICTrampolineStub { | |
2135 public: | |
2136 CallIC_RoundTrampolineStub(Isolate* isolate, const CallICState& state) | |
2137 : CallICTrampolineStub(isolate, state) {} | |
2138 | |
2139 private: | |
2140 DEFINE_PLATFORM_CODE_STUB(CallIC_RoundTrampoline, CallICTrampolineStub); | |
2141 }; | |
2142 | |
2143 | |
2144 class CallIC_FloorTrampolineStub : public CallICTrampolineStub { | |
2145 public: | |
2146 CallIC_FloorTrampolineStub(Isolate* isolate, const CallICState& state) | |
2147 : CallICTrampolineStub(isolate, state) {} | |
2148 | |
2149 private: | |
2150 DEFINE_PLATFORM_CODE_STUB(CallIC_FloorTrampoline, CallICTrampolineStub); | |
2151 }; | |
2152 | |
2153 | |
2154 class CallIC_CeilTrampolineStub : public CallICTrampolineStub { | |
2155 public: | |
2156 CallIC_CeilTrampolineStub(Isolate* isolate, const CallICState& state) | |
2157 : CallICTrampolineStub(isolate, state) {} | |
2158 | |
2159 private: | |
2160 DEFINE_PLATFORM_CODE_STUB(CallIC_CeilTrampoline, CallICTrampolineStub); | |
2161 }; | |
2162 | |
2163 | |
2164 class MegamorphicLoadStub : public HydrogenCodeStub { | 2084 class MegamorphicLoadStub : public HydrogenCodeStub { |
2165 public: | 2085 public: |
2166 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) | 2086 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) |
2167 : HydrogenCodeStub(isolate) { | 2087 : HydrogenCodeStub(isolate) { |
2168 set_sub_minor_key(state.GetExtraICState()); | 2088 set_sub_minor_key(state.GetExtraICState()); |
2169 } | 2089 } |
2170 | 2090 |
2171 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2091 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2172 | 2092 |
2173 InlineCacheState GetICState() const final { return MEGAMORPHIC; } | 2093 InlineCacheState GetICState() const final { return MEGAMORPHIC; } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 | 2797 |
2878 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2798 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2879 #undef DEFINE_PLATFORM_CODE_STUB | 2799 #undef DEFINE_PLATFORM_CODE_STUB |
2880 #undef DEFINE_HANDLER_CODE_STUB | 2800 #undef DEFINE_HANDLER_CODE_STUB |
2881 #undef DEFINE_HYDROGEN_CODE_STUB | 2801 #undef DEFINE_HYDROGEN_CODE_STUB |
2882 #undef DEFINE_CODE_STUB | 2802 #undef DEFINE_CODE_STUB |
2883 #undef DEFINE_CODE_STUB_BASE | 2803 #undef DEFINE_CODE_STUB_BASE |
2884 } } // namespace v8::internal | 2804 } } // namespace v8::internal |
2885 | 2805 |
2886 #endif // V8_CODE_STUBS_H_ | 2806 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |