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(IsInPrototypeChain, 2, 1) \ | 49 F(IsInPrototypeChain, 2, 1) \ |
50 \ | 50 \ |
51 F(GetOwnProperty, 2, 1) \ | 51 F(GetOwnProperty, 2, 1) \ |
52 \ | 52 \ |
53 F(IsExtensible, 1, 1) \ | 53 F(IsExtensible, 1, 1) \ |
54 F(PreventExtensions, 1, 1)\ | 54 F(PreventExtensions, 1, 1) \ |
55 \ | 55 \ |
56 /* Utilities */ \ | 56 /* Utilities */ \ |
57 F(CheckIsBootstrapping, 0, 1) \ | 57 F(CheckIsBootstrapping, 0, 1) \ |
58 F(GetRootNaN, 0, 1) \ | 58 F(GetRootNaN, 0, 1) \ |
59 F(Call, -1 /* >= 2 */, 1) \ | 59 F(Call, -1 /* >= 2 */, 1) \ |
60 F(Apply, 5, 1) \ | 60 F(Apply, 5, 1) \ |
61 F(GetFunctionDelegate, 1, 1) \ | 61 F(GetFunctionDelegate, 1, 1) \ |
62 F(GetConstructorDelegate, 1, 1) \ | 62 F(GetConstructorDelegate, 1, 1) \ |
63 F(DeoptimizeFunction, 1, 1) \ | 63 F(DeoptimizeFunction, 1, 1) \ |
64 F(ClearFunctionTypeFeedback, 1, 1) \ | 64 F(ClearFunctionTypeFeedback, 1, 1) \ |
65 F(RunningInSimulator, 0, 1) \ | 65 F(RunningInSimulator, 0, 1) \ |
66 F(IsConcurrentRecompilationSupported, 0, 1) \ | 66 F(IsConcurrentRecompilationSupported, 0, 1) \ |
67 F(OptimizeFunctionOnNextCall, -1, 1) \ | 67 F(OptimizeFunctionOnNextCall, -1, 1) \ |
68 F(NeverOptimizeFunction, 1, 1) \ | 68 F(NeverOptimizeFunction, 1, 1) \ |
69 F(GetOptimizationStatus, -1, 1) \ | 69 F(GetOptimizationStatus, -1, 1) \ |
70 F(GetOptimizationCount, 1, 1) \ | 70 F(GetOptimizationCount, 1, 1) \ |
71 F(UnblockConcurrentRecompilation, 0, 1) \ | 71 F(UnblockConcurrentRecompilation, 0, 1) \ |
72 F(CompileForOnStackReplacement, 1, 1) \ | 72 F(CompileForOnStackReplacement, 1, 1) \ |
73 F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ | 73 F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ |
74 F(SetNativeFlag, 1, 1) \ | 74 F(SetNativeFlag, 1, 1) \ |
75 F(SetInlineBuiltinFlag, 1, 1) \ | 75 F(SetInlineBuiltinFlag, 1, 1) \ |
76 F(StoreArrayLiteralElement, 5, 1) \ | 76 F(StoreArrayLiteralElement, 5, 1) \ |
77 F(DebugPrepareStepInIfStepping, 1, 1) \ | 77 F(DebugPrepareStepInIfStepping, 1, 1) \ |
78 F(DebugPromiseHandlePrologue, 1, 1) \ | 78 F(DebugPromiseHandlePrologue, 1, 1) \ |
79 F(DebugPromiseHandleEpilogue, 0, 1) \ | 79 F(DebugPromiseHandleEpilogue, 0, 1) \ |
80 F(DebugPromiseEvent, 1, 1) \ | 80 F(DebugPromiseEvent, 1, 1) \ |
81 F(DebugAsyncTaskEvent, 1, 1) \ | 81 F(DebugAsyncTaskEvent, 1, 1) \ |
82 F(FlattenString, 1, 1) \ | 82 F(FlattenString, 1, 1) \ |
83 F(LoadMutableDouble, 2, 1) \ | 83 F(LoadMutableDouble, 2, 1) \ |
84 F(TryMigrateInstance, 1, 1) \ | 84 F(TryMigrateInstance, 1, 1) \ |
85 F(NotifyContextDisposed, 0, 1) \ | 85 F(NotifyContextDisposed, 0, 1) \ |
86 \ | 86 \ |
87 /* Array join support */ \ | 87 /* Array join support */ \ |
88 F(PushIfAbsent, 2, 1) \ | 88 F(PushIfAbsent, 2, 1) \ |
89 F(ArrayConcat, 1, 1) \ | 89 F(ArrayConcat, 1, 1) \ |
90 \ | 90 \ |
91 /* Conversions */ \ | 91 /* Conversions */ \ |
92 F(ToBool, 1, 1) \ | 92 F(ToBool, 1, 1) \ |
93 F(Typeof, 1, 1) \ | 93 F(Typeof, 1, 1) \ |
94 \ | 94 \ |
95 F(StringToNumber, 1, 1) \ | 95 F(StringToNumber, 1, 1) \ |
96 F(StringParseInt, 2, 1) \ | 96 F(StringParseInt, 2, 1) \ |
97 F(StringParseFloat, 1, 1) \ | 97 F(StringParseFloat, 1, 1) \ |
98 F(StringToLowerCase, 1, 1) \ | 98 F(StringToLowerCase, 1, 1) \ |
99 F(StringToUpperCase, 1, 1) \ | 99 F(StringToUpperCase, 1, 1) \ |
100 F(StringSplit, 3, 1) \ | 100 F(StringSplit, 3, 1) \ |
101 F(CharFromCode, 1, 1) \ | 101 F(CharFromCode, 1, 1) \ |
102 F(URIEscape, 1, 1) \ | 102 F(URIEscape, 1, 1) \ |
103 F(URIUnescape, 1, 1) \ | 103 F(URIUnescape, 1, 1) \ |
104 \ | 104 \ |
105 F(NumberToInteger, 1, 1) \ | 105 F(NumberToInteger, 1, 1) \ |
106 F(NumberToIntegerMapMinusZero, 1, 1) \ | 106 F(NumberToIntegerMapMinusZero, 1, 1) \ |
107 F(NumberToJSUint32, 1, 1) \ | 107 F(NumberToJSUint32, 1, 1) \ |
108 F(NumberToJSInt32, 1, 1) \ | 108 F(NumberToJSInt32, 1, 1) \ |
109 \ | 109 \ |
110 /* Arithmetic operations */ \ | 110 /* Arithmetic operations */ \ |
111 F(NumberAdd, 2, 1) \ | 111 F(NumberAdd, 2, 1) \ |
112 F(NumberSub, 2, 1) \ | 112 F(NumberSub, 2, 1) \ |
113 F(NumberMul, 2, 1) \ | 113 F(NumberMul, 2, 1) \ |
114 F(NumberDiv, 2, 1) \ | 114 F(NumberDiv, 2, 1) \ |
115 F(NumberMod, 2, 1) \ | 115 F(NumberMod, 2, 1) \ |
116 F(NumberUnaryMinus, 1, 1) \ | 116 F(NumberUnaryMinus, 1, 1) \ |
117 F(NumberImul, 2, 1) \ | 117 F(NumberImul, 2, 1) \ |
118 \ | 118 \ |
119 F(StringBuilderConcat, 3, 1) \ | 119 F(StringBuilderConcat, 3, 1) \ |
120 F(StringBuilderJoin, 3, 1) \ | 120 F(StringBuilderJoin, 3, 1) \ |
121 F(SparseJoinWithSeparator, 3, 1) \ | 121 F(SparseJoinWithSeparator, 3, 1) \ |
122 \ | 122 \ |
123 /* Bit operations */ \ | 123 /* Bit operations */ \ |
124 F(NumberOr, 2, 1) \ | 124 F(NumberOr, 2, 1) \ |
125 F(NumberAnd, 2, 1) \ | 125 F(NumberAnd, 2, 1) \ |
126 F(NumberXor, 2, 1) \ | 126 F(NumberXor, 2, 1) \ |
127 \ | 127 \ |
128 F(NumberShl, 2, 1) \ | 128 F(NumberShl, 2, 1) \ |
129 F(NumberShr, 2, 1) \ | 129 F(NumberShr, 2, 1) \ |
130 F(NumberSar, 2, 1) \ | 130 F(NumberSar, 2, 1) \ |
131 \ | 131 \ |
132 /* Comparisons */ \ | 132 /* Comparisons */ \ |
133 F(NumberEquals, 2, 1) \ | 133 F(NumberEquals, 2, 1) \ |
134 F(StringEquals, 2, 1) \ | 134 F(StringEquals, 2, 1) \ |
135 \ | 135 \ |
136 F(NumberCompare, 3, 1) \ | 136 F(NumberCompare, 3, 1) \ |
137 F(SmiLexicographicCompare, 2, 1) \ | 137 F(SmiLexicographicCompare, 2, 1) \ |
138 \ | 138 \ |
139 /* Math */ \ | 139 /* Math */ \ |
140 F(MathAcos, 1, 1) \ | 140 F(MathAcos, 1, 1) \ |
141 F(MathAsin, 1, 1) \ | 141 F(MathAsin, 1, 1) \ |
142 F(MathAtan, 1, 1) \ | 142 F(MathAtan, 1, 1) \ |
143 F(MathFloorRT, 1, 1) \ | 143 F(MathFloorRT, 1, 1) \ |
144 F(MathAtan2, 2, 1) \ | 144 F(MathAtan2, 2, 1) \ |
145 F(MathExpRT, 1, 1) \ | 145 F(MathExpRT, 1, 1) \ |
146 F(RoundNumber, 1, 1) \ | 146 F(RoundNumber, 1, 1) \ |
147 F(MathFround, 1, 1) \ | 147 F(MathFround, 1, 1) \ |
148 \ | 148 F(RemPiO2, 1, 1) \ |
149 /* Regular expressions */ \ | 149 \ |
150 F(RegExpCompile, 3, 1) \ | 150 /* Regular expressions */ \ |
151 F(RegExpExecMultiple, 4, 1) \ | 151 F(RegExpCompile, 3, 1) \ |
152 F(RegExpInitializeObject, 5, 1) \ | 152 F(RegExpExecMultiple, 4, 1) \ |
153 \ | 153 F(RegExpInitializeObject, 5, 1) \ |
154 /* JSON */ \ | 154 \ |
155 F(ParseJson, 1, 1) \ | 155 /* JSON */ \ |
156 F(BasicJSONStringify, 1, 1) \ | 156 F(ParseJson, 1, 1) \ |
157 F(QuoteJSONString, 1, 1) \ | 157 F(BasicJSONStringify, 1, 1) \ |
158 \ | 158 F(QuoteJSONString, 1, 1) \ |
159 /* Strings */ \ | 159 \ |
160 F(StringIndexOf, 3, 1) \ | 160 /* Strings */ \ |
161 F(StringLastIndexOf, 3, 1) \ | 161 F(StringIndexOf, 3, 1) \ |
162 F(StringLocaleCompare, 2, 1) \ | 162 F(StringLastIndexOf, 3, 1) \ |
| 163 F(StringLocaleCompare, 2, 1) \ |
163 F(StringReplaceGlobalRegExpWithString, 4, 1) \ | 164 F(StringReplaceGlobalRegExpWithString, 4, 1) \ |
164 F(StringReplaceOneCharWithString, 3, 1) \ | 165 F(StringReplaceOneCharWithString, 3, 1) \ |
165 F(StringMatch, 3, 1) \ | 166 F(StringMatch, 3, 1) \ |
166 F(StringTrim, 3, 1) \ | 167 F(StringTrim, 3, 1) \ |
167 F(StringToArray, 2, 1) \ | 168 F(StringToArray, 2, 1) \ |
168 F(NewStringWrapper, 1, 1) \ | 169 F(NewStringWrapper, 1, 1) \ |
169 F(NewString, 2, 1) \ | 170 F(NewString, 2, 1) \ |
170 F(TruncateString, 2, 1) \ | 171 F(TruncateString, 2, 1) \ |
171 \ | 172 \ |
172 /* Numbers */ \ | 173 /* Numbers */ \ |
173 F(NumberToRadixString, 2, 1) \ | 174 F(NumberToRadixString, 2, 1) \ |
174 F(NumberToFixed, 2, 1) \ | 175 F(NumberToFixed, 2, 1) \ |
175 F(NumberToExponential, 2, 1) \ | 176 F(NumberToExponential, 2, 1) \ |
176 F(NumberToPrecision, 2, 1) \ | 177 F(NumberToPrecision, 2, 1) \ |
177 F(IsValidSmi, 1, 1) | 178 F(IsValidSmi, 1, 1) |
178 | 179 |
179 | 180 |
180 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 181 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
181 /* Reflection */ \ | 182 /* Reflection */ \ |
182 F(FunctionSetInstanceClassName, 2, 1) \ | 183 F(FunctionSetInstanceClassName, 2, 1) \ |
183 F(FunctionSetLength, 2, 1) \ | 184 F(FunctionSetLength, 2, 1) \ |
184 F(FunctionSetPrototype, 2, 1) \ | 185 F(FunctionSetPrototype, 2, 1) \ |
185 F(FunctionGetName, 1, 1) \ | 186 F(FunctionGetName, 1, 1) \ |
186 F(FunctionSetName, 2, 1) \ | 187 F(FunctionSetName, 2, 1) \ |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; | 889 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; |
889 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; | 890 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; |
890 | 891 |
891 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; | 892 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
892 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; | 893 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
893 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; | 894 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; |
894 | 895 |
895 } } // namespace v8::internal | 896 } } // namespace v8::internal |
896 | 897 |
897 #endif // V8_RUNTIME_H_ | 898 #endif // V8_RUNTIME_H_ |
OLD | NEW |