• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMASCRIPT_GLOBAL_ENV_CONSTANTS_H
17 #define ECMASCRIPT_GLOBAL_ENV_CONSTANTS_H
18 
19 #include <cstdint>
20 
21 #include "ecmascript/mem/visitor.h"
22 #include "libpandabase/macros.h"
23 
24 namespace panda::ecmascript {
25 // Forward Declaration
26 template<typename T>
27 class JSHandle;
28 class JSHClass;
29 class JSThread;
30 class ObjectFactory;
31 
32 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
33 #define GLOBAL_ENV_CONSTANT_CLASS(V)                                                                                  \
34     /* GC Root */                                                                                                     \
35     V(JSTaggedValue, HClassClass, HCLASS_CLASS_INDEX, ecma_roots_class)                                               \
36     V(JSTaggedValue, FreeObjectWithNoneFieldClass, FREE_OBJECT_WITH_NONE_FIELD_CLASS_INDEX, ecma_roots_class)         \
37     V(JSTaggedValue, FreeObjectWithOneFieldClass, FREE_OBJECT_WITH_ONE_FIELD_CLASS_INDEX, ecma_roots_class)           \
38     V(JSTaggedValue, FreeObjectWithTwoFieldClass, FREE_OBJECT_WITH_TWO_FIELD_CLASS_INDEX, ecma_roots_class)           \
39     V(JSTaggedValue, LineStringClass, LINE_STRING_CLASS_INDEX, ecma_roots_class)                                      \
40     V(JSTaggedValue, ConstantStringClass, CONSTANT_STRING_CLASS_INDEX, ecma_roots_class)                              \
41     V(JSTaggedValue, TreeStringClass, TREE_STRING_CLASS_INDEX, ecma_roots_class)                                      \
42     V(JSTaggedValue, ArrayClass, ARRAY_CLASS_INDEX, ecma_roots_class)                                                 \
43     V(JSTaggedValue, ByteArrayClass, BYTE_ARRAY_CLASS_INDEX, ecma_roots_class)                                        \
44     V(JSTaggedValue, ConstantPoolClass, CONSTANT_POOL_CLASS_INDEX, ecma_roots_class)                                  \
45     V(JSTaggedValue, DictionaryClass, DICTIONARY_CLASS_INDEX, ecma_roots_class)                                       \
46     V(JSTaggedValue, COWArrayClass, COW_ARRAY_CLASS_INDEX, ecma_roots_class)                                          \
47     V(JSTaggedValue, BigIntClass, BIGINT_CLASS_INDEX, ecma_roots_class)                                               \
48     V(JSTaggedValue, JSNativePointerClass, JS_NATIVE_POINTER_CLASS_INDEX, ecma_roots_class)                           \
49     V(JSTaggedValue, EnvClass, ENV_CLASS_INDEX, ecma_roots_class)                                                     \
50     V(JSTaggedValue, SymbolClass, SYMBOL_CLASS_INDEX, ecma_roots_class)                                               \
51     V(JSTaggedValue, AccessorDataClass, ACCESSOR_DATA_CLASS_INDEX, ecma_roots_class)                                  \
52     V(JSTaggedValue, InternalAccessorClass, INTERNAL_ACCESSOR_CLASS_INDEX, ecma_roots_class)                          \
53     V(JSTaggedValue, JSProxyOrdinaryClass, JS_PROXY_ORDINARY_CLASS_INDEX, ecma_roots_class)                           \
54     V(JSTaggedValue, CompletionRecordClass, COMPLETION_RECORD_CLASS_INDEX, ecma_roots_class)                          \
55     V(JSTaggedValue, GeneratorContextClass, GENERATOR_CONTEST_INDEX, ecma_roots_class)                                \
56     V(JSTaggedValue, AsyncGeneratorRequestRecordClass, ASYNC_GENERATOR_REQUEST_CLASS_INDEX, ecma_roots_class)         \
57     V(JSTaggedValue, AsyncIteratorRecordClass, ASYNC_ITERATOR_RECORD_CLASS_INDEX, ecma_roots_class)                   \
58     V(JSTaggedValue, CapabilityRecordClass, CAPABILITY_RECORD_CLASS_INDEX, ecma_roots_class)                          \
59     V(JSTaggedValue, ReactionsRecordClass, REACTIONS_RECORD_CLASS_INDEX, ecma_roots_class)                            \
60     V(JSTaggedValue, PromiseIteratorRecordClass, PROMISE_ITERATOR_RECORD_CLASS_INDEX, ecma_roots_class)               \
61     V(JSTaggedValue, PromiseRecordClass, PROMISE_RECORD_CLASS_INDEX, ecma_roots_class)                                \
62     V(JSTaggedValue, PromiseResolvingFunctionsRecordClass, PROMISE_RESOLVING_FUNCTIONS_CLASS_INDEX, ecma_roots_class) \
63     V(JSTaggedValue, MicroJobQueueClass, MICRO_JOB_QUEUE_CLASS_INDEX, ecma_roots_class)                               \
64     V(JSTaggedValue, PendingJobClass, PENDING_JOB_CLASS_INDEX, ecma_roots_class)                                      \
65     V(JSTaggedValue, ProtoChangeMarkerClass, PROTO_CHANGE_MARKER_CLASS_INDEX, ecma_roots_class)                       \
66     V(JSTaggedValue, ProtoChangeDetailsClass, PROTO_CHANGE_DETAILS_CLASS_INDEX, ecma_roots_class)                     \
67     V(JSTaggedValue, PrototypeHandlerClass, PROTOTYPE_HANDLER_CLASS_INDEX, ecma_roots_class)                          \
68     V(JSTaggedValue, TransitionHandlerClass, TRANSITION_HANDLER_CLASS_INDEX, ecma_roots_class)                        \
69     V(JSTaggedValue, TransWithProtoHandlerClass, TRANS_WITH_PROTO_HANDLER_CLASS_INDEX, ecma_roots_class)              \
70     V(JSTaggedValue, StoreTSHandlerClass, STORE_TS_HANDLER_CLASS_INDEX, ecma_roots_class)                             \
71     V(JSTaggedValue, PropertyBoxClass, PROPERTY_BOX_CLASS_INDEX, ecma_roots_class)                                    \
72     V(JSTaggedValue, ProgramClass, PROGRAM_CLASS_INDEX, ecma_roots_class)                                             \
73     V(JSTaggedValue, ImportEntryClass, IMPORT_ENTRY_CLASS_INDEX, ecma_roots_class)                                    \
74     V(JSTaggedValue, LocalExportEntryClass, LOCAL_EXPORT_ENTRY_CLASS_INDEX, ecma_roots_class)                         \
75     V(JSTaggedValue, IndirectExportEntryClass, INDIRECT_EXPORT_ENTRY_CLASS_INDEX, ecma_roots_class)                   \
76     V(JSTaggedValue, StarExportEntryClass, STAR_EXPORT_ENTRY_CLASS_INDEX, ecma_roots_class)                           \
77     V(JSTaggedValue, SourceTextModuleClass, SOURCE_TEXT_MODULE_CLASS_INDEX, ecma_roots_class)                         \
78     V(JSTaggedValue, ResolvedBindingClass, RESOLVED_BINDING_CLASS_INDEX, ecma_roots_class)                            \
79     V(JSTaggedValue, ResolvedIndexBindingClass, RESOLVED_INDEX_BINDING_CLASS_INDEX, ecma_roots_class)                 \
80     V(JSTaggedValue, JSProxyCallableClass, JS_PROXY_CALLABLE_CLASS_INDEX, ecma_roots_class)                           \
81     V(JSTaggedValue, JSProxyConstructClass, JS_PROXY_CONSTRUCT_CLASS_INDEX, ecma_roots_class)                         \
82     V(JSTaggedValue, JSRealmClass, JS_REALM_CLASS_INDEX, ecma_roots_class)                                            \
83     V(JSTaggedValue, JSRegExpClass, JS_REGEXP_CLASS_INDEX, ecma_roots_class)                                          \
84     V(JSTaggedValue, MachineCodeClass, MACHINE_CODE_CLASS_INDEX, ecma_roots_class)                                    \
85     V(JSTaggedValue, ClassInfoExtractorHClass, CLASS_INFO_EXTRACTOR_HCLASS_INDEX, ecma_roots_class)                   \
86     V(JSTaggedValue, TSObjectTypeClass, TS_OBJECT_TYPE_CLASS_INDEX, ecma_roots_class)                                 \
87     V(JSTaggedValue, TSClassTypeClass, TS_CLASS_TYPE_CLASS_INDEX, ecma_roots_class)                                   \
88     V(JSTaggedValue, TSUnionTypeClass, TS_UNION_TYPE_CLASS_INDEX, ecma_roots_class)                                   \
89     V(JSTaggedValue, TSInterfaceTypeClass, TS_INTERFACE_TYPE_CLASS_INDEX, ecma_roots_class)                           \
90     V(JSTaggedValue, TSClassInstanceTypeClass, TS_CLASS_INSTANCE_TYPE_CLASS_INDEX, ecma_roots_class)                  \
91     V(JSTaggedValue, TSFunctionTypeClass, TS_FUNCTION_TYPE_CLASS_INDEX, ecma_roots_class)                             \
92     V(JSTaggedValue, TSArrayTypeClass, TS_ARRAY_TYPE_CLASS_INDEX, ecma_roots_class)                                   \
93     V(JSTaggedValue, TSIteratorInstanceTypeClass, TS_ITERATOR_INSTANCE_TYPE_CLASS_INDEX, ecma_roots_class)            \
94     V(JSTaggedValue, TSNamespaceTypeClass, TS_NAMESPACE_TYPE_CLASS_INDEX, ecma_roots_class)                           \
95     V(JSTaggedValue, JSSetIteratorClass, JS_SET_ITERATOR_CLASS_INDEX, ecma_roots_class)                               \
96     V(JSTaggedValue, JSRegExpIteratorClass, JS_REGEXP_ITERATOR_CLASS_INDEX, ecma_roots_class)                         \
97     V(JSTaggedValue, JSMapIteratorClass, JS_MAP_ITERATOR_CLASS_INDEX, ecma_roots_class)                               \
98     V(JSTaggedValue, JSArrayIteratorClass, JS_ARRAY_ITERATOR_CLASS_INDEX, ecma_roots_class)                           \
99     V(JSTaggedValue, JSAPIArrayListIteratorClass, JS_API_ARRAYLIST_ITERATOR_CLASS_INDEX, ecma_roots_class)            \
100     V(JSTaggedValue, JSAPIDequeIteratorClass, JS_API_DEQUE_ITERATOR_CLASS_INDEX, ecma_roots_class)                    \
101     V(JSTaggedValue, JSAPILightWeightMapIteratorClass, JS_API_LIGHTWEIGHTMAP_ITERATOR_CLASS_INDEX, ecma_roots_class)  \
102     V(JSTaggedValue, JSAPILightWeightSetIteratorClass, JS_API_LIGHTWEIGHTSET_ITERATOR_CLASS_INDEX, ecma_roots_class)  \
103     V(JSTaggedValue, JSAPILinkedListIteratorClass, JS_API_LINKED_LIST_ITERATOR_CLASS_INDEX, ecma_roots_class)         \
104     V(JSTaggedValue, JSAPIListIteratorClass, JS_API_LIST_ITERATOR_CLASS_INDEX, ecma_roots_class)                      \
105     V(JSTaggedValue, JSAPIPlainArrayIteratorClass, JS_API_PLAIN_ARRAY_ITERATOR_CLASS_INDEX, ecma_roots_class)         \
106     V(JSTaggedValue, JSAPIQueueIteratorClass, JS_API_QUEUE_ITERATOR_CLASS_INDEX, ecma_roots_class)                    \
107     V(JSTaggedValue, JSAPIStackIteratorClass, JS_API_STACK_ITERATOR_CLASS_INDEX, ecma_roots_class)                    \
108     V(JSTaggedValue, JSAPIVectorIteratorClass, JS_API_VECTOR_ITERATOR_CLASS_INDEX, ecma_roots_class)                  \
109     V(JSTaggedValue, JSAPIHashMapIteratorClass, JS_API_HASH_MAP_ITERATOR_CLASS_INDEX, ecma_roots_class)               \
110     V(JSTaggedValue, JSAPIHashSetIteratorClass, JS_API_HASH_SET_ITERATOR_CLASS_INDEX, ecma_roots_class)               \
111     V(JSTaggedValue, JSAPITreeMapIteratorClass, JS_API_TREE_MAP_ITERATOR_CLASS_INDEX, ecma_roots_class)               \
112     V(JSTaggedValue, JSAPITreeSetIteratorClass, JS_API_TREE_SET_ITERATOR_CLASS_INDEX, ecma_roots_class)               \
113     V(JSTaggedValue, LinkedNode, LINKED_NODE_CLASS_INDEX, ecma_roots_class)                                           \
114     V(JSTaggedValue, RBTreeNode, RB_TREENODE_CLASS_INDEX, ecma_roots_class)                                           \
115     V(JSTaggedValue, JSAPIIteratorFuncHClass, JS_API_ITERATOR_FUNC_CLASS_INDEX, ecma_roots_class)                     \
116     V(JSTaggedValue, JSAPIAsyncIteratorFuncHClass, JS_API_ASYNCITERATOR_FUNC_CLASS_INDEX, ecma_roots_class)           \
117     V(JSTaggedValue, CellRecordClass, CELL_RECORD_CLASS_INDEX, ecma_roots_class)                                      \
118     V(JSTaggedValue, ObjectClass, OBJECT_HCLASS_INDEX, initial_object_hclass)                                         \
119     V(JSTaggedValue, IteratorResultClass, ITERATOR_RESULT_CLASS, ecma_roots_class)                                    \
120     V(JSTaggedValue, MethodClass, METHOD_CLASS_INDEX, ecma_roots_class)                                               \
121     V(JSTaggedValue, ClassPrototypeClass, CLASS_PROTOTYPE_HCLASS_INDEX, ecma_roots_class)                             \
122     V(JSTaggedValue, ClassConstructorClass, CLASS_CONSTRUCTOR_HCLASS_INDEX, ecma_roots_class)                         \
123     V(JSTaggedValue, ClassConstructorOptimizedClass, CLASS_CONSTRUCTOR_OPTIMIZED_HCLASS_INDEX, ecma_roots_class)      \
124     V(JSTaggedValue, ClassConstructorOptimizedWithFastCallClass,                                                      \
125         CLASS_CONSTRUCTOR_OPTIMIZED_WITH_FAST_CALL_HCLASS_INDEX, ecma_roots_class)                                    \
126     V(JSTaggedValue, AOTLiteralInfoClass, AOT_LITERAL_INFO_CLASS_INDEX, ecma_roots_class)                             \
127     V(JSTaggedValue, VTableClass, VTABLE_CLASS_INDEX, ecma_roots_class)                                               \
128     V(JSTaggedValue, ClassLiteralClass, CLASS_LITERAL_HCLASS_INDEX, ecma_roots_class)                                 \
129     V(JSTaggedValue, ElementNoneClass, ELEMENT_NONE_HCLASS_INDEX, ecma_roots_class)                                   \
130     V(JSTaggedValue, ElementIntClass, ELEMENT_INT_HCLASS_INDEX, ecma_roots_class)                                     \
131     V(JSTaggedValue, ElementDoubleClass, ELEMENT_DOUBLE_HCLASS_INDEX, ecma_roots_class)                               \
132     V(JSTaggedValue, ElementNumberClass, ELEMENT_NUMBER_HCLASS_INDEX, ecma_roots_class)                               \
133     V(JSTaggedValue, ElementStringClass, ELEMENT_STRING_HCLASS_INDEX, ecma_roots_class)                               \
134     V(JSTaggedValue, ElementObjectClass, ELEMENT_OBJECT_HCLASS_INDEX, ecma_roots_class)                               \
135     V(JSTaggedValue, ElementTaggedClass, ELEMENT_TAGGED_HCLASS_INDEX, ecma_roots_class)                               \
136     V(JSTaggedValue, ElementHoleIntClass, ELEMENT_HOLE_INT_HCLASS_INDEX, ecma_roots_class)                            \
137     V(JSTaggedValue, ElementHoleDoubleClass, ELEMENT_HOLE_DOUBLE_HCLASS_INDEX, ecma_roots_class)                      \
138     V(JSTaggedValue, ElementHoleNumberClass, ELEMENT_HOLE_NUMBER_HCLASS_INDEX, ecma_roots_class)                      \
139     V(JSTaggedValue, ElementHoleStringClass, ELEMENT_HOLE_STRING_HCLASS_INDEX, ecma_roots_class)                      \
140     V(JSTaggedValue, ElementHoleObjectClass, ELEMENT_HOLE_OBJECT_HCLASS_INDEX, ecma_roots_class)                      \
141     V(JSTaggedValue, ElementHoleTaggedClass, ELEMENT_HOLE_TAGGED_HCLASS_INDEX, ecma_roots_class)
142 
143 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
144 #define GLOBAL_ENV_CONSTANT_SPECIAL(V)                                                                 \
145     V(JSTaggedValue, Undefined, UNDEFINED_INDEX, ecma_roots_special)                                   \
146     V(JSTaggedValue, Null, NULL_INDEX, ecma_roots_special)                                             \
147     V(JSTaggedValue, EmptyString, EMPTY_STRING_OBJECT_INDEX, ecma_roots_special)                       \
148     V(JSTaggedValue, EmptyLayoutInfo, EMPTY_LAYOUT_INFO_OBJECT_INDEX, ecma_roots_special)              \
149     V(JSTaggedValue, EmptyArray, EMPTY_ARRAY_OBJECT_INDEX, ecma_roots_special)                         \
150     V(JSTaggedValue, DefaultSupers, DEFAULT_SUPERS_INDEX, ecma_roots_special)                          \
151     V(JSTaggedValue, EmptyTaggedQueue, EMPTY_TAGGED_QUEUE_OBJECT_INDEX, ecma_roots_special)            \
152     V(JSTaggedValue, UndefinedCompletionRecord, UNDEFINED_COMPLRTION_RECORD_INDEX, ecma_roots_special) \
153     V(JSTaggedValue, MathSqrtFunction, MATH_SQRT_FUNCTION_INDEX, ecma_roots_special)                   \
154     V(JSTaggedValue, MathCosFunction, MATH_COS_FUNCTION_INDEX, ecma_roots_special)                     \
155     V(JSTaggedValue, MathSinFunction, MATH_SIN_FUNCTION_INDEX, ecma_roots_special)                     \
156     V(JSTaggedValue, MathACosFunction, MATH_ACOS_FUNCTION_INDEX, ecma_roots_special)                   \
157     V(JSTaggedValue, MathATanFunction, MATH_ATAN_FUNCTION_INDEX, ecma_roots_special)                   \
158     V(JSTaggedValue, MathAbsFunction, MATH_ABS_FUNCTION_INDEX, ecma_roots_special)                     \
159     V(JSTaggedValue, MathFloorFunction, MATH_FLOOR_FUNCTION_INDEX, ecma_roots_special)
160 
161 /* GlobalConstant */
162 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
163 #define GLOBAL_ENV_CONSTANT_CONSTANT(V)                                                                               \
164     V(JSTaggedValue, ConstructorString, CONSTRUCTOR_STRING_INDEX, constructor)                                        \
165     V(JSTaggedValue, PrototypeString, PROTOTYPE_STRING_INDEX, prototype)                                              \
166     V(JSTaggedValue, LengthString, LENGTH_STRING_INDEX, length)                                                       \
167     V(JSTaggedValue, ValueString, VALUE_STRING_INDEX, value)                                                          \
168     V(JSTaggedValue, GetString, GET_STRING_INDEX, get)                                                                \
169     V(JSTaggedValue, SetString, SET_STRING_INDEX, set)                                                                \
170     V(JSTaggedValue, WritableString, WRITABLE_STRING_INDEX, writable)                                                 \
171     V(JSTaggedValue, EnumerableString, ENUMERABLE_STRING_INDEX, enumerable)                                           \
172     V(JSTaggedValue, ConfigurableString, CONFIGURABLE_STRING_INDEX, configurable)                                     \
173     /* non ECMA standard jsapi containers iterators */                                                                \
174     V(JSTaggedValue, ArrayListFunction, ARRAYLIST_FUNCTION_INDEX, ArrayListFunction)                                  \
175     V(JSTaggedValue, ArrayListIteratorPrototype, ARRAYLIST_ITERATOR_PROTOTYPE_INDEX, ArrayListIterator)               \
176     V(JSTaggedValue, HashMapIteratorPrototype, HASHMAP_ITERATOR_PROTOTYPE_INDEX, HashMapIterator)                     \
177     V(JSTaggedValue, HashSetIteratorPrototype, HASHSET_ITERATOR_PROTOTYPE_INDEX, HashSetIterator)                     \
178     V(JSTaggedValue, LightWeightMapIteratorPrototype, LIGHTWEIGHTMAP_ITERATOR_PROTOTYPE_INDEX, LightWeightMapIterator) \
179     V(JSTaggedValue, LightWeightSetIteratorPrototype, LIGHTWEIGHTSET_ITERATOR_PROTOTYPE_INDEX, LightWeightSetIterator) \
180     V(JSTaggedValue, TreeMapIteratorPrototype, TREEMAP_ITERATOR_PROTOTYPE_INDEX, TreeMapIterator)                     \
181     V(JSTaggedValue, TreeSetIteratorPrototype, TREESET_ITERATOR_PROTOTYPE_INDEX, TreeSetIterator)                     \
182     V(JSTaggedValue, VectorFunction, VECTOR_FUNCTION_INDEX, VectorFunction)                                           \
183     V(JSTaggedValue, VectorIteratorPrototype, VECTOR_ITERATOR_PROTOTYPE_INDEX, VectorIterator)                        \
184     V(JSTaggedValue, QueueIteratorPrototype, QUEUE_ITERATOR_PROTOTYPE_INDEX, QueueIterator)                           \
185     V(JSTaggedValue, PlainArrayIteratorPrototype, PLAIN_ARRAY_ITERATOR_PROTOTYPE_INDEX, PlainArrayIterator)           \
186     V(JSTaggedValue, PlainArrayFunction, PLAIN_ARRAY_FUNCTION_INDEX, PlainArrayFunction)                              \
187     V(JSTaggedValue, DequeIteratorPrototype, DEQUE_ITERATOR_PROTOTYPE_INDEX, DequeIterator)                           \
188     V(JSTaggedValue, StackIteratorPrototype, STACK_ITERATOR_PROTOTYPE_INDEX, StackIterator)                           \
189     V(JSTaggedValue, ListFunction, LIST_FUNCTION_INDEX, ListFunction)                                                 \
190     V(JSTaggedValue, LinkedListFunction, LINKED_LIST_FUNCTION_INDEX, LinkedListFunction)                              \
191     V(JSTaggedValue, ListIteratorPrototype, LIST_ITERATOR_PROTOTYPE_INDEX, ListIterator)                              \
192     V(JSTaggedValue, UndefinedIterResult, UNDEFINED_INTERATOR_RESULT_INDEX, UndefinedIterResult)                      \
193     V(JSTaggedValue, LinkedListIteratorPrototype, LINKED_LIST_ITERATOR_PROTOTYPE_INDEX, LinkedListIterator)           \
194     /* SymbolTable*RegisterSymbols */                                                                                 \
195     V(JSTaggedValue, NameString, NAME_STRING_INDEX, name)                                                             \
196     V(JSTaggedValue, GetPrototypeOfString, GETPROTOTYPEOF_STRING_INDEX, getPrototypeOf)                               \
197     V(JSTaggedValue, SetPrototypeOfString, SETPROTOTYPEOF_STRING_INDEX, setPrototypeOf)                               \
198     V(JSTaggedValue, IsExtensibleString, ISEXTENSIBLE_STRING_INDEX, isExtensible)                                     \
199     V(JSTaggedValue, PreventExtensionsString, PREVENTEXTENSIONS_STRING_INDEX, preventExtensions)                      \
200     V(JSTaggedValue, GetOwnPropertyDescriptorString, GETOWNPROPERTYDESCRIPTOR_STRING_INDEX, getOwnPropertyDescriptor) \
201     V(JSTaggedValue, DefinePropertyString, DEFINEPROPERTY_STRING_INDEX, defineProperty)                               \
202     V(JSTaggedValue, HasString, HAS_STRING_INDEX, has)                                                                \
203     V(JSTaggedValue, DeletePropertyString, DELETEPROPERTY_STRING_INDEX, deleteProperty)                               \
204     V(JSTaggedValue, EnumerateString, ENUMERATE_STRING_INDEX, enumerate)                                              \
205     V(JSTaggedValue, OwnKeysString, OWNKEYS_STRING_INDEX, ownKeys)                                                    \
206     V(JSTaggedValue, ApplyString, APPLY_STRING_INDEX, apply)                                                          \
207     V(JSTaggedValue, NegativeZeroString, NEGATIVE_ZERO_STRING_INDEX, -0)                                              \
208     V(JSTaggedValue, DoneString, DONE_STRING_INDEX, done)                                                             \
209     V(JSTaggedValue, ProxyString, PROXY_STRING_INDEX, proxy)                                                          \
210     V(JSTaggedValue, RevokeString, REVOKE_STRING_INDEX, revoke)                                                       \
211     V(JSTaggedValue, NextString, NEXT_STRING_INDEX, next)                                                             \
212     V(JSTaggedValue, ToStringString, TO_STRING_STRING_INDEX, toString)                                                \
213     V(JSTaggedValue, ToLocaleStringString, TO_LOCALE_STRING_STRING_INDEX, toLocaleString)                             \
214     V(JSTaggedValue, ValueOfString, VALUE_OF_STRING_INDEX, valueOf)                                                   \
215     V(JSTaggedValue, UndefinedString, UNDEFINED_STRING_INDEX, undefined)                                              \
216     V(JSTaggedValue, NullString, NULL_STRING_INDEX, null)                                                             \
217     V(JSTaggedValue, BooleanString, BOOLEAN_STRING_INDEX, boolean)                                                    \
218     V(JSTaggedValue, NumberString, NUMBER_STRING_INDEX, number)                                                       \
219     V(JSTaggedValue, BigIntString, BIGINT_STRING_INDEX, bigint)                                                       \
220     V(JSTaggedValue, FunctionString, FUNCTION_STRING_INDEX, function)                                                 \
221     V(JSTaggedValue, StringString, STRING_STRING_INDEX, string)                                                       \
222     V(JSTaggedValue, SymbolString, SYMBOL_STRING_INDEX, symbol)                                                       \
223     V(JSTaggedValue, ObjectString, OBJECT_STRING_INDEX, object)                                                       \
224     V(JSTaggedValue, TrueString, TRUE_STRING_INDEX, true)                                                             \
225     V(JSTaggedValue, FalseString, FALSE_STRING_INDEX, false)                                                          \
226     V(JSTaggedValue, ReturnString, RETURN_STRING_INDEX, return )                                                      \
227     V(JSTaggedValue, ProxyConstructString, PROXY_CONSTRUCT_STRING_INDEX, construct)                                   \
228     V(JSTaggedValue, ProxyCallString, PROXY_CALL_STRING_INDEX, call)                                                  \
229     V(JSTaggedValue, PromiseThenString, PROMISE_THEN_STRING_INDEX, then)                                              \
230     V(JSTaggedValue, PromiseCatchString, PROMISE_CATCH_STRING_INDEX, catch)                                           \
231     V(JSTaggedValue, PromiseFinallyString, PROMISE_FINALLY_STRING_INDEX, finally)                                     \
232     V(JSTaggedValue, PromiseStatusString, PROMISE_STATUS_STRING_INDEX, status)                                        \
233     V(JSTaggedValue, PromiseFulfilledString, PROMISE_FULFILLED_STRING_INDEX, fulfilled)                               \
234     V(JSTaggedValue, PromiseRejectedString, PROMISE_REJECTED_STRING_INDEX, rejected)                                  \
235     V(JSTaggedValue, PromiseReasonString, PROMISE_REASON_STRING_INDEX, reason)                                        \
236     V(JSTaggedValue, ScriptJobString, SCRIPT_JOB_STRING_INDEX, ScriptJobs)                                            \
237     V(JSTaggedValue, PromiseString, PROMISE_STRING_INDEX, PrimiseJobs)                                                \
238     V(JSTaggedValue, ThrowerString, THROWER_STRING_INDEX, Thrower)                                                    \
239     V(JSTaggedValue, IdentityString, IDENTITY_STRING_INDEX, Identity)                                                 \
240     V(JSTaggedValue, CallerString, CALLER_STRING_INDEX, caller)                                                       \
241     V(JSTaggedValue, CalleeString, CALLEE_STRING_INDEX, callee)                                                       \
242     V(JSTaggedValue, Int8ArrayString, INT8_ARRAY_STRING_INDEX, Int8Array)                                             \
243     V(JSTaggedValue, Uint8ArrayString, UINT8_ARRAY_STRING_INDEX, Uint8Array)                                          \
244     V(JSTaggedValue, Uint8ClampedArrayString, UINT8_CLAMPED_ARRAY_STRING_INDEX, Uint8ClampedArray)                    \
245     V(JSTaggedValue, Int16ArrayString, INT16_ARRAY_STRING_INDEX, Int16Array)                                          \
246     V(JSTaggedValue, Uint16ArrayString, UINT16_ARRAY_STRING_INDEX, Uint16Array)                                       \
247     V(JSTaggedValue, Int32ArrayString, INT32_ARRAY_STRING_INDEX, Int32Array)                                          \
248     V(JSTaggedValue, Uint32ArrayString, UINT32_ARRAY_STRING_INDEX, Uint32Array)                                       \
249     V(JSTaggedValue, Float32ArrayString, FLOAT32_ARRAY_STRING_INDEX, Float32Array)                                    \
250     V(JSTaggedValue, Float64ArrayString, FLOAT64_ARRAY_STRING_INDEX, Float64Array)                                    \
251     V(JSTaggedValue, BigInt64ArrayString, BIGINT64_ARRAY_STRING_INDEX, BigInt64Array)                                 \
252     V(JSTaggedValue, BigUint64ArrayString, BIGUINT64_ARRAY_STRING_INDEX, BigUint64Array)                              \
253     V(JSTaggedValue, AsyncFunctionString, ASYNC_FUNCTION_STRING_INDEX, AsyncFunction)                                 \
254     V(JSTaggedValue, PromiseResolveString, PROMISE_RESOLVE_STRING_INDEX, resolve)                                     \
255     V(JSTaggedValue, IdString, ID_STRING_INDEX, id)                                                                   \
256     V(JSTaggedValue, MethodString, METHOD_STRING_INDEX, method)                                                       \
257     V(JSTaggedValue, ParamsString, PARAMS_STRING_INDEX, params)                                                       \
258     V(JSTaggedValue, ResultString, RESULT_STRING_INDEX, result)                                                       \
259     V(JSTaggedValue, ToJsonString, TO_JSON_STRING_INDEX, toJSON)                                                      \
260     V(JSTaggedValue, GlobalString, GLOBAL_STRING_INDEX, global)                                                       \
261     V(JSTaggedValue, MessageString, MESSAGE_STRING_INDEX, message)                                                    \
262     V(JSTaggedValue, CauseString, CAUSE_STRING_INDEX, cause)                                                          \
263     V(JSTaggedValue, ErrorString, ERROR_STRING_INDEX, Error)                                                          \
264     V(JSTaggedValue, RangeErrorString, RANGE_ERROR_STRING_INDEX, RangeError)                                          \
265     V(JSTaggedValue, ReferenceErrorString, REFERENCE_ERROR_STRING_INDEX, ReferenceError)                              \
266     V(JSTaggedValue, TypeErrorString, TYPE_ERROR_STRING_INDEX, TypeError)                                             \
267     V(JSTaggedValue, ErrorsString, ERRORS_STRING_INDEX, Errors)                                                       \
268     V(JSTaggedValue, AggregateErrorString, AGGREGATE_ERROR_STRING_INDEX, AggregateError)                              \
269     V(JSTaggedValue, URIErrorString, URI_ERROR_STRING_INDEX, URIError)                                                \
270     V(JSTaggedValue, SyntaxErrorString, SYNTAX_ERROR_STRING_INDEX, SyntaxError)                                       \
271     V(JSTaggedValue, EvalErrorString, EVAL_ERROR_STRING_INDEX, EvalError)                                             \
272     V(JSTaggedValue, OOMErrorString, OOM_ERROR_STRING_INDEX, OOMError)                                                \
273     V(JSTaggedValue, ErrorFuncString, ERROR_FUNC_STRING_INDEX, errorfunc)                                             \
274     V(JSTaggedValue, StackString, STACK_STRING_INDEX, stack)                                                          \
275     V(JSTaggedValue, StackEmptyString, STACK_EMPTY_STRING_INDEX, stackisempty)                                        \
276     V(JSTaggedValue, ObjNotCoercibleString, OBJ_NOT_COERCIBLE_STRING_INDEX, objectnotcoercible)                       \
277     /* forIntl. */                                                                                                    \
278     V(JSTaggedValue, LanguageString, LANGUAGE_STRING_CLASS_INDEX, language)                                           \
279     V(JSTaggedValue, ScriptString, SCRIPT_STRING_CLASS_INDEX, script)                                                 \
280     V(JSTaggedValue, RegionString, REGION_STRING_CLASS_INDEX, region)                                                 \
281     V(JSTaggedValue, BaseNameString, BASE_NAME_STRING_CLASS_INDEX, baseName)                                          \
282     V(JSTaggedValue, CalendarString, CALENDAR_STRING_CLASS_INDEX, calendar)                                           \
283     V(JSTaggedValue, CollationString, COLLATION_STRING_CLASS_INDEX, collation)                                        \
284     V(JSTaggedValue, HourCycleString, HOUR_CYCLE_STRING_CLASS_INDEX, hourCycle)                                       \
285     V(JSTaggedValue, CaseFirstString, CASE_FIRST_STRING_CLASS_INDEX, caseFirst)                                       \
286     V(JSTaggedValue, NumericString, NUMERIC_STRING_CLASS_INDEX, numeric)                                              \
287     V(JSTaggedValue, NumberingSystemString, NUMBERING_SYSTEM_STRING_CLASS_INDEX, numberingSystem)                     \
288     V(JSTaggedValue, TypeString, TYPE_STRING_INDEX, type)                                                             \
289     V(JSTaggedValue, LocaleMatcherString, LOCALE_MATCHER_STRING_INDEX, localeMatcher)                                 \
290     V(JSTaggedValue, FormatMatcherString, FORMAT_MATCHER_STRING_INDEX, formatMatcher)                                 \
291     V(JSTaggedValue, Hour12String, HOUR12_STRING_INDEX, hour12)                                                       \
292     V(JSTaggedValue, H11String, H11_STRING_INDEX, h11)                                                                \
293     V(JSTaggedValue, H12String, H12_STRING_INDEX, h12)                                                                \
294     V(JSTaggedValue, H23String, H23_STRING_INDEX, h23)                                                                \
295     V(JSTaggedValue, H24String, H24_STRING_INDEX, h24)                                                                \
296     V(JSTaggedValue, WeekdayString, WEEK_DAY_STRING_INDEX, weekday)                                                   \
297     V(JSTaggedValue, EraString, ERA_STRING_INDEX, era)                                                                \
298     V(JSTaggedValue, YearString, YEAR_STRING_INDEX, year)                                                             \
299     V(JSTaggedValue, QuarterString, QUARTER_STRING_INDEX, quarter)                                                    \
300     V(JSTaggedValue, MonthString, MONTH_STRING_INDEX, month)                                                          \
301     V(JSTaggedValue, DayString, DAY_STRING_INDEX, day)                                                                \
302     V(JSTaggedValue, HourString, HOUR_STRING_INDEX, hour)                                                             \
303     V(JSTaggedValue, MinuteString, MINUTE_STRING_INDEX, minute)                                                       \
304     V(JSTaggedValue, SecondString, SECOND_STRING_INDEX, second)                                                       \
305     V(JSTaggedValue, YearsString, YEARS_STRING_INDEX, years)                                                          \
306     V(JSTaggedValue, QuartersString, QUARTERS_STRING_INDEX, quarters)                                                 \
307     V(JSTaggedValue, MonthsString, MONTHS_STRING_INDEX, months)                                                       \
308     V(JSTaggedValue, DaysString, DAYS_STRING_INDEX, days)                                                             \
309     V(JSTaggedValue, HoursString, HOURS_STRING_INDEX, hours)                                                          \
310     V(JSTaggedValue, MinutesString, MINUTES_STRING_INDEX, minutes)                                                    \
311     V(JSTaggedValue, SecondsString, SECONDS_STRING_INDEX, seconds)                                                    \
312     V(JSTaggedValue, TimeZoneNameString, TIME_ZONE_NAME_STRING_INDEX, timeZoneName)                                   \
313     V(JSTaggedValue, LocaleString, LOCALE_STRING_INDEX, locale)                                                       \
314     V(JSTaggedValue, TimeZoneString, TIME_ZONE_STRING_INDEX, timeZone)                                                \
315     V(JSTaggedValue, LiteralString, LITERAL_STRING_INDEX, literal)                                                    \
316     V(JSTaggedValue, YearNameString, YEAR_NAME_STRING_INDEX, yearName)                                                \
317     V(JSTaggedValue, DayPeriodString, DAY_PERIOD_STRING_INDEX, dayPeriod)                                             \
318     V(JSTaggedValue, FractionalSecondDigitsString, FRACTIONAL_SECOND_DIGITS_STRING_INDEX, fractionalSecondDigits)     \
319     V(JSTaggedValue, FractionalSecondString, FRACTIONAL_SECOND_STRING_INDEX, fractionalSecond)                        \
320     V(JSTaggedValue, RelatedYearString, RELATED_YEAR_STRING_INDEX, relatedYear)                                       \
321     V(JSTaggedValue, LookUpString, LOOK_UP_STRING_INDEX, lookup)                                                      \
322     V(JSTaggedValue, BestFitString, BEST_FIT_STRING_INDEX, bestfit)                                                   \
323     V(JSTaggedValue, DateStyleString, DATE_STYLE_STRING_INDEX, dateStyle)                                             \
324     V(JSTaggedValue, TimeStyleString, TIME_STYLE_STRING_INDEX, timeStyle)                                             \
325     V(JSTaggedValue, UTCString, UTC_STRING_INDEX, UTC)                                                                \
326     V(JSTaggedValue, WeekString, WEEK_STRING_INDEX, week)                                                             \
327     V(JSTaggedValue, WeeksString, WEEKS_STRING_INDEX, weeks)                                                          \
328     V(JSTaggedValue, SourceString, SOURCE_STRING_INDEX, source)                                                       \
329     V(JSTaggedValue, FormatString, FORMAT_STRING_INDEX, format)                                                       \
330     V(JSTaggedValue, EnUsString, EN_US_STRING_INDEX, en - US)                                                         \
331     V(JSTaggedValue, UndString, UND_STRING_INDEX, und)                                                                \
332     V(JSTaggedValue, LatnString, LATN_STRING_INDEX, latn)                                                             \
333     V(JSTaggedValue, StyleString, STYLE_STRING_INDEX, style)                                                          \
334     V(JSTaggedValue, UnitString, UNIT_STRING_INDEX, unit)                                                             \
335     V(JSTaggedValue, IntegerString, INTEGER_STRING_INDEX, integer)                                                    \
336     V(JSTaggedValue, NanString, NAN_STRING_INDEX, nan)                                                                \
337     V(JSTaggedValue, InfinityString, INFINITY_STRING_INDEX, infinity)                                                 \
338     V(JSTaggedValue, FractionString, FRACTION_STRING_INDEX, fraction)                                                 \
339     V(JSTaggedValue, DecimalString, DECIMAL_STRING_INDEX, decimal)                                                    \
340     V(JSTaggedValue, GroupString, GROUP_STRING_INDEX, group)                                                          \
341     V(JSTaggedValue, GroupsString, GROUPS_STRING_INDEX, groups)                                                       \
342     V(JSTaggedValue, CurrencyString, CURRENCY_STRING_INDEX, currency)                                                 \
343     V(JSTaggedValue, CurrencySignString, CURRENCY_SIGN_STRING_INDEX, currencySign)                                    \
344     V(JSTaggedValue, CurrencyDisplayString, CURRENCY_DISPLAY_STRING_INDEX, currencyDisplay)                           \
345     V(JSTaggedValue, PercentSignString, PERCENT_SIGN_STRING_INDEX, percentSign)                                       \
346     V(JSTaggedValue, PercentString, PERCENT_STRING_INDEX, percent)                                                    \
347     V(JSTaggedValue, MinusSignString, MINUS_SIGN_STRING_INDEX, minusSign)                                             \
348     V(JSTaggedValue, PlusSignString, PLUS_SIGN_STRING_INDEX, plusSign)                                                \
349     V(JSTaggedValue, ExponentSeparatorString, EXPONENT_SEPARATOR_STRING_INDEX, exponentSeparator)                     \
350     V(JSTaggedValue, ExponentMinusSignString, EXPONENT_MINUS_SIGN_INDEX, exponentMinusSign)                           \
351     V(JSTaggedValue, ExponentIntegerString, EXPONENT_INTEGER_STRING_INDEX, exponentInteger)                           \
352     V(JSTaggedValue, LongString, LONG_STRING_INDEX, long)                                                             \
353     V(JSTaggedValue, ShortString, SHORT_STRING_INDEX, short)                                                          \
354     V(JSTaggedValue, FullString, FULL_STRING_INDEX, full)                                                             \
355     V(JSTaggedValue, MediumString, MEDIUM_STRING_INDEX, medium)                                                       \
356     V(JSTaggedValue, NarrowString, NARROW_STRING_INDEX, narrow)                                                       \
357     V(JSTaggedValue, AlwaysString, ALWAYS_STRING_INDEX, always)                                                       \
358     V(JSTaggedValue, AutoString, AUTO_STRING_INDEX, auto)                                                             \
359     V(JSTaggedValue, ThrowString, THROW_STRING_INDEX, throw)                                                          \
360     V(JSTaggedValue, UnitDisplayString, UNIT_DISPLAY_INDEX, unitDisplay)                                              \
361     V(JSTaggedValue, NotationString, NOTATION_INDEX, notation)                                                        \
362     V(JSTaggedValue, CompactDisplayString, COMPACT_DISPALY_INDEX, compactDisplay)                                     \
363     V(JSTaggedValue, UserGroupingString, USER_GROUPING_INDEX, useGrouping)                                            \
364     V(JSTaggedValue, SignDisplayString, SIGN_DISPLAY_INDEX, signDisplay)                                              \
365     V(JSTaggedValue, CodeString, CODE_INDEX, code)                                                                    \
366     V(JSTaggedValue, NarrowSymbolString, NARROW_SYMBOL_INDEX, narrowSymbol)                                           \
367     V(JSTaggedValue, StandardString, STANDARD_INDEX, standard)                                                        \
368     V(JSTaggedValue, AccountingString, ACCOUNTING_INDEX, accounting)                                                  \
369     V(JSTaggedValue, ScientificString, SCIENTIFIC_INDEX, scientific)                                                  \
370     V(JSTaggedValue, EngineeringString, ENGINEERING_INDEX, engineering)                                               \
371     V(JSTaggedValue, CompactString, COMPACT_STRING_INDEX, compact)                                                    \
372     V(JSTaggedValue, NeverString, NEVER_INDEX, never)                                                                 \
373     V(JSTaggedValue, ExceptZeroString, EXPECT_ZERO_INDEX, exceptZero)                                                 \
374     V(JSTaggedValue, MinimumIntegerDigitsString, MINIMUM_INTEGER_DIGITS_INDEX, minimumIntegerDigits)                  \
375     V(JSTaggedValue, MinimumFractionDigitsString, MINIMUM_FRACTIONDIGITS_INDEX, minimumFractionDigits)                \
376     V(JSTaggedValue, MaximumFractionDigitsString, MAXIMUM_FRACTIONDIGITS_INDEX, maximumFractionDigits)                \
377     V(JSTaggedValue, MinimumSignificantDigitsString, MINIMUM_SIGNIFICANTDIGITS_INDEX, minimumSignificantDigits)       \
378     V(JSTaggedValue, MaximumSignificantDigitsString, MAXIMUM_SIGNIFICANTDIGITS_INDEX, maximumSignificantDigits)       \
379     V(JSTaggedValue, InvalidDateString, INVALID_DATE_INDEX, InvalidDate)                                              \
380     V(JSTaggedValue, UsageString, USAGE_INDEX, usage)                                                                 \
381     V(JSTaggedValue, CompareString, COMPARE_INDEX, compare)                                                           \
382     V(JSTaggedValue, SensitivityString, SENSITIVITY_INDEX, sensitivity)                                               \
383     V(JSTaggedValue, IgnorePunctuationString, IGNORE_PUNCTUATION_INDEX, ignorePunctuation)                            \
384     V(JSTaggedValue, CardinalString, CARDINAL_INDEX, cardinal)                                                        \
385     V(JSTaggedValue, OrdinalString, ORDINAL_INDEX, ordinal)                                                           \
386     V(JSTaggedValue, ExecString, EXEC_INDEX, exec)                                                                    \
387     V(JSTaggedValue, LastIndexString, LAST_INDEX_INDEX, lastIndex)                                                    \
388     V(JSTaggedValue, PluralCategoriesString, PLURAL_CATEGORIES_INDEX, pluralCategories)                               \
389     V(JSTaggedValue, SortString, SORT_INDEX, sort)                                                                    \
390     V(JSTaggedValue, SearchString, SEARCH_INDEX, search)                                                              \
391     V(JSTaggedValue, BaseString, BASE_INDEX, base)                                                                    \
392     V(JSTaggedValue, AccentString, ACCENT_INDEX, accent)                                                              \
393     V(JSTaggedValue, CaseString, CASE_INDEX, Case)                                                                    \
394     V(JSTaggedValue, VariantString, VARIANT_INDEX, variant)                                                           \
395     V(JSTaggedValue, EnUsPosixString, EN_US_POSIX_STRING_INDEX, en - US - POSIX)                                      \
396     V(JSTaggedValue, UpperString, UPPER_INDEX, upper)                                                                 \
397     V(JSTaggedValue, LowerString, LOWER_INDEX, lower)                                                                 \
398     V(JSTaggedValue, DefaultString, DEFAULT_INDEX, Default)                                                           \
399     V(JSTaggedValue, SharedString, SHARED_INDEX, shared)                                                              \
400     V(JSTaggedValue, StartRangeString, START_RANGE_INDEX, startRange)                                                 \
401     V(JSTaggedValue, EndRangeString, END_RANGE_INDEX, endRange)                                                       \
402     V(JSTaggedValue, Iso8601String, ISO8601_INDEX, iso8601)                                                           \
403     V(JSTaggedValue, GregoryString, GREGORY_INDEX, gregory)                                                           \
404     V(JSTaggedValue, EthioaaString, ETHIOAA_INDEX, ethioaa)                                                           \
405     V(JSTaggedValue, StickyString, STICKY_INDEX, sticky)                                                              \
406     V(JSTaggedValue, UString, U_INDEX, u)                                                                             \
407     V(JSTaggedValue, IndexString, INDEX_INDEX, index)                                                                 \
408     V(JSTaggedValue, InputString, INPUT_INDEX, input)                                                                 \
409     V(JSTaggedValue, UnicodeString, UNICODE_INDEX, unicode)                                                           \
410     V(JSTaggedValue, ZeroString, ZERO_INDEX, zero)                                                                    \
411     V(JSTaggedValue, ValuesString, VALUES_INDEX, values)                                                              \
412     V(JSTaggedValue, AddString, ADD_INDEX, add)                                                                       \
413     V(JSTaggedValue, AmbiguousString, AMBIGUOUS_INDEX, ambiguous)                                                     \
414     V(JSTaggedValue, ModuleString, MODULE_INDEX, module)                                                              \
415     V(JSTaggedValue, StarString, STAR_INDEX, star)                                                                    \
416     V(JSTaggedValue, DateTimeFieldString, DATETIMEFIELD_INDEX, datetimefield)                                         \
417     V(JSTaggedValue, ConjunctionString, CONJUNCTION_INDEX, conjunction)                                               \
418     V(JSTaggedValue, NoneString, NONE_INDEX, none)                                                                    \
419     V(JSTaggedValue, FallbackString, FALLBACK_INDEX, fallback)                                                        \
420     V(JSTaggedValue, DisjunctionString, DISJUNCTION_INDEX, disjunction)                                               \
421     V(JSTaggedValue, ElementString, ELEMENT_INDEX, element)                                                           \
422     V(JSTaggedValue, FlagsString, FLAGS_INDEX, flags)                                                                 \
423     V(JSTaggedValue, GString, G_INDEX, g)                                                                             \
424     V(JSTaggedValue, NotEqualString, NOT_EQUAL_INDEX, notEqual)                                                       \
425     V(JSTaggedValue, OkString, OK_INDEX, ok)                                                                          \
426     V(JSTaggedValue, TimeoutString, TIMEOUT_INDEX, timedout)                                                          \
427     V(JSTaggedValue, NfcString, NFC_INDEX, nfc)                                                                       \
428     V(JSTaggedValue, EntriesString, ENTRIES_INDEX, entries)                                                           \
429     V(JSTaggedValue, LeftSquareBracketString, LEFT_SQUARE_BRACKET_INDEX, leftsquarebracket)                           \
430     V(JSTaggedValue, RightSquareBracketString, RIGHT_SQUARE_BRACKET_INDEX, rightsquarebracket)                        \
431     V(JSTaggedValue, YString, Y_INDEX, y)                                                                             \
432     V(JSTaggedValue, DollarString, DOLLAR_INDEX, dollar)                                                              \
433     V(JSTaggedValue, CommaString, COMMA_INDEX, comma)                                                                 \
434     V(JSTaggedValue, JoinString, JOIN_INDEX, join)                                                                    \
435     V(JSTaggedValue, CopyWithinString, COPY_WITHIN_INDEX, copywithin)                                                 \
436     V(JSTaggedValue, FillString, FILL_INDEX, fill)                                                                    \
437     V(JSTaggedValue, FindString, FIND_INDEX, find)                                                                    \
438     V(JSTaggedValue, FindIndexString, FIND_INDEX_INDEX, findindex)                                                    \
439     V(JSTaggedValue, FlatString, FLAT_INDEX, flat)                                                                    \
440     V(JSTaggedValue, FlatMapString, FLATMAP_INDEX, flatmap)                                                           \
441     V(JSTaggedValue, IncludesString, INCLUDES_INDEX, includes)                                                        \
442     V(JSTaggedValue, KeysString, KEYS_INDEX, keys)                                                                    \
443     V(JSTaggedValue, BoundString, BOUND_INDEX, bound)                                                                 \
444     V(JSTaggedValue, BackslashString, BACKSLASH_INDEX, backslash)                                                     \
445     V(JSTaggedValue, SpaceString, SPACE_INDEX, space)                                                                 \
446     V(JSTaggedValue, NanCapitalString, NAN_INDEX, nan)                                                                \
447     V(JSTaggedValue, CjsExportsString, CJS_EXPORTS_INDEX, exportsStr)                                                 \
448     V(JSTaggedValue, CjsCacheString, CJS_CACHE_INDEX, cacheStr)                                                       \
449     V(JSTaggedValue, NapiWrapperString, NAPI_WRAPPER_INDEX, napiwrapper)                                              \
450     /* for require native module */                                                                                   \
451     V(JSTaggedValue, RequireNativeModuleString, REQUIRE_NATIVE_MOUDULE_FUNC_INDEX, requireNativeModule)               \
452     V(JSTaggedValue, RequireNapiString, REQUIRE_NAPI_FUNC_INDEX, requireNapi)                                         \
453     V(JSTaggedValue, DollarStringOne, DOLLAR_STRING_ONE_INDEX, dollarStrOne)                                          \
454     V(JSTaggedValue, DollarStringTwo, DOLLAR_STRING_TWO_INDEX, dollarStrTwo)                                          \
455     V(JSTaggedValue, DollarStringThree, DOLLAR_STRING_THREE_INDEX, dollarStrThree)                                    \
456     V(JSTaggedValue, DollarStringFour, DOLLAR_STRING_FOUR_INDEX, dollarStrFour)                                       \
457     V(JSTaggedValue, DollarStringFive, DOLLAR_STRING_FIVE_INDEX, dollarStrFive)                                       \
458     V(JSTaggedValue, DollarStringSix, DOLLAR_STRING_SIX_INDEX, dollarStrSix)                                          \
459     V(JSTaggedValue, DollarStringSeven, DOLLAR_STRING_SEVEN_INDEX, dollarStrSeven)                                    \
460     V(JSTaggedValue, DollarStringEight, DOLLAR_STRING_EIGHT_INDEX, dollarStrEight)                                    \
461     V(JSTaggedValue, DollarStringNine, DOLLAR_STRING_NINE_INDEX, dollarStrNine)
462 
463 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
464 #define GLOBAL_ENV_CONSTANT_ACCESSOR(V)                                                           \
465     V(JSTaggedValue, FunctionPrototypeAccessor, FUNCTION_PROTOTYPE_ACCESSOR, ecma_roots_accessor) \
466     V(JSTaggedValue, FunctionNameAccessor, FUNCTION_NAME_ACCESSOR, ecma_roots_accessor)           \
467     V(JSTaggedValue, ArrayLengthAccessor, ARRAY_LENGTH_ACCESSOR, ecma_roots_accessor)
468 
469 #define GLOBAL_ENV_CACHES(V)                \
470     V(JSTaggedValue, CachedJSCollatorLocales, CACHED_JSCOLLATOR_LOCALES_INDEX, cachedCollatorLocales)
471 
472 // ConstantIndex used for explicit visit each constant.
473 enum class ConstantIndex : size_t {
474 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
475 #define INDEX_FILTER(Type, Name, Index, Desc) Index,
476     GLOBAL_ENV_CONSTANT_CLASS(INDEX_FILTER) GLOBAL_ENV_CONSTANT_SPECIAL(INDEX_FILTER)
477         GLOBAL_ENV_CONSTANT_CONSTANT(INDEX_FILTER) GLOBAL_ENV_CONSTANT_ACCESSOR(INDEX_FILTER)
478         GLOBAL_ENV_CACHES(INDEX_FILTER)
479 
480 #undef INDEX_FILTER
481             CONSTATNT_COUNT,
482 
483     CONSTATNT_BEGIN = 0,
484     CONSTATNT_END = CONSTATNT_COUNT,
485 
486     READ_ONLY_CONSTATNT_BEGIN = CONSTATNT_BEGIN,
487     READ_ONLY_CONSTATNT_END = CONSTATNT_END,
488     JSAPI_CONTAINERS_BEGIN = ARRAYLIST_FUNCTION_INDEX,
489     JSAPI_CONTAINERS_END = LINKED_LIST_ITERATOR_PROTOTYPE_INDEX,
490     // ...
491 };
492 // clang-format on
493 
494 class GlobalEnvConstants {
495 public:
496     GlobalEnvConstants() = default;
497     ~GlobalEnvConstants() = default;
498 
499     DEFAULT_MOVE_SEMANTIC(GlobalEnvConstants);
500     DEFAULT_COPY_SEMANTIC(GlobalEnvConstants);
501 
502     const JSTaggedValue *BeginSlot() const;
503 
504     const JSTaggedValue *EndSlot() const;
505 
506     void Init(JSThread *thread, JSHClass *hClass);
507 
508     void InitRootsClass(JSThread *thread, JSHClass *hClass);
509     void InitGlobalConstantSpecial(JSThread *thread);
510 
511     void InitGlobalConstant(JSThread *thread);
512     void InitGlobalCaches();
513     void InitJSAPIContainers();
514 
515     void InitSpecialForSnapshot();
516     void InitClassConstructorOptimizedClass(ObjectFactory *factory);
517 
518     void InitElementKindHClass(const JSThread *thread, JSHandle<JSHClass> originHClass);
519 
520     void SetCachedLocales(JSTaggedValue value);
521 
522     void SetConstant(ConstantIndex index, JSTaggedValue value);
523 
524     template<typename T>
525     void SetConstant(ConstantIndex index, JSHandle<T> value);
526 
527     uintptr_t GetGlobalConstantAddr(ConstantIndex index) const;
528 
529 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
530 #define DECL_GET(Type, Name, Index, Desc) \
531     const Type Get##Name() const;         \
532     const JSHandle<Type> GetHandled##Name() const; \
533     static size_t GetOffsetOf##Name();
534 
535     GLOBAL_ENV_CONSTANT_CLASS(DECL_GET)
GLOBAL_ENV_CONSTANT_SPECIAL(DECL_GET)536     GLOBAL_ENV_CONSTANT_SPECIAL(DECL_GET)
537     GLOBAL_ENV_CONSTANT_CONSTANT(DECL_GET)
538     GLOBAL_ENV_CONSTANT_ACCESSOR(DECL_GET)
539     GLOBAL_ENV_CACHES(DECL_GET)
540 #undef DECL_GET
541 
542     void VisitRangeSlot(const RootRangeVisitor &visitor)
543     {
544         visitor(ecmascript::Root::ROOT_VM, ObjectSlot(ToUintPtr(BeginSlot())), ObjectSlot(ToUintPtr(EndSlot())));
545     }
546 
GetGlobalConstantObject(size_t index)547     JSTaggedValue GetGlobalConstantObject(size_t index) const
548     {
549         ASSERT(static_cast<ConstantIndex>(index) < ConstantIndex::CONSTATNT_COUNT);
550         return constants_[index];
551     }
552 
GetConstantCount()553     size_t GetConstantCount() const
554     {
555         return static_cast<size_t>(ConstantIndex::CONSTATNT_COUNT);
556     }
557 
GetJSAPIContainersBegin()558     size_t GetJSAPIContainersBegin() const
559     {
560         return static_cast<size_t>(ConstantIndex::JSAPI_CONTAINERS_BEGIN);
561     }
562 
GetJSAPIContainersEnd()563     size_t GetJSAPIContainersEnd() const
564     {
565         return static_cast<size_t>(ConstantIndex::JSAPI_CONTAINERS_END);
566     }
567 
IsSpecialOrUndefined(size_t index)568     bool IsSpecialOrUndefined(size_t index) const
569     {
570         size_t specialBegin = static_cast<size_t>(ConstantIndex::UNDEFINED_INDEX);
571         size_t specialEnd = static_cast<size_t>(ConstantIndex::NULL_INDEX);
572         size_t undefinedBegin = GetJSAPIContainersBegin();
573         size_t undefinedEnd = GetJSAPIContainersEnd();
574         return (index >= specialBegin && index <= specialEnd) || (index >= undefinedBegin && index <= undefinedEnd);
575     }
576 
577     static constexpr size_t SizeArch32 =
578         JSTaggedValue::TaggedTypeSize() * static_cast<size_t>(ConstantIndex::CONSTATNT_COUNT);
579     static constexpr size_t SizeArch64 =
580         JSTaggedValue::TaggedTypeSize() * static_cast<size_t>(ConstantIndex::CONSTATNT_COUNT);
581 
582 private:
583     JSTaggedValue constants_[static_cast<int>(ConstantIndex::CONSTATNT_COUNT)];  // NOLINT(modernize-avoid-c-arrays)
584 };
585 STATIC_ASSERT_EQ_ARCH(sizeof(GlobalEnvConstants), GlobalEnvConstants::SizeArch32, GlobalEnvConstants::SizeArch64);
586 }  // namespace panda::ecmascript
587 #endif  // ECMASCRIPT_GLOBAL_ENV_CONSTANTS_H
588