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) \ |
33 V(CEntry) \ | 36 V(CEntry) \ |
34 V(CompareIC) \ | 37 V(CompareIC) \ |
35 V(DoubleToI) \ | 38 V(DoubleToI) \ |
36 V(FunctionPrototype) \ | 39 V(FunctionPrototype) \ |
37 V(Instanceof) \ | 40 V(Instanceof) \ |
38 V(InternalArrayConstructor) \ | 41 V(InternalArrayConstructor) \ |
39 V(JSEntry) \ | 42 V(JSEntry) \ |
40 V(KeyedLoadICTrampoline) \ | 43 V(KeyedLoadICTrampoline) \ |
41 V(LoadICTrampoline) \ | 44 V(LoadICTrampoline) \ |
42 V(CallICTrampoline) \ | 45 V(CallICTrampoline) \ |
43 V(CallIC_ArrayTrampoline) \ | 46 V(CallIC_ArrayTrampoline) \ |
| 47 V(CallIC_RoundTrampoline) \ |
| 48 V(CallIC_FloorTrampoline) \ |
| 49 V(CallIC_CeilTrampoline) \ |
44 V(LoadIndexedInterceptor) \ | 50 V(LoadIndexedInterceptor) \ |
45 V(LoadIndexedString) \ | 51 V(LoadIndexedString) \ |
46 V(MathPow) \ | 52 V(MathPow) \ |
47 V(ProfileEntryHook) \ | 53 V(ProfileEntryHook) \ |
48 V(RecordWrite) \ | 54 V(RecordWrite) \ |
49 V(RegExpExec) \ | 55 V(RegExpExec) \ |
50 V(StoreArrayLiteralElement) \ | 56 V(StoreArrayLiteralElement) \ |
51 V(StoreBufferOverflow) \ | 57 V(StoreBufferOverflow) \ |
52 V(StoreElement) \ | 58 V(StoreElement) \ |
53 V(StringCompare) \ | 59 V(StringCompare) \ |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 846 } |
841 | 847 |
842 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 848 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
843 | 849 |
844 InlineCacheState GetICState() const override { return DEFAULT; } | 850 InlineCacheState GetICState() const override { return DEFAULT; } |
845 | 851 |
846 ExtraICState GetExtraICState() const final { | 852 ExtraICState GetExtraICState() const final { |
847 return static_cast<ExtraICState>(minor_key_); | 853 return static_cast<ExtraICState>(minor_key_); |
848 } | 854 } |
849 | 855 |
| 856 static const int kHasReturnedMinusZeroSentinel = 1; |
| 857 |
850 protected: | 858 protected: |
851 bool CallAsMethod() const { | 859 bool CallAsMethod() const { |
852 return state().call_type() == CallICState::METHOD; | 860 return state().call_type() == CallICState::METHOD; |
853 } | 861 } |
854 | 862 |
855 int arg_count() const { return state().arg_count(); } | 863 int arg_count() const { return state().arg_count(); } |
856 | 864 |
857 CallICState state() const { | 865 CallICState state() const { |
858 return CallICState(static_cast<ExtraICState>(minor_key_)); | 866 return CallICState(static_cast<ExtraICState>(minor_key_)); |
859 } | 867 } |
860 | 868 |
861 // Code generation helpers. | 869 // Code generation helpers. |
862 void GenerateMiss(MacroAssembler* masm); | 870 void GenerateMiss(MacroAssembler* masm); |
863 | 871 |
864 private: | 872 private: |
865 void PrintState(std::ostream& os) const override; // NOLINT | 873 void PrintState(std::ostream& os) const override; // NOLINT |
866 | 874 |
867 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); | 875 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); |
868 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | 876 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
869 }; | 877 }; |
870 | 878 |
871 | 879 |
| 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 |
872 class CallIC_ArrayStub: public CallICStub { | 922 class CallIC_ArrayStub: public CallICStub { |
873 public: | 923 public: |
874 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) | 924 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) |
875 : CallICStub(isolate, state_in) {} | 925 : CallICStub(isolate, state_in) {} |
876 | 926 |
877 InlineCacheState GetICState() const final { return MONOMORPHIC; } | 927 InlineCacheState GetICState() const final { return MONOMORPHIC; } |
878 | 928 |
879 private: | 929 private: |
880 void PrintState(std::ostream& os) const override; // NOLINT | 930 void PrintState(std::ostream& os) const override; // NOLINT |
881 | 931 |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { | 2124 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { |
2075 public: | 2125 public: |
2076 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) | 2126 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) |
2077 : CallICTrampolineStub(isolate, state) {} | 2127 : CallICTrampolineStub(isolate, state) {} |
2078 | 2128 |
2079 private: | 2129 private: |
2080 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); | 2130 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); |
2081 }; | 2131 }; |
2082 | 2132 |
2083 | 2133 |
| 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 |
2084 class MegamorphicLoadStub : public HydrogenCodeStub { | 2164 class MegamorphicLoadStub : public HydrogenCodeStub { |
2085 public: | 2165 public: |
2086 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) | 2166 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) |
2087 : HydrogenCodeStub(isolate) { | 2167 : HydrogenCodeStub(isolate) { |
2088 set_sub_minor_key(state.GetExtraICState()); | 2168 set_sub_minor_key(state.GetExtraICState()); |
2089 } | 2169 } |
2090 | 2170 |
2091 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2171 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2092 | 2172 |
2093 InlineCacheState GetICState() const final { return MEGAMORPHIC; } | 2173 InlineCacheState GetICState() const final { return MEGAMORPHIC; } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2797 | 2877 |
2798 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2878 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2799 #undef DEFINE_PLATFORM_CODE_STUB | 2879 #undef DEFINE_PLATFORM_CODE_STUB |
2800 #undef DEFINE_HANDLER_CODE_STUB | 2880 #undef DEFINE_HANDLER_CODE_STUB |
2801 #undef DEFINE_HYDROGEN_CODE_STUB | 2881 #undef DEFINE_HYDROGEN_CODE_STUB |
2802 #undef DEFINE_CODE_STUB | 2882 #undef DEFINE_CODE_STUB |
2803 #undef DEFINE_CODE_STUB_BASE | 2883 #undef DEFINE_CODE_STUB_BASE |
2804 } } // namespace v8::internal | 2884 } } // namespace v8::internal |
2805 | 2885 |
2806 #endif // V8_CODE_STUBS_H_ | 2886 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |