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_H_ | 5 #ifndef V8_RUNTIME_H_ |
6 #define V8_RUNTIME_H_ | 6 #define V8_RUNTIME_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 // The interface to C++ runtime functions. | 14 // The interface to C++ runtime functions. |
15 | 15 |
16 // ---------------------------------------------------------------------------- | 16 // ---------------------------------------------------------------------------- |
17 // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both | 17 // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both |
18 // release and debug mode. | 18 // release and debug mode. |
19 // This macro should only be used by the macro RUNTIME_FUNCTION_LIST. | 19 // This macro should only be used by the macro RUNTIME_FUNCTION_LIST. |
20 | 20 |
21 // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused | 21 // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused |
22 // MSVC Intellisense to crash. It was broken into two macros to work around | 22 // MSVC Intellisense to crash. It was broken into two macros to work around |
23 // this problem. Please avoid large recursive macros whenever possible. | 23 // this problem. Please avoid large recursive macros whenever possible. |
24 #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ | 24 #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
25 /* Property access */ \ | 25 /* Property access */ \ |
26 F(GetProperty, 2, 1) \ | 26 F(GetProperty, 2, 1) \ |
27 F(KeyedGetProperty, 2, 1) \ | 27 F(KeyedGetProperty, 2, 1) \ |
28 F(DeleteProperty, 3, 1) \ | 28 F(DeleteProperty, 3, 1) \ |
29 F(HasOwnProperty, 2, 1) \ | 29 F(HasOwnProperty, 2, 1) \ |
30 F(HasProperty, 2, 1) \ | 30 F(HasProperty, 2, 1) \ |
31 F(HasElement, 2, 1) \ | 31 F(HasElement, 2, 1) \ |
32 F(IsPropertyEnumerable, 2, 1) \ | 32 F(IsPropertyEnumerable, 2, 1) \ |
33 F(GetPropertyNames, 1, 1) \ | 33 F(GetPropertyNames, 1, 1) \ |
34 F(GetPropertyNamesFast, 1, 1) \ | 34 F(GetPropertyNamesFast, 1, 1) \ |
35 F(GetOwnPropertyNames, 2, 1) \ | 35 F(GetOwnPropertyNames, 2, 1) \ |
36 F(GetOwnElementNames, 1, 1) \ | 36 F(GetOwnElementNames, 1, 1) \ |
37 F(GetInterceptorInfo, 1, 1) \ | 37 F(GetInterceptorInfo, 1, 1) \ |
38 F(GetNamedInterceptorPropertyNames, 1, 1) \ | 38 F(GetNamedInterceptorPropertyNames, 1, 1) \ |
39 F(GetIndexedInterceptorElementNames, 1, 1) \ | 39 F(GetIndexedInterceptorElementNames, 1, 1) \ |
40 F(GetArgumentsProperty, 1, 1) \ | 40 F(GetArgumentsProperty, 1, 1) \ |
41 F(ToFastProperties, 1, 1) \ | 41 F(ToFastProperties, 1, 1) \ |
42 F(FinishArrayPrototypeSetup, 1, 1) \ | 42 F(FinishArrayPrototypeSetup, 1, 1) \ |
43 F(SpecialArrayFunctions, 0, 1) \ | 43 F(SpecialArrayFunctions, 0, 1) \ |
44 F(IsSloppyModeFunction, 1, 1) \ | 44 F(IsSloppyModeFunction, 1, 1) \ |
45 F(GetDefaultReceiver, 1, 1) \ | 45 F(GetDefaultReceiver, 1, 1) \ |
46 \ | 46 \ |
47 F(GetPrototype, 1, 1) \ | 47 F(GetPrototype, 1, 1) \ |
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(NeverOptimizeFunction, 1, 1) \ | 69 F(NeverOptimizeFunction, 1, 1) \ |
70 F(GetOptimizationStatus, -1, 1) \ | 70 F(GetOptimizationStatus, -1, 1) \ |
71 F(GetOptimizationCount, 1, 1) \ | 71 F(GetOptimizationCount, 1, 1) \ |
72 F(UnblockConcurrentRecompilation, 0, 1) \ | 72 F(UnblockConcurrentRecompilation, 0, 1) \ |
73 F(CompileForOnStackReplacement, 1, 1) \ | 73 F(CompileForOnStackReplacement, 1, 1) \ |
74 F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ | 74 F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ |
75 F(SetNativeFlag, 1, 1) \ | 75 F(SetNativeFlag, 1, 1) \ |
76 F(SetInlineBuiltinFlag, 1, 1) \ | 76 F(SetInlineBuiltinFlag, 1, 1) \ |
77 F(StoreArrayLiteralElement, 5, 1) \ | 77 F(StoreArrayLiteralElement, 5, 1) \ |
78 F(DebugPrepareStepInIfStepping, 1, 1) \ | 78 F(DebugPrepareStepInIfStepping, 1, 1) \ |
79 F(DebugPushPromise, 1, 1) \ | 79 F(DebugPushPromise, 1, 1) \ |
80 F(DebugPopPromise, 0, 1) \ | 80 F(DebugPopPromise, 0, 1) \ |
81 F(DebugPromiseEvent, 1, 1) \ | 81 F(DebugPromiseEvent, 1, 1) \ |
82 F(DebugPromiseRejectEvent, 2, 1) \ | 82 F(DebugPromiseRejectEvent, 2, 1) \ |
83 F(DebugAsyncTaskEvent, 1, 1) \ | 83 F(DebugAsyncTaskEvent, 1, 1) \ |
84 F(FlattenString, 1, 1) \ | 84 F(FlattenString, 1, 1) \ |
85 F(LoadMutableDouble, 2, 1) \ | 85 F(LoadMutableDouble, 2, 1) \ |
86 F(TryMigrateInstance, 1, 1) \ | 86 F(TryMigrateInstance, 1, 1) \ |
87 F(NotifyContextDisposed, 0, 1) \ | 87 F(NotifyContextDisposed, 0, 1) \ |
88 \ | 88 \ |
89 /* Array join support */ \ | 89 /* Array join support */ \ |
90 F(PushIfAbsent, 2, 1) \ | 90 F(PushIfAbsent, 2, 1) \ |
91 F(ArrayConcat, 1, 1) \ | 91 F(ArrayConcat, 1, 1) \ |
92 \ | 92 \ |
93 /* Conversions */ \ | 93 /* Conversions */ \ |
94 F(ToBool, 1, 1) \ | 94 F(ToBool, 1, 1) \ |
95 F(Typeof, 1, 1) \ | 95 F(Typeof, 1, 1) \ |
96 \ | 96 \ |
97 F(Booleanize, 2, 1) /* TODO(turbofan): Only temporary */ \ | 97 F(Booleanize, 2, 1) /* TODO(turbofan): Only temporary */ \ |
98 \ | 98 \ |
99 F(StringToNumber, 1, 1) \ | 99 F(StringToNumber, 1, 1) \ |
100 F(StringParseInt, 2, 1) \ | 100 F(StringParseInt, 2, 1) \ |
101 F(StringParseFloat, 1, 1) \ | 101 F(StringParseFloat, 1, 1) \ |
102 F(StringToLowerCase, 1, 1) \ | 102 F(StringToLowerCase, 1, 1) \ |
103 F(StringToUpperCase, 1, 1) \ | 103 F(StringToUpperCase, 1, 1) \ |
104 F(StringSplit, 3, 1) \ | 104 F(StringSplit, 3, 1) \ |
105 F(CharFromCode, 1, 1) \ | 105 F(CharFromCode, 1, 1) \ |
106 F(URIEscape, 1, 1) \ | 106 F(URIEscape, 1, 1) \ |
107 F(URIUnescape, 1, 1) \ | 107 F(URIUnescape, 1, 1) \ |
108 \ | 108 \ |
109 F(NumberToInteger, 1, 1) \ | 109 F(NumberToInteger, 1, 1) \ |
110 F(NumberToIntegerMapMinusZero, 1, 1) \ | 110 F(NumberToIntegerMapMinusZero, 1, 1) \ |
111 F(NumberToJSUint32, 1, 1) \ | 111 F(NumberToJSUint32, 1, 1) \ |
112 F(NumberToJSInt32, 1, 1) \ | 112 F(NumberToJSInt32, 1, 1) \ |
113 \ | 113 \ |
114 /* Arithmetic operations */ \ | 114 /* Arithmetic operations */ \ |
115 F(NumberAdd, 2, 1) \ | 115 F(NumberAdd, 2, 1) \ |
116 F(NumberSub, 2, 1) \ | 116 F(NumberSub, 2, 1) \ |
117 F(NumberMul, 2, 1) \ | 117 F(NumberMul, 2, 1) \ |
118 F(NumberDiv, 2, 1) \ | 118 F(NumberDiv, 2, 1) \ |
119 F(NumberMod, 2, 1) \ | 119 F(NumberMod, 2, 1) \ |
120 F(NumberUnaryMinus, 1, 1) \ | 120 F(NumberUnaryMinus, 1, 1) \ |
121 F(NumberImul, 2, 1) \ | 121 F(NumberImul, 2, 1) \ |
122 \ | 122 \ |
123 F(StringBuilderConcat, 3, 1) \ | 123 F(StringBuilderConcat, 3, 1) \ |
124 F(StringBuilderJoin, 3, 1) \ | 124 F(StringBuilderJoin, 3, 1) \ |
125 F(SparseJoinWithSeparator, 3, 1) \ | 125 F(SparseJoinWithSeparator, 3, 1) \ |
126 \ | 126 \ |
127 /* Bit operations */ \ | 127 /* Bit operations */ \ |
128 F(NumberOr, 2, 1) \ | 128 F(NumberOr, 2, 1) \ |
129 F(NumberAnd, 2, 1) \ | 129 F(NumberAnd, 2, 1) \ |
130 F(NumberXor, 2, 1) \ | 130 F(NumberXor, 2, 1) \ |
131 \ | 131 \ |
132 F(NumberShl, 2, 1) \ | 132 F(NumberShl, 2, 1) \ |
133 F(NumberShr, 2, 1) \ | 133 F(NumberShr, 2, 1) \ |
134 F(NumberSar, 2, 1) \ | 134 F(NumberSar, 2, 1) \ |
135 \ | 135 \ |
136 /* Comparisons */ \ | 136 /* Comparisons */ \ |
137 F(NumberEquals, 2, 1) \ | 137 F(NumberEquals, 2, 1) \ |
138 F(StringEquals, 2, 1) \ | 138 F(StringEquals, 2, 1) \ |
139 \ | 139 \ |
140 F(NumberCompare, 3, 1) \ | 140 F(NumberCompare, 3, 1) \ |
141 F(SmiLexicographicCompare, 2, 1) \ | 141 F(SmiLexicographicCompare, 2, 1) \ |
142 \ | 142 \ |
143 /* Math */ \ | 143 /* Math */ \ |
144 F(MathAcos, 1, 1) \ | 144 F(MathAcos, 1, 1) \ |
145 F(MathAsin, 1, 1) \ | 145 F(MathAsin, 1, 1) \ |
146 F(MathAtan, 1, 1) \ | 146 F(MathAtan, 1, 1) \ |
147 F(MathFloorRT, 1, 1) \ | 147 F(MathFloorRT, 1, 1) \ |
148 F(MathAtan2, 2, 1) \ | 148 F(MathAtan2, 2, 1) \ |
149 F(MathExpRT, 1, 1) \ | 149 F(MathExpRT, 1, 1) \ |
150 F(RoundNumber, 1, 1) \ | 150 F(RoundNumber, 1, 1) \ |
151 F(MathFround, 1, 1) \ | 151 F(MathFround, 1, 1) \ |
152 F(RemPiO2, 1, 1) \ | 152 F(RemPiO2, 1, 1) \ |
153 \ | 153 \ |
154 /* Regular expressions */ \ | 154 /* Regular expressions */ \ |
155 F(RegExpCompile, 3, 1) \ | 155 F(RegExpCompile, 3, 1) \ |
156 F(RegExpExecMultiple, 4, 1) \ | 156 F(RegExpExecMultiple, 4, 1) \ |
157 F(RegExpInitializeObject, 5, 1) \ | 157 F(RegExpInitializeObject, 5, 1) \ |
158 \ | 158 \ |
159 /* JSON */ \ | 159 /* JSON */ \ |
160 F(ParseJson, 1, 1) \ | 160 F(ParseJson, 1, 1) \ |
161 F(BasicJSONStringify, 1, 1) \ | 161 F(BasicJSONStringify, 1, 1) \ |
162 F(QuoteJSONString, 1, 1) \ | 162 F(QuoteJSONString, 1, 1) \ |
163 \ | 163 \ |
164 /* Strings */ \ | 164 /* Strings */ \ |
165 F(StringIndexOf, 3, 1) \ | 165 F(StringIndexOf, 3, 1) \ |
166 F(StringLastIndexOf, 3, 1) \ | 166 F(StringLastIndexOf, 3, 1) \ |
167 F(StringLocaleCompare, 2, 1) \ | 167 F(StringLocaleCompare, 2, 1) \ |
168 F(StringReplaceGlobalRegExpWithString, 4, 1) \ | 168 F(StringReplaceGlobalRegExpWithString, 4, 1) \ |
169 F(StringReplaceOneCharWithString, 3, 1) \ | 169 F(StringReplaceOneCharWithString, 3, 1) \ |
170 F(StringMatch, 3, 1) \ | 170 F(StringMatch, 3, 1) \ |
171 F(StringTrim, 3, 1) \ | 171 F(StringTrim, 3, 1) \ |
172 F(StringToArray, 2, 1) \ | 172 F(StringToArray, 2, 1) \ |
173 F(NewStringWrapper, 1, 1) \ | 173 F(NewStringWrapper, 1, 1) \ |
174 F(NewString, 2, 1) \ | 174 F(NewString, 2, 1) \ |
175 F(TruncateString, 2, 1) \ | 175 F(TruncateString, 2, 1) \ |
176 \ | 176 \ |
177 /* Numbers */ \ | 177 /* Numbers */ \ |
178 F(NumberToRadixString, 2, 1) \ | 178 F(NumberToRadixString, 2, 1) \ |
179 F(NumberToFixed, 2, 1) \ | 179 F(NumberToFixed, 2, 1) \ |
180 F(NumberToExponential, 2, 1) \ | 180 F(NumberToExponential, 2, 1) \ |
181 F(NumberToPrecision, 2, 1) \ | 181 F(NumberToPrecision, 2, 1) \ |
182 F(IsValidSmi, 1, 1) | 182 F(IsValidSmi, 1, 1) \ |
| 183 \ |
| 184 /* Classes support */ \ |
| 185 F(ToMethod, 2, 1) \ |
| 186 F(HomeObjectSymbol, 0, 1) |
183 | 187 |
184 | 188 |
185 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 189 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
186 /* Reflection */ \ | 190 /* Reflection */ \ |
187 F(FunctionSetInstanceClassName, 2, 1) \ | 191 F(FunctionSetInstanceClassName, 2, 1) \ |
188 F(FunctionSetLength, 2, 1) \ | 192 F(FunctionSetLength, 2, 1) \ |
189 F(FunctionSetPrototype, 2, 1) \ | 193 F(FunctionSetPrototype, 2, 1) \ |
190 F(FunctionGetName, 1, 1) \ | 194 F(FunctionGetName, 1, 1) \ |
191 F(FunctionSetName, 2, 1) \ | 195 F(FunctionSetName, 2, 1) \ |
192 F(FunctionNameShouldPrintAsAnonymous, 1, 1) \ | 196 F(FunctionNameShouldPrintAsAnonymous, 1, 1) \ |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; | 904 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; |
901 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; | 905 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; |
902 | 906 |
903 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; | 907 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
904 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; | 908 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
905 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; | 909 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; |
906 | 910 |
907 } } // namespace v8::internal | 911 } } // namespace v8::internal |
908 | 912 |
909 #endif // V8_RUNTIME_H_ | 913 #endif // V8_RUNTIME_H_ |
OLD | NEW |