V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
builtin-function-id.h
1 // Copyright 2018 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_OBJECTS_BUILTIN_FUNCTION_ID_H_
6 #define V8_OBJECTS_BUILTIN_FUNCTION_ID_H_
7 
8 #include <stdint.h>
9 
10 namespace v8 {
11 namespace internal {
12 
13 // List of builtin functions we want to identify to improve code
14 // generation.
15 //
16 // Each entry has a name of a global object property holding an object
17 // optionally followed by ".prototype", a name of a builtin function
18 // on the object (the one the id is set for), and a label.
19 //
20 // Installation of ids for the selected builtin functions is handled
21 // by the bootstrapper.
22 #define FUNCTIONS_WITH_ID_LIST(V) \
23  V(Array, isArray, ArrayIsArray) \
24  V(Array.prototype, concat, ArrayConcat) \
25  V(Array.prototype, every, ArrayEvery) \
26  V(Array.prototype, fill, ArrayFill) \
27  V(Array.prototype, filter, ArrayFilter) \
28  V(Array.prototype, findIndex, ArrayFindIndex) \
29  V(Array.prototype, forEach, ArrayForEach) \
30  V(Array.prototype, includes, ArrayIncludes) \
31  V(Array.prototype, indexOf, ArrayIndexOf) \
32  V(Array.prototype, join, ArrayJoin) \
33  V(Array.prototype, lastIndexOf, ArrayLastIndexOf) \
34  V(Array.prototype, map, ArrayMap) \
35  V(Array.prototype, pop, ArrayPop) \
36  V(Array.prototype, push, ArrayPush) \
37  V(Array.prototype, reverse, ArrayReverse) \
38  V(Array.prototype, shift, ArrayShift) \
39  V(Array.prototype, slice, ArraySlice) \
40  V(Array.prototype, some, ArraySome) \
41  V(Array.prototype, splice, ArraySplice) \
42  V(Array.prototype, unshift, ArrayUnshift) \
43  V(Date, now, DateNow) \
44  V(Date.prototype, getDate, DateGetDate) \
45  V(Date.prototype, getDay, DateGetDay) \
46  V(Date.prototype, getFullYear, DateGetFullYear) \
47  V(Date.prototype, getHours, DateGetHours) \
48  V(Date.prototype, getMilliseconds, DateGetMilliseconds) \
49  V(Date.prototype, getMinutes, DateGetMinutes) \
50  V(Date.prototype, getMonth, DateGetMonth) \
51  V(Date.prototype, getSeconds, DateGetSeconds) \
52  V(Date.prototype, getTime, DateGetTime) \
53  V(Function.prototype, apply, FunctionApply) \
54  V(Function.prototype, bind, FunctionBind) \
55  V(Function.prototype, call, FunctionCall) \
56  V(Object, assign, ObjectAssign) \
57  V(Object, create, ObjectCreate) \
58  V(Object, is, ObjectIs) \
59  V(Object.prototype, hasOwnProperty, ObjectHasOwnProperty) \
60  V(Object.prototype, isPrototypeOf, ObjectIsPrototypeOf) \
61  V(Object.prototype, toString, ObjectToString) \
62  V(RegExp.prototype, compile, RegExpCompile) \
63  V(RegExp.prototype, exec, RegExpExec) \
64  V(RegExp.prototype, test, RegExpTest) \
65  V(RegExp.prototype, toString, RegExpToString) \
66  V(String.prototype, charCodeAt, StringCharCodeAt) \
67  V(String.prototype, charAt, StringCharAt) \
68  V(String.prototype, codePointAt, StringCodePointAt) \
69  V(String.prototype, concat, StringConcat) \
70  V(String.prototype, endsWith, StringEndsWith) \
71  V(String.prototype, includes, StringIncludes) \
72  V(String.prototype, indexOf, StringIndexOf) \
73  V(String.prototype, lastIndexOf, StringLastIndexOf) \
74  V(String.prototype, repeat, StringRepeat) \
75  V(String.prototype, slice, StringSlice) \
76  V(String.prototype, startsWith, StringStartsWith) \
77  V(String.prototype, substr, StringSubstr) \
78  V(String.prototype, substring, StringSubstring) \
79  V(String.prototype, toLowerCase, StringToLowerCase) \
80  V(String.prototype, toString, StringToString) \
81  V(String.prototype, toUpperCase, StringToUpperCase) \
82  V(String.prototype, trim, StringTrim) \
83  V(String.prototype, trimLeft, StringTrimStart) \
84  V(String.prototype, trimRight, StringTrimEnd) \
85  V(String.prototype, valueOf, StringValueOf) \
86  V(String, fromCharCode, StringFromCharCode) \
87  V(String, fromCodePoint, StringFromCodePoint) \
88  V(String, raw, StringRaw) \
89  V(Math, random, MathRandom) \
90  V(Math, floor, MathFloor) \
91  V(Math, round, MathRound) \
92  V(Math, ceil, MathCeil) \
93  V(Math, abs, MathAbs) \
94  V(Math, log, MathLog) \
95  V(Math, log1p, MathLog1p) \
96  V(Math, log2, MathLog2) \
97  V(Math, log10, MathLog10) \
98  V(Math, cbrt, MathCbrt) \
99  V(Math, exp, MathExp) \
100  V(Math, expm1, MathExpm1) \
101  V(Math, sqrt, MathSqrt) \
102  V(Math, pow, MathPow) \
103  V(Math, max, MathMax) \
104  V(Math, min, MathMin) \
105  V(Math, cos, MathCos) \
106  V(Math, cosh, MathCosh) \
107  V(Math, sign, MathSign) \
108  V(Math, sin, MathSin) \
109  V(Math, sinh, MathSinh) \
110  V(Math, tan, MathTan) \
111  V(Math, tanh, MathTanh) \
112  V(Math, acos, MathAcos) \
113  V(Math, acosh, MathAcosh) \
114  V(Math, asin, MathAsin) \
115  V(Math, asinh, MathAsinh) \
116  V(Math, atan, MathAtan) \
117  V(Math, atan2, MathAtan2) \
118  V(Math, atanh, MathAtanh) \
119  V(Math, imul, MathImul) \
120  V(Math, clz32, MathClz32) \
121  V(Math, fround, MathFround) \
122  V(Math, trunc, MathTrunc) \
123  V(Number, isFinite, NumberIsFinite) \
124  V(Number, isInteger, NumberIsInteger) \
125  V(Number, isNaN, NumberIsNaN) \
126  V(Number, isSafeInteger, NumberIsSafeInteger) \
127  V(Number, parseFloat, NumberParseFloat) \
128  V(Number, parseInt, NumberParseInt) \
129  V(Number.prototype, toString, NumberToString) \
130  V(Map.prototype, clear, MapClear) \
131  V(Map.prototype, delete, MapDelete) \
132  V(Map.prototype, entries, MapEntries) \
133  V(Map.prototype, forEach, MapForEach) \
134  V(Map.prototype, has, MapHas) \
135  V(Map.prototype, keys, MapKeys) \
136  V(Map.prototype, get, MapGet) \
137  V(Map.prototype, set, MapSet) \
138  V(Map.prototype, values, MapValues) \
139  V(Set.prototype, add, SetAdd) \
140  V(Set.prototype, clear, SetClear) \
141  V(Set.prototype, delete, SetDelete) \
142  V(Set.prototype, entries, SetEntries) \
143  V(Set.prototype, forEach, SetForEach) \
144  V(Set.prototype, has, SetHas) \
145  V(Set.prototype, values, SetValues) \
146  V(WeakMap.prototype, delete, WeakMapDelete) \
147  V(WeakMap.prototype, has, WeakMapHas) \
148  V(WeakMap.prototype, set, WeakMapSet) \
149  V(WeakSet.prototype, add, WeakSetAdd) \
150  V(WeakSet.prototype, delete, WeakSetDelete) \
151  V(WeakSet.prototype, has, WeakSetHas)
152 
153 #define ATOMIC_FUNCTIONS_WITH_ID_LIST(V) \
154  V(Atomics, load, AtomicsLoad) \
155  V(Atomics, store, AtomicsStore) \
156  V(Atomics, exchange, AtomicsExchange) \
157  V(Atomics, compareExchange, AtomicsCompareExchange) \
158  V(Atomics, add, AtomicsAdd) \
159  V(Atomics, sub, AtomicsSub) \
160  V(Atomics, and, AtomicsAnd) \
161  V(Atomics, or, AtomicsOr) \
162  V(Atomics, xor, AtomicsXor)
163 
164 enum class BuiltinFunctionId : uint8_t {
165  kArrayConstructor,
166 #define DECL_FUNCTION_ID(ignored1, ignore2, name) k##name,
167  FUNCTIONS_WITH_ID_LIST(DECL_FUNCTION_ID)
168  ATOMIC_FUNCTIONS_WITH_ID_LIST(DECL_FUNCTION_ID)
169 #undef DECL_FUNCTION_ID
170  // These are manually assigned to special getters during bootstrapping.
171  kArrayBufferByteLength,
172  kArrayBufferIsView,
173  kArrayEntries,
174  kArrayKeys,
175  kArrayValues,
176  kArrayIteratorNext,
177  kBigIntConstructor,
178  kMapSize,
179  kSetSize,
180  kMapIteratorNext,
181  kSetIteratorNext,
182  kDataViewBuffer,
183  kDataViewByteLength,
184  kDataViewByteOffset,
185  kFunctionHasInstance,
186  kGlobalDecodeURI,
187  kGlobalDecodeURIComponent,
188  kGlobalEncodeURI,
189  kGlobalEncodeURIComponent,
190  kGlobalEscape,
191  kGlobalUnescape,
192  kGlobalIsFinite,
193  kGlobalIsNaN,
194  kNumberConstructor,
195  kPromiseAll,
196  kPromisePrototypeCatch,
197  kPromisePrototypeFinally,
198  kPromisePrototypeThen,
199  kPromiseRace,
200  kPromiseReject,
201  kPromiseResolve,
202  kSymbolConstructor,
203  kSymbolPrototypeToString,
204  kSymbolPrototypeValueOf,
205  kTypedArrayByteLength,
206  kTypedArrayByteOffset,
207  kTypedArrayEntries,
208  kTypedArrayKeys,
209  kTypedArrayLength,
210  kTypedArrayToStringTag,
211  kTypedArrayValues,
212  kSharedArrayBufferByteLength,
213  kStringConstructor,
214  kStringIterator,
215  kStringIteratorNext,
216  kStringToLowerCaseIntl,
217  kStringToUpperCaseIntl,
218  kInvalidBuiltinFunctionId = static_cast<uint8_t>(-1),
219 };
220 
221 } // namespace internal
222 } // namespace v8
223 
224 #endif // V8_OBJECTS_BUILTIN_FUNCTION_ID_H_
Definition: libplatform.h:13