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_RUNTIME_RUNTIME_H_ | 5 #ifndef V8_RUNTIME_RUNTIME_H_ |
6 #define V8_RUNTIME_RUNTIME_H_ | 6 #define V8_RUNTIME_RUNTIME_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 // The interface to C++ runtime functions. | 15 // The interface to C++ runtime functions. |
16 | 16 |
17 // ---------------------------------------------------------------------------- | 17 // ---------------------------------------------------------------------------- |
18 // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both | 18 // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both |
19 // release and debug mode. | 19 // release and debug mode. |
20 // This macro should only be used by the macro RUNTIME_FUNCTION_LIST. | 20 // This macro should only be used by the macro RUNTIME_FUNCTION_LIST. |
21 | 21 |
22 // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused | 22 // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused |
23 // MSVC Intellisense to crash. It was broken into two macros to work around | 23 // MSVC Intellisense to crash. It was broken into two macros to work around |
24 // this problem. Please avoid large recursive macros whenever possible. | 24 // this problem. Please avoid large recursive macros whenever possible. |
25 #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ | 25 #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
26 /* Property access */ \ | 26 /* Property access */ \ |
27 F(GetProperty, 2, 1) \ | 27 F(GetProperty, 2, 1) \ |
28 F(KeyedGetProperty, 2, 1) \ | 28 F(KeyedGetProperty, 2, 1) \ |
29 F(DeleteProperty, 3, 1) \ | 29 F(DeleteProperty, 3, 1) \ |
30 F(HasOwnProperty, 2, 1) \ | 30 F(HasOwnProperty, 2, 1) \ |
31 F(HasProperty, 2, 1) \ | 31 F(HasProperty, 2, 1) \ |
32 F(HasElement, 2, 1) \ | 32 F(HasElement, 2, 1) \ |
33 F(IsPropertyEnumerable, 2, 1) \ | 33 F(IsPropertyEnumerable, 2, 1) \ |
34 F(GetPropertyNames, 1, 1) \ | 34 F(GetPropertyNames, 1, 1) \ |
35 F(GetPropertyNamesFast, 1, 1) \ | 35 F(GetPropertyNamesFast, 1, 1) \ |
36 F(GetOwnPropertyNames, 2, 1) \ | 36 F(GetOwnPropertyNames, 2, 1) \ |
37 F(GetOwnElementNames, 1, 1) \ | 37 F(GetOwnElementNames, 1, 1) \ |
38 F(GetInterceptorInfo, 1, 1) \ | 38 F(GetInterceptorInfo, 1, 1) \ |
39 F(GetNamedInterceptorPropertyNames, 1, 1) \ | 39 F(GetNamedInterceptorPropertyNames, 1, 1) \ |
40 F(GetIndexedInterceptorElementNames, 1, 1) \ | 40 F(GetIndexedInterceptorElementNames, 1, 1) \ |
41 F(GetArgumentsProperty, 1, 1) \ | 41 F(GetArgumentsProperty, 1, 1) \ |
42 F(ToFastProperties, 1, 1) \ | 42 F(ToFastProperties, 1, 1) \ |
43 F(FinishArrayPrototypeSetup, 1, 1) \ | 43 F(FinishArrayPrototypeSetup, 1, 1) \ |
44 F(SpecialArrayFunctions, 0, 1) \ | 44 F(SpecialArrayFunctions, 0, 1) \ |
45 F(IsSloppyModeFunction, 1, 1) \ | 45 F(IsSloppyModeFunction, 1, 1) \ |
46 F(GetDefaultReceiver, 1, 1) \ | 46 F(GetDefaultReceiver, 1, 1) \ |
47 \ | 47 \ |
48 F(SetPrototype, 2, 1) \ | 48 F(SetPrototype, 2, 1) \ |
49 F(InternalSetPrototype, 2, 1) \ | 49 F(InternalSetPrototype, 2, 1) \ |
50 F(IsInPrototypeChain, 2, 1) \ | 50 F(IsInPrototypeChain, 2, 1) \ |
51 \ | 51 \ |
52 F(GetOwnProperty, 2, 1) \ | 52 F(GetOwnProperty, 2, 1) \ |
53 \ | 53 \ |
54 F(IsExtensible, 1, 1) \ | 54 F(IsExtensible, 1, 1) \ |
55 F(PreventExtensions, 1, 1) \ | 55 F(PreventExtensions, 1, 1) \ |
56 \ | 56 \ |
57 /* Utilities */ \ | 57 /* Utilities */ \ |
58 F(CheckIsBootstrapping, 0, 1) \ | 58 F(CheckIsBootstrapping, 0, 1) \ |
59 F(GetRootNaN, 0, 1) \ | 59 F(GetRootNaN, 0, 1) \ |
60 F(Call, -1 /* >= 2 */, 1) \ | 60 F(Call, -1 /* >= 2 */, 1) \ |
61 F(Apply, 5, 1) \ | 61 F(Apply, 5, 1) \ |
62 F(GetFunctionDelegate, 1, 1) \ | 62 F(GetFunctionDelegate, 1, 1) \ |
63 F(GetConstructorDelegate, 1, 1) \ | 63 F(GetConstructorDelegate, 1, 1) \ |
64 F(DeoptimizeFunction, 1, 1) \ | 64 F(DeoptimizeFunction, 1, 1) \ |
65 F(ClearFunctionTypeFeedback, 1, 1) \ | 65 F(ClearFunctionTypeFeedback, 1, 1) \ |
66 F(RunningInSimulator, 0, 1) \ | 66 F(RunningInSimulator, 0, 1) \ |
67 F(IsConcurrentRecompilationSupported, 0, 1) \ | 67 F(IsConcurrentRecompilationSupported, 0, 1) \ |
68 F(OptimizeFunctionOnNextCall, -1, 1) \ | 68 F(OptimizeFunctionOnNextCall, -1, 1) \ |
69 F(OptimizeOsr, 0, 1) \ | 69 F(OptimizeOsr, 0, 1) \ |
70 F(NeverOptimizeFunction, 1, 1) \ | 70 F(NeverOptimizeFunction, 1, 1) \ |
71 F(GetOptimizationStatus, -1, 1) \ | 71 F(GetOptimizationStatus, -1, 1) \ |
72 F(GetOptimizationCount, 1, 1) \ | 72 F(GetOptimizationCount, 1, 1) \ |
73 F(UnblockConcurrentRecompilation, 0, 1) \ | 73 F(UnblockConcurrentRecompilation, 0, 1) \ |
74 F(CompileForOnStackReplacement, 1, 1) \ | 74 F(CompileForOnStackReplacement, 1, 1) \ |
75 F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ | 75 F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ |
76 F(SetNativeFlag, 1, 1) \ | 76 F(SetNativeFlag, 1, 1) \ |
77 F(IsConstructor, 1, 1) \ | 77 F(IsConstructor, 1, 1) \ |
78 F(SetInlineBuiltinFlag, 1, 1) \ | 78 F(SetInlineBuiltinFlag, 1, 1) \ |
79 F(StoreArrayLiteralElement, 5, 1) \ | 79 F(StoreArrayLiteralElement, 5, 1) \ |
80 F(DebugPrepareStepInIfStepping, 1, 1) \ | 80 F(DebugPrepareStepInIfStepping, 1, 1) \ |
81 F(DebugPushPromise, 1, 1) \ | 81 F(DebugPushPromise, 1, 1) \ |
82 F(DebugPopPromise, 0, 1) \ | 82 F(DebugPopPromise, 0, 1) \ |
83 F(DebugPromiseEvent, 1, 1) \ | 83 F(DebugPromiseEvent, 1, 1) \ |
84 F(DebugAsyncTaskEvent, 1, 1) \ | 84 F(DebugAsyncTaskEvent, 1, 1) \ |
85 F(PromiseRejectEvent, 3, 1) \ | 85 F(PromiseRejectEvent, 3, 1) \ |
86 F(PromiseRevokeReject, 1, 1) \ | 86 F(PromiseRevokeReject, 1, 1) \ |
87 F(PromiseHasHandlerSymbol, 0, 1) \ | 87 F(PromiseHasHandlerSymbol, 0, 1) \ |
88 F(FlattenString, 1, 1) \ | 88 F(FlattenString, 1, 1) \ |
89 F(LoadMutableDouble, 2, 1) \ | 89 F(LoadMutableDouble, 2, 1) \ |
90 F(TryMigrateInstance, 1, 1) \ | 90 F(TryMigrateInstance, 1, 1) \ |
91 F(NotifyContextDisposed, 0, 1) \ | 91 F(NotifyContextDisposed, 0, 1) \ |
92 F(ThrowIteratorResultNotAnObject, 1, 1) \ | 92 \ |
93 \ | 93 /* Array join support */ \ |
94 /* Array join support */ \ | 94 F(PushIfAbsent, 2, 1) \ |
95 F(PushIfAbsent, 2, 1) \ | 95 F(ArrayConcat, 1, 1) \ |
96 F(ArrayConcat, 1, 1) \ | 96 \ |
97 \ | 97 /* Conversions */ \ |
98 /* Conversions */ \ | 98 F(ToBool, 1, 1) \ |
99 F(ToBool, 1, 1) \ | 99 F(Typeof, 1, 1) \ |
100 F(Typeof, 1, 1) \ | 100 \ |
101 \ | 101 F(StringToNumber, 1, 1) \ |
102 F(StringToNumber, 1, 1) \ | 102 F(StringParseInt, 2, 1) \ |
103 F(StringParseInt, 2, 1) \ | 103 F(StringParseFloat, 1, 1) \ |
104 F(StringParseFloat, 1, 1) \ | 104 F(StringToLowerCase, 1, 1) \ |
105 F(StringToLowerCase, 1, 1) \ | 105 F(StringToUpperCase, 1, 1) \ |
106 F(StringToUpperCase, 1, 1) \ | 106 F(StringSplit, 3, 1) \ |
107 F(StringSplit, 3, 1) \ | 107 F(CharFromCode, 1, 1) \ |
108 F(CharFromCode, 1, 1) \ | 108 F(URIEscape, 1, 1) \ |
109 F(URIEscape, 1, 1) \ | 109 F(URIUnescape, 1, 1) \ |
110 F(URIUnescape, 1, 1) \ | 110 \ |
111 \ | 111 F(NumberToInteger, 1, 1) \ |
112 F(NumberToInteger, 1, 1) \ | 112 F(NumberToIntegerMapMinusZero, 1, 1) \ |
113 F(NumberToIntegerMapMinusZero, 1, 1) \ | 113 F(NumberToJSUint32, 1, 1) \ |
114 F(NumberToJSUint32, 1, 1) \ | 114 F(NumberToJSInt32, 1, 1) \ |
115 F(NumberToJSInt32, 1, 1) \ | 115 \ |
116 \ | 116 /* Arithmetic operations */ \ |
117 /* Arithmetic operations */ \ | 117 F(NumberAdd, 2, 1) \ |
118 F(NumberAdd, 2, 1) \ | 118 F(NumberSub, 2, 1) \ |
119 F(NumberSub, 2, 1) \ | 119 F(NumberMul, 2, 1) \ |
120 F(NumberMul, 2, 1) \ | 120 F(NumberDiv, 2, 1) \ |
121 F(NumberDiv, 2, 1) \ | 121 F(NumberMod, 2, 1) \ |
122 F(NumberMod, 2, 1) \ | 122 F(NumberUnaryMinus, 1, 1) \ |
123 F(NumberUnaryMinus, 1, 1) \ | 123 F(NumberImul, 2, 1) \ |
124 F(NumberImul, 2, 1) \ | 124 \ |
125 \ | 125 F(StringBuilderConcat, 3, 1) \ |
126 F(StringBuilderConcat, 3, 1) \ | 126 F(StringBuilderJoin, 3, 1) \ |
127 F(StringBuilderJoin, 3, 1) \ | 127 F(SparseJoinWithSeparator, 3, 1) \ |
128 F(SparseJoinWithSeparator, 3, 1) \ | 128 \ |
129 \ | 129 /* Bit operations */ \ |
130 /* Bit operations */ \ | 130 F(NumberOr, 2, 1) \ |
131 F(NumberOr, 2, 1) \ | 131 F(NumberAnd, 2, 1) \ |
132 F(NumberAnd, 2, 1) \ | 132 F(NumberXor, 2, 1) \ |
133 F(NumberXor, 2, 1) \ | 133 \ |
134 \ | 134 F(NumberShl, 2, 1) \ |
135 F(NumberShl, 2, 1) \ | 135 F(NumberShr, 2, 1) \ |
136 F(NumberShr, 2, 1) \ | 136 F(NumberSar, 2, 1) \ |
137 F(NumberSar, 2, 1) \ | 137 \ |
138 \ | 138 /* Comparisons */ \ |
139 /* Comparisons */ \ | 139 F(NumberEquals, 2, 1) \ |
140 F(NumberEquals, 2, 1) \ | 140 F(StringEquals, 2, 1) \ |
141 F(StringEquals, 2, 1) \ | 141 \ |
142 \ | 142 F(NumberCompare, 3, 1) \ |
143 F(NumberCompare, 3, 1) \ | 143 F(SmiLexicographicCompare, 2, 1) \ |
144 F(SmiLexicographicCompare, 2, 1) \ | 144 \ |
145 \ | 145 /* Math */ \ |
146 /* Math */ \ | 146 F(MathAcos, 1, 1) \ |
147 F(MathAcos, 1, 1) \ | 147 F(MathAsin, 1, 1) \ |
148 F(MathAsin, 1, 1) \ | 148 F(MathAtan, 1, 1) \ |
149 F(MathAtan, 1, 1) \ | 149 F(MathFloorRT, 1, 1) \ |
150 F(MathFloorRT, 1, 1) \ | 150 F(MathAtan2, 2, 1) \ |
151 F(MathAtan2, 2, 1) \ | 151 F(MathExpRT, 1, 1) \ |
152 F(MathExpRT, 1, 1) \ | 152 F(RoundNumber, 1, 1) \ |
153 F(RoundNumber, 1, 1) \ | 153 F(MathFround, 1, 1) \ |
154 F(MathFround, 1, 1) \ | 154 F(RemPiO2, 2, 1) \ |
155 F(RemPiO2, 2, 1) \ | 155 \ |
156 \ | 156 /* Regular expressions */ \ |
157 /* Regular expressions */ \ | 157 F(RegExpInitializeAndCompile, 3, 1) \ |
158 F(RegExpInitializeAndCompile, 3, 1) \ | 158 F(RegExpExecMultiple, 4, 1) \ |
159 F(RegExpExecMultiple, 4, 1) \ | 159 \ |
160 \ | 160 /* JSON */ \ |
161 /* JSON */ \ | 161 F(ParseJson, 1, 1) \ |
162 F(ParseJson, 1, 1) \ | 162 F(BasicJSONStringify, 1, 1) \ |
163 F(BasicJSONStringify, 1, 1) \ | 163 F(QuoteJSONString, 1, 1) \ |
164 F(QuoteJSONString, 1, 1) \ | 164 \ |
165 \ | 165 /* Strings */ \ |
166 /* Strings */ \ | 166 F(StringIndexOf, 3, 1) \ |
167 F(StringIndexOf, 3, 1) \ | 167 F(StringLastIndexOf, 3, 1) \ |
168 F(StringLastIndexOf, 3, 1) \ | 168 F(StringLocaleCompare, 2, 1) \ |
169 F(StringLocaleCompare, 2, 1) \ | 169 F(StringReplaceGlobalRegExpWithString, 4, 1) \ |
170 F(StringReplaceGlobalRegExpWithString, 4, 1) \ | 170 F(StringReplaceOneCharWithString, 3, 1) \ |
171 F(StringReplaceOneCharWithString, 3, 1) \ | 171 F(StringMatch, 3, 1) \ |
172 F(StringMatch, 3, 1) \ | 172 F(StringTrim, 3, 1) \ |
173 F(StringTrim, 3, 1) \ | 173 F(StringToArray, 2, 1) \ |
174 F(StringToArray, 2, 1) \ | 174 F(NewStringWrapper, 1, 1) \ |
175 F(NewStringWrapper, 1, 1) \ | 175 F(NewString, 2, 1) \ |
176 F(NewString, 2, 1) \ | 176 F(TruncateString, 2, 1) \ |
177 F(TruncateString, 2, 1) \ | 177 \ |
178 \ | 178 /* Numbers */ \ |
179 /* Numbers */ \ | 179 F(NumberToRadixString, 2, 1) \ |
180 F(NumberToRadixString, 2, 1) \ | 180 F(NumberToFixed, 2, 1) \ |
181 F(NumberToFixed, 2, 1) \ | 181 F(NumberToExponential, 2, 1) \ |
182 F(NumberToExponential, 2, 1) \ | 182 F(NumberToPrecision, 2, 1) \ |
183 F(NumberToPrecision, 2, 1) \ | 183 F(IsValidSmi, 1, 1) \ |
184 F(IsValidSmi, 1, 1) \ | 184 \ |
185 \ | 185 /* Classes support */ \ |
186 /* Classes support */ \ | 186 F(ToMethod, 2, 1) \ |
187 F(ToMethod, 2, 1) \ | 187 F(HomeObjectSymbol, 0, 1) \ |
188 F(HomeObjectSymbol, 0, 1) \ | 188 F(DefineClass, 6, 1) \ |
189 F(DefineClass, 6, 1) \ | 189 F(DefineClassMethod, 3, 1) \ |
190 F(DefineClassMethod, 3, 1) \ | 190 F(ClassGetSourceCode, 1, 1) \ |
191 F(ClassGetSourceCode, 1, 1) \ | 191 F(LoadFromSuper, 3, 1) \ |
192 F(LoadFromSuper, 3, 1) \ | 192 F(LoadKeyedFromSuper, 3, 1) \ |
193 F(LoadKeyedFromSuper, 3, 1) \ | 193 F(ThrowConstructorNonCallableError, 0, 1) \ |
194 F(ThrowConstructorNonCallableError, 0, 1) \ | 194 F(ThrowNonMethodError, 0, 1) \ |
195 F(ThrowNonMethodError, 0, 1) \ | 195 F(ThrowUnsupportedSuperError, 0, 1) \ |
196 F(ThrowUnsupportedSuperError, 0, 1) \ | 196 F(HandleStepInForDerivedConstructors, 1, 1) \ |
197 F(HandleStepInForDerivedConstructors, 1, 1) \ | 197 F(StoreToSuper_Strict, 4, 1) \ |
198 F(StoreToSuper_Strict, 4, 1) \ | 198 F(StoreToSuper_Sloppy, 4, 1) \ |
199 F(StoreToSuper_Sloppy, 4, 1) \ | 199 F(StoreKeyedToSuper_Strict, 4, 1) \ |
200 F(StoreKeyedToSuper_Strict, 4, 1) \ | |
201 F(StoreKeyedToSuper_Sloppy, 4, 1) | 200 F(StoreKeyedToSuper_Sloppy, 4, 1) |
202 | 201 |
203 | 202 |
204 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 203 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
205 /* Reflection */ \ | 204 /* Reflection */ \ |
206 F(FunctionSetInstanceClassName, 2, 1) \ | 205 F(FunctionSetInstanceClassName, 2, 1) \ |
207 F(FunctionSetLength, 2, 1) \ | 206 F(FunctionSetLength, 2, 1) \ |
208 F(FunctionSetPrototype, 2, 1) \ | 207 F(FunctionSetPrototype, 2, 1) \ |
209 F(FunctionGetName, 1, 1) \ | 208 F(FunctionGetName, 1, 1) \ |
210 F(FunctionSetName, 2, 1) \ | 209 F(FunctionSetName, 2, 1) \ |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 897 |
899 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 898 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
900 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 899 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
901 STATIC_ASSERT(LANGUAGE_END == 3); | 900 STATIC_ASSERT(LANGUAGE_END == 3); |
902 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 901 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
903 | 902 |
904 } // namespace internal | 903 } // namespace internal |
905 } // namespace v8 | 904 } // namespace v8 |
906 | 905 |
907 #endif // V8_RUNTIME_RUNTIME_H_ | 906 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |