• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 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_JS_HCLASS_H
17 #define ECMASCRIPT_JS_HCLASS_H
18 
19 #include "ecmascript/cross_vm/js_hclass_hybrid.h"
20 
21 #include "ecmascript/ecma_macros.h"
22 #include "ecmascript/elements.h"
23 #include "ecmascript/js_tagged_value.h"
24 #include "ecmascript/mem/tagged_object.h"
25 #include "ecmascript/mem/barriers.h"
26 #include "ecmascript/mem/slots.h"
27 #include "ecmascript/mem/visitor.h"
28 #include "ecmascript/property_attributes.h"
29 #include "common_interfaces/objects/composite_base_class.h"
30 
31 #include "libpandabase/utils/bit_field.h"
32 
33 /*
34  *                         JS Object and JS HClass Layout
35  *
36  *      Properties                         JS Object                    JS HClass
37  *      +------------+                     +------------+               +------------------+
38  *      |arrayHClass + <---------|         |JS HClass   +-------------->|   meta hclass    |
39  *      +------------+           |         +------------+               +------------------+
40  *      | property 0 |           |         |Hash        |               |   hclass level   |
41  *      +------------+           |         +------------+               +------------------+
42  *      | property 1 |           |-------  |Properties  |               |   supers[]       |
43  *      +------------+                     +------------+               +------------------+
44  *      |...         |           |-------  |Elements    |               |   vtable[]       |
45  *      +------------+           |         +------------+               +------------------+
46  *                               |         |inl-prop-0  |               |   prototype      |
47  *      Elements                 |         +------------+               +------------------+
48  *      +------------+           |         |inl-prop-1  |               |   layout         |
49  *      |arrayHClass + <---------|         +------------+               +------------------+
50  *      +------------+                     |...         |               |   transitions    |
51  *      | value 0    |                     +------------+               +------------------+
52  *      +------------+                                                  |    parent        |
53  *      | value 1    |                                                  +------------------+
54  *      +------------+                                                  |ProtoChangeMarker |
55  *      |...         |                                                  +------------------+
56  *      +------------+                                                  |    EnumCache     |
57  *                                                                      +------------------+
58  *
59  *                          Proto: [[Prototype]] in Ecma spec
60  *                          Layout: record key and attr
61  *                          ProtoChangeMarker, ProtoChangeDetails: monitor [[prototype]] chain
62  *                          EnumCache: use for for-in syntax
63  *
64  */
65 namespace panda::ecmascript {
66 class ProtoChangeDetails;
67 class PropertyLookupResult;
68 class SharedHeap;
69 class JSSharedArray;
70 class LayoutInfo;
71 class NameDictionary;
72 class ObjectFactory;
73 class GlobalEnv;
74 namespace pgo {
75     class HClassLayoutDesc;
76     class PGOHClassTreeDesc;
77     class PGOHandler;
78 } // namespace pgo
79 using HClassLayoutDesc = pgo::HClassLayoutDesc;
80 using PGOHClassTreeDesc = pgo::PGOHClassTreeDesc;
81 using PGOHandler = pgo::PGOHandler;
82 
83 struct Reference;
84 
85 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
86 #define JSTYPE_DECL(V)       /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
87                              /* COMMON_TYPE /////////////////////////////////////////////////////////////////////// */ \
88         V(LINE_STRING),   /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
89         V(SLICED_STRING),  /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \
90         V(TREE_STRING),  /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
91         V(COMPOSITE_BASE_CLASS),  /* //////////////////////////////////////////////////////////////////////-PADDING */ \
92                                                                                                                        \
93         V(JS_OBJECT),        /* JS_OBJECT_FIRST /////////////////////////////////////////////////////////////////// */ \
94         V(JS_XREF_OBJECT),   /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
95         V(JS_SHARED_OBJECT), /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
96         V(JS_REALM),         /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
97         V(JS_FUNCTION_BASE), /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
98         V(JS_FUNCTION),      /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
99         V(JS_SHARED_FUNCTION),            /* //////////////////////////////////////////////////////////////-PADDING */ \
100         V(JS_PROXY_REVOC_FUNCTION),       /* //////////////////////////////////////////////////////////////-PADDING */ \
101         V(JS_PROMISE_REACTIONS_FUNCTION), /* //////////////////////////////////////////////////////////////-PADDING */ \
102         V(JS_PROMISE_EXECUTOR_FUNCTION),  /* //////////////////////////////////////////////////////////////-PADDING */ \
103         V(JS_ASYNC_MODULE_FULFILLED_FUNCTION), /* /////////////////////////////////////////////////////////-PADDING */ \
104         V(JS_ASYNC_MODULE_REJECTED_FUNCTION), /* //////////////////////////////////////////////////////////-PADDING */ \
105         V(JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION),  /* ///////////////////////////////////////////////////-PADDING */ \
106         V(JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION),  /* ///////////////////////////////////////////////////-PADDING */ \
107         V(JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN), /* ////////////////////////////////////-PADDING */ \
108         V(JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION),  /* ////////////////////////////////////////////////////-PADDING */ \
109         V(JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION),  /* ///////////////////////////////////////////////////-PADDING */ \
110         V(JS_PROMISE_FINALLY_FUNCTION),  /* ///////////////////////////////////////////////////////////////-PADDING */ \
111         V(JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION),  /* ////////////////////////////////////////////////-PADDING */ \
112         V(JS_GENERATOR_FUNCTION), /* //////////////////////////////////////////////////////////////////////-PADDING */ \
113         V(JS_ASYNC_GENERATOR_FUNCTION),  /* ///////////////////////////////////////////////////////////////-PADDING */ \
114         V(JS_ASYNC_FUNCTION), /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
115         V(JS_SHARED_ASYNC_FUNCTION), /* ///////////////////////////////////////////////////////////////////-PADDING */ \
116         V(JS_INTL_BOUND_FUNCTION), /* /////////////////////////////////////////////////////////////////////-PADDING */ \
117         V(JS_ASYNC_AWAIT_STATUS_FUNCTION), /* /////////////////////////////////////////////////////////////-PADDING */ \
118         V(JS_BOUND_FUNCTION), /*  ///////////////////////////////////////////////////////////////////////////////// */ \
119                                                                                                                        \
120         V(JS_ERROR),           /* JS_ERROR_FIRST //////////////////////////////////////////////////////////-PADDING */ \
121         V(JS_EVAL_ERROR),      /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
122         V(JS_RANGE_ERROR),     /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
123         V(JS_REFERENCE_ERROR), /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
124         V(JS_TYPE_ERROR),      /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
125         V(JS_AGGREGATE_ERROR), /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
126         V(JS_URI_ERROR),       /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
127         V(JS_SYNTAX_ERROR),    /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
128         V(JS_OOM_ERROR),       /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
129         V(JS_TERMINATION_ERROR), /* JS_ERROR_LAST ///////////////////////////////////////////////////////////////// */ \
130                                                                                                                        \
131         V(JS_REG_EXP),  /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
132         V(JS_SET),      /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
133         V(JS_SHARED_SET), /*  /////////////////////////////////////////////////////////////////////////////-PADDING */ \
134         V(JS_MAP),      /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
135         V(JS_SHARED_MAP), /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
136         V(JS_WEAK_MAP), /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
137         V(JS_WEAK_SET), /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
138         V(JS_WEAK_REF), /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
139         V(JS_FINALIZATION_REGISTRY), /* ///////////////////////////////////////////////////////////////////-PADDING */ \
140         V(JS_DATE),     /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
141         V(JS_ITERATOR), /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
142         V(JS_ASYNCITERATOR), /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
143         V(JS_ASYNC_FROM_SYNC_ITERATOR), /* ////////////////////////////////////////////////////////////////-PADDING */ \
144         V(JS_FORIN_ITERATOR),       /* ////////////////////////////////////////////////////////////////////-PADDING */ \
145         V(JS_MAP_ITERATOR),         /* ////////////////////////////////////////////////////////////////////-PADDING */ \
146         V(JS_SHARED_MAP_ITERATOR),  /* ////////////////////////////////////////////////////////////////////-PADDING */ \
147         V(JS_SET_ITERATOR),         /* ////////////////////////////////////////////////////////////////////-PADDING */ \
148         V(JS_SHARED_SET_ITERATOR),  /* ////////////////////////////////////////////////////////////////////-PADDING */ \
149         V(JS_REG_EXP_ITERATOR),        /* /////////////////////////////////////////////////////////////////-PADDING */ \
150         V(JS_API_ARRAYLIST_ITERATOR), /* //////////////////////////////////////////////////////////////////-PADDING */ \
151         V(JS_API_DEQUE_ITERATOR),   /* ////////////////////////////////////////////////////////////////////-PADDING */ \
152         V(JS_API_HASHMAP_ITERATOR), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
153         V(JS_API_HASHSET_ITERATOR), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
154         V(JS_API_LIGHT_WEIGHT_MAP_ITERATOR), /* ///////////////////////////////////////////////////////////-PADDING */ \
155         V(JS_API_LIGHT_WEIGHT_SET_ITERATOR),  /* //////////////////////////////////////////////////////////-PADDING */ \
156         V(JS_API_PLAIN_ARRAY_ITERATOR),  /* ///////////////////////////////////////////////////////////////-PADDING */ \
157         V(JS_API_QUEUE_ITERATOR),   /* ////////////////////////////////////////////////////////////////////-PADDING */ \
158         V(JS_API_STACK_ITERATOR),   /* ////////////////////////////////////////////////////////////////////-PADDING */ \
159         V(JS_API_TREEMAP_ITERATOR), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
160         V(JS_API_TREESET_ITERATOR), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
161         V(JS_API_VECTOR_ITERATOR),  /* ////////////////////////////////////////////////////////////////////-PADDING */ \
162         V(JS_API_BITVECTOR_ITERATOR),  /* /////////////////////////////////////////////////////////////////-PADDING */ \
163         V(JS_API_LINKED_LIST_ITERATOR), /* ////////////////////////////////////////////////////////////////-PADDING */ \
164         V(JS_API_LIST_ITERATOR),    /* ////////////////////////////////////////////////////////////////////-PADDING */ \
165         V(JS_ARRAY_ITERATOR),       /* ////////////////////////////////////////////////////////////////////-PADDING */ \
166         V(JS_SHARED_ARRAY_ITERATOR), /* ///////////////////////////////////////////////////////////////////-PADDING */ \
167         V(JS_SEGMENT_ITERATOR),       /* //////////////////////////////////////////////////////////////////-PADDING */ \
168         V(JS_STRING_ITERATOR),      /* ////////////////////////////////////////////////////////////////////-PADDING */ \
169         V(JS_INTL), /* ////////////////////////////////////////////////////////////////////////////////////-PADDING */ \
170         V(JS_LOCALE), /* //////////////////////////////////////////////////////////////////////////////////-PADDING */ \
171         V(JS_DATE_TIME_FORMAT), /* ////////////////////////////////////////////////////////////////////////-PADDING */ \
172         V(JS_RELATIVE_TIME_FORMAT), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
173         V(JS_NUMBER_FORMAT), /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
174         V(JS_COLLATOR), /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
175         V(JS_PLURAL_RULES), /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
176         V(JS_DISPLAYNAMES), /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
177         V(JS_LIST_FORMAT),  /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
178         V(JS_SEGMENTER), /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
179         V(JS_SEGMENTS), /* //////////////////////////////////////////////////////////////////////// ///////-PADDING */ \
180                                                                                                                        \
181         V(JS_ARRAY_BUFFER), /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
182         V(JS_SHARED_ARRAY_BUFFER), /* /////////////////////////////////////////////////////////////////////-PADDING */ \
183         V(JS_SENDABLE_ARRAY_BUFFER), /* ///////////////////////////////////////////////////////////////////-PADDING */ \
184         V(JS_PROMISE),      /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
185         V(JS_DATA_VIEW),    /* //////////////////////////////////////////////////////////////////////////////////// */ \
186         V(JS_ARGUMENTS), /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
187         V(JS_GENERATOR_OBJECT),  /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
188         V(JS_ASYNC_GENERATOR_OBJECT),  /* /////////////////////////////////////////////////////////////////-PADDING */ \
189         V(JS_ASYNC_FUNC_OBJECT), /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
190                                                                                                                        \
191         /* SPECIAL indexed objects begin, DON'T CHANGE HERE ///////////////////////////////////////////////-PADDING */ \
192         V(JS_ARRAY),       /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \
193         V(JS_SHARED_ARRAY), /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
194         V(JS_API_ARRAY_LIST), /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
195         V(JS_API_LIGHT_WEIGHT_MAP),      /* ///////////////////////////////////////////////////////////////-PADDING */ \
196         V(JS_API_LIGHT_WEIGHT_SET), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
197         V(JS_API_VECTOR),     /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
198         V(JS_API_BITVECTOR),     /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
199         V(JS_API_LINKED_LIST), /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
200         V(JS_API_LIST),       /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
201         V(JS_API_HASH_MAP),   /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
202         V(JS_API_HASH_SET),   /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
203         V(JS_API_TREE_MAP),   /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
204         V(JS_API_TREE_SET),   /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
205         V(JS_API_DEQUE),      /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
206         V(JS_API_STACK),      /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
207         V(JS_API_PLAIN_ARRAY), /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
208         V(JS_API_FAST_BUFFER), /* //////////////////////////////////////////////////////////////////////////-PADDING */\
209         V(JS_API_QUEUE),      /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
210         V(JS_TYPED_ARRAY), /* JS_TYPED_ARRAY_FIRST //////////////////////////////////////////////////////////////// */ \
211         V(JS_INT8_ARRAY),  /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \
212         V(JS_UINT8_ARRAY), /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \
213         V(JS_UINT8_CLAMPED_ARRAY), /* /////////////////////////////////////////////////////////////////////-PADDING */ \
214         V(JS_INT16_ARRAY),         /* /////////////////////////////////////////////////////////////////////-PADDING */ \
215         V(JS_UINT16_ARRAY),        /* /////////////////////////////////////////////////////////////////////-PADDING */ \
216         V(JS_INT32_ARRAY),         /* /////////////////////////////////////////////////////////////////////-PADDING */ \
217         V(JS_UINT32_ARRAY),        /* /////////////////////////////////////////////////////////////////////-PADDING */ \
218         V(JS_FLOAT32_ARRAY),       /* /////////////////////////////////////////////////////////////////////-PADDING */ \
219         V(JS_FLOAT64_ARRAY),       /* /////////////////////////////////////////////////////////////////////-PADDING */ \
220         V(JS_BIGINT64_ARRAY),      /* /////////////////////////////////////////////////////////////////////-PADDING */ \
221         V(JS_BIGUINT64_ARRAY),     /* JS_TYPED_ARRAY_LAST ///////////////////////////////////////////////////////// */ \
222         V(JS_SHARED_TYPED_ARRAY),  /* JS_SHARED_TYPED_ARRAY_FIRST ///////////////////////////////////////////////// */ \
223         V(JS_SHARED_INT8_ARRAY),  /* //////////////////////////////////////////////////////////////////////-PADDING */ \
224         V(JS_SHARED_UINT8_ARRAY), /* //////////////////////////////////////////////////////////////////////-PADDING */ \
225         V(JS_SHARED_UINT8_CLAMPED_ARRAY), /* //////////////////////////////////////////////////////////////-PADDING */ \
226         V(JS_SHARED_INT16_ARRAY),         /* //////////////////////////////////////////////////////////////-PADDING */ \
227         V(JS_SHARED_UINT16_ARRAY),        /* //////////////////////////////////////////////////////////////-PADDING */ \
228         V(JS_SHARED_INT32_ARRAY),         /* //////////////////////////////////////////////////////////////-PADDING */ \
229         V(JS_SHARED_UINT32_ARRAY),        /* //////////////////////////////////////////////////////////////-PADDING */ \
230         V(JS_SHARED_FLOAT32_ARRAY),       /* //////////////////////////////////////////////////////////////-PADDING */ \
231         V(JS_SHARED_FLOAT64_ARRAY),       /* //////////////////////////////////////////////////////////////-PADDING */ \
232         V(JS_SHARED_BIGINT64_ARRAY),      /* //////////////////////////////////////////////////////////////-PADDING */ \
233         V(JS_SHARED_BIGUINT64_ARRAY),     /* JS_SHARED_TYPED_ARRAY_LAST /////////////////////////////////////////// */ \
234         V(JS_PRIMITIVE_REF), /* number\boolean\string. SPECIAL indexed objects end, DON'T CHANGE E ////////-PADDING */ \
235         V(JS_MODULE_NAMESPACE), /* ////////////////////////////////////////////////////////////////////////-PADDING */ \
236         V(JS_CJS_MODULE), /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
237         V(JS_CJS_EXPORTS), /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \
238         V(JS_CJS_REQUIRE), /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \
239         V(NATIVE_MODULE_FAILURE_INFO), /* /////////////////////////////////////////////////////////////////-PADDING */ \
240         V(JS_GLOBAL_OBJECT), /* JS_OBJECT_LAST/////////////////////////////////////////////////////////////-PADDING */ \
241         V(JS_PROXY), /* ECMA_OBJECT_LAST ////////////////////////////////////////////////////////////////////////// */ \
242                                                                                                                        \
243         V(HCLASS),       /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
244         V(BIGINT),       /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
245         V(TAGGED_ARRAY), /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
246         V(MUTANT_TAGGED_ARRAY), /* ////////////////////////////////////////////////////////////////////////-PADDING */ \
247         V(BYTE_ARRAY),   /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
248         V(LEXICAL_ENV),  /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
249         V(SFUNCTION_ENV), /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
250         V(SENDABLE_ENV),  /* ///////////////////////////////////////////////////////////////////////////////-PADDING */\
251         V(TAGGED_DICTIONARY), /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
252         V(CONSTANT_POOL), /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
253         V(PROFILE_TYPE_INFO), /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
254         V(COW_MUTANT_TAGGED_ARRAY), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
255         V(COW_TAGGED_ARRAY), /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \
256         V(LINKED_NODE),  /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
257         V(RB_TREENODE),  /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
258         V(FREE_OBJECT_WITH_ONE_FIELD), /* /////////////////////////////////////////////////////////////////-PADDING */ \
259         V(FREE_OBJECT_WITH_NONE_FIELD), /* ////////////////////////////////////////////////////////////////-PADDING */ \
260         V(FREE_OBJECT_WITH_TWO_FIELD), /* /////////////////////////////////////////////////////////////////-PADDING */ \
261         V(JS_NATIVE_POINTER), /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
262         V(GLOBAL_ENV),        /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
263         V(ACCESSOR_DATA),     /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
264         V(INTERNAL_ACCESSOR), /* //////////////////////////////////////////////////////////////////////////-PADDING */ \
265         V(SYMBOL), /* /////////////////////////////////////////////////////////////////////////////////////-PADDING */ \
266         V(ENUM_CACHE), /* /////////////////////////////////////////////////////////////////////////////////-PADDING */ \
267         V(JS_GENERATOR_CONTEXT), /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
268         V(PROTOTYPE_HANDLER),    /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
269         V(TRANSITION_HANDLER),   /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
270         V(TRANS_WITH_PROTO_HANDLER),    /* ////////////////////////////////////////////////////////////////-PADDING */ \
271         V(STORE_TS_HANDLER),       /* /////////////////////////////////////////////////////////////////////-PADDING */ \
272         V(PROPERTY_BOX), /* ///////////////////////////////////////////////////////////////////////////////-PADDING */ \
273         V(PROTO_CHANGE_MARKER), /* ////////////////////////////////////////////////////////////////////////-PADDING */ \
274         V(MARKER_CELL), /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
275         V(TRACK_INFO),  /* ////////////////////////////////////////////////////////////////////////////////-PADDING */ \
276         V(PROTOTYPE_INFO),     /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
277         V(TEMPLATE_MAP),       /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
278         V(PROGRAM),       /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
279         V(METHOD),     /* /////////////////////////////////////////////////////////////////////////////////-PADDING */ \
280         V(CLASS_LITERAL),      /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
281                                                                                                                        \
282         V(PROMISE_CAPABILITY), /* JS_RECORD_FIRST ///////////////////////////////////////////////////////////////// */ \
283         V(PROMISE_RECORD),     /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
284         V(RESOLVING_FUNCTIONS_RECORD), /* /////////////////////////////////////////////////////////////////-PADDING */ \
285         V(PROMISE_REACTIONS),          /* /////////////////////////////////////////////////////////////////-PADDING */ \
286         V(ASYNC_GENERATOR_REQUEST), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
287         V(ASYNC_ITERATOR_RECORD),   /* ////////////////////////////////////////////////////////////////////-PADDING */ \
288         V(PROMISE_ITERATOR_RECORD),    /* /////////////////////////////////////////////////////////////////-PADDING */ \
289         V(MICRO_JOB_QUEUE), /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
290         V(PENDING_JOB),     /* ////////////////////////////////////////////////////////////////////////////-PADDING */ \
291         V(MODULE_RECORD), /* //////////////////////////////////////////////////////////////////////////////-PADDING */ \
292         V(SOURCE_TEXT_MODULE_RECORD), /* //////////////////////////////////////////////////////////////////-PADDING */ \
293         V(IMPORTENTRY_RECORD), /* /////////////////////////////////////////////////////////////////////////-PADDING */ \
294         V(LOCAL_EXPORTENTRY_RECORD), /* ///////////////////////////////////////////////////////////////////-PADDING */ \
295         V(INDIRECT_EXPORTENTRY_RECORD), /* ////////////////////////////////////////////////////////////////-PADDING */ \
296         V(STAR_EXPORTENTRY_RECORD), /* ////////////////////////////////////////////////////////////////////-PADDING */ \
297         V(RESOLVEDBINDING_RECORD), /* /////////////////////////////////////////////////////////////////////-PADDING */ \
298         V(RESOLVEDINDEXBINDING_RECORD), /* ////////////////////////////////////////////////////////////////-PADDING */ \
299         V(RESOLVEDRECORDINDEXBINDING_RECORD), /* //////////////////////////////////////////////////////////-PADDING */ \
300         V(RESOLVEDRECORDBINDING_RECORD), /* ///////////////////////////////////////////////////////////////-PADDING */ \
301         V(CELL_RECORD),          /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
302         V(COMPLETION_RECORD), /* JS_RECORD_LAST /////////////////////////////////////////////////////////////////// */ \
303         V(MACHINE_CODE_OBJECT),                                                                                        \
304         V(CLASS_INFO_EXTRACTOR), /* ///////////////////////////////////////////////////////////////////////-PADDING */ \
305                                                                                                                        \
306         V(PROFILE_TYPE_INFO_CELL_0),  /* PROFILE_TYPE_INFO_CELL_FIRST /////////////////////////////////////-PADDING */ \
307         V(PROFILE_TYPE_INFO_CELL_1),  /* //////////////////////////////////////////////////////////////////-PADDING */ \
308         V(PROFILE_TYPE_INFO_CELL_N),  /* PROFILE_TYPE_INFO_CELL_LAST //////////////////////////////////////-PADDING */ \
309                                                                                                                        \
310         V(EXTRA_PROFILE_TYPE_INFO),      /* ///////////////////////////////////////////////////////////////-PADDING */ \
311         V(FUNCTION_TEMPLATE),            /* ///////////////////////////////////////////////////////////////-PADDING */ \
312                                                                                                                        \
313         V(VTABLE),                       /* ///////////////////////////////////////////////////////////////-PADDING */ \
314         V(AOT_LITERAL_INFO) /* ///////////////////////////////////////////////////////////////////////////-PADDING */
315 
316 #define PRESET_JSTYPE_DECL                                                                                             \
317         TYPE_LAST = AOT_LITERAL_INFO, /* //////////////////////////////////////////////////////////////////-PADDING */ \
318                                                                                                                        \
319         JS_FUNCTION_FIRST = JS_FUNCTION, /* ///////////////////////////////////////////////////////////////-PADDING */ \
320         JS_FUNCTION_LAST = JS_ASYNC_AWAIT_STATUS_FUNCTION, /* /////////////////////////////////////////////-PADDING */ \
321                                                                                                                        \
322         JS_OBJECT_FIRST = JS_OBJECT, /* ///////////////////////////////////////////////////////////////////-PADDING */ \
323         JS_OBJECT_LAST = JS_GLOBAL_OBJECT, /* /////////////////////////////////////////////////////////////-PADDING */ \
324                                                                                                                        \
325         ECMA_OBJECT_FIRST = JS_OBJECT, /* /////////////////////////////////////////////////////////////////-PADDING */ \
326         ECMA_OBJECT_LAST = JS_PROXY,    /* ////////////////////////////////////////////////////////////////-PADDING */ \
327                                                                                                                        \
328         JS_ERROR_FIRST = JS_ERROR,      /* ////////////////////////////////////////////////////////////////-PADDING */ \
329         JS_ERROR_LAST = JS_TERMINATION_ERROR,    /* ///////////////////////////////////////////////////////-PADDING */ \
330                                                                                                                        \
331         JS_ITERATOR_FIRST = JS_ITERATOR,      /* //////////////////////////////////////////////////////////-PADDING */ \
332         JS_ITERATOR_LAST = JS_STRING_ITERATOR, /* /////////////////////////////////////////////////////////-PADDING */ \
333                                                                                                                        \
334         JS_RECORD_FIRST = PROMISE_CAPABILITY, /* //////////////////////////////////////////////////////////-PADDING */ \
335         JS_RECORD_LAST = COMPLETION_RECORD,    /* /////////////////////////////////////////////////////////-PADDING */ \
336                                                                                                                        \
337         JS_TYPED_ARRAY_FIRST = JS_TYPED_ARRAY, /* /////////////////////////////////////////////////////////-PADDING */ \
338         JS_TYPED_ARRAY_LAST = JS_BIGUINT64_ARRAY, /* //////////////////////////////////////////////////////-PADDING */ \
339                                                                                                                        \
340         JS_SHARED_TYPED_ARRAY_FIRST = JS_SHARED_TYPED_ARRAY, /* ///////////////////////////////////////////-PADDING */ \
341         JS_SHARED_TYPED_ARRAY_LAST = JS_SHARED_BIGUINT64_ARRAY, /* ////////////////////////////////////////-PADDING */ \
342                                                                                                                        \
343         MODULE_RECORD_FIRST = MODULE_RECORD, /* ///////////////////////////////////////////////////////////-PADDING */ \
344         MODULE_RECORD_LAST = SOURCE_TEXT_MODULE_RECORD, /* ////////////////////////////////////////////////-PADDING */ \
345                                                                                                                        \
346         STRING_FIRST = LINE_STRING, /* ////////////////////////////////////////////////////////////////////-PADDING */ \
347         STRING_LAST = TREE_STRING,  /* ////////////////////////////////////////////////////////////////////-PADDING */ \
348                                                                                                                        \
349         PROFILE_TYPE_INFO_CELL_FIRST = PROFILE_TYPE_INFO_CELL_0,  /* //////////////////////////////////////-PADDING */ \
350         PROFILE_TYPE_INFO_CELL_LAST = PROFILE_TYPE_INFO_CELL_N    /* //////////////////////////////////////-PADDING */
351 
352 #define JSTYPE_IDENTITY(type) type
353 #define JSTYPE_STRING(type) #type
354 
355 enum class JSType : uint8_t {
356     INVALID = 0,
357     JSTYPE_DECL(JSTYPE_IDENTITY),
358     PRESET_JSTYPE_DECL,
359 };
360 
361 static_assert(static_cast<uint8_t>(JSType::LINE_STRING) == static_cast<uint8_t>(common::CommonType::LINE_STRING) &&
362     "line string type should be same with common type");
363 static_assert(static_cast<uint8_t>(JSType::SLICED_STRING) == static_cast<uint8_t>(common::CommonType::SLICED_STRING) &&
364     "sliced string type should be same with common type");
365 static_assert(static_cast<uint8_t>(JSType::TREE_STRING) == static_cast<uint8_t>(common::CommonType::TREE_STRING) &&
366     "tree string type should be same with common type");
367 
368 struct TransitionResult {
369     bool isTagged;
370     bool isTransition;
371     JSTaggedValue value;
372 };
373 
374 class JSHClass : public TaggedObject {
375 public:
376     static constexpr int TYPE_BITFIELD_NUM = 8;
377     static constexpr int LEVEL_BTTFIELD_NUM = 5;
378     static constexpr int ELEMENTS_KIND_BITFIELD_NUM = 5;
379     static constexpr int CONSTRUCTION_COUNTER_BITFIELD_NUM = 3;
380     static constexpr unsigned BITS_PER_BYTE = 8;
381     using ObjectTypeBits = BitField<JSType, 0, TYPE_BITFIELD_NUM>;                                // 8
382     using CallableBit = ObjectTypeBits::NextFlag;                                                 // 9
383     using ConstructorBit = CallableBit::NextFlag;                                                 // 10
384     using ExtensibleBit = ConstructorBit::NextFlag;                                               // 11
385     using IsPrototypeBit = ExtensibleBit::NextFlag;                                               // 12
386     using ElementsKindBits = IsPrototypeBit::NextField<ElementsKind, ELEMENTS_KIND_BITFIELD_NUM>; // 13-17
387     using DictionaryElementBits = ElementsKindBits::NextFlag;                                     // 18
388     using IsDictionaryBit = DictionaryElementBits::NextFlag;                                      // 19
389     using IsStableElementsBit = IsDictionaryBit::NextFlag;                                        // 20
390     using HasConstructorBits = IsStableElementsBit::NextFlag;                                     // 21
391     using IsClassConstructorOrPrototypeBit = HasConstructorBits::NextFlag;                        // 22
392     using IsNativeBindingObjectBit = IsClassConstructorOrPrototypeBit::NextFlag;                  // 23
393     using IsAOTBit = IsNativeBindingObjectBit::NextFlag;                                          // 24
394     using IsJSArrayPrototypeModifiedBit = IsAOTBit::NextFlag;                                     // 25
395     using IsJSFunctionBit = IsJSArrayPrototypeModifiedBit::NextFlag;                              // 26
396     using IsOnHeap = IsJSFunctionBit::NextFlag;                                                   // 27
397     using IsJSSharedBit = IsOnHeap::NextFlag;                                                     // 28
398     using ConstructionCounterBits = IsJSSharedBit::NextField<uint8_t, CONSTRUCTION_COUNTER_BITFIELD_NUM>; // 29-31
399     using IsStableBit = ConstructionCounterBits::NextFlag;                                           // 32
400     using BitFieldLastBit = IsStableBit;
401     static_assert(BitFieldLastBit::START_BIT + BitFieldLastBit::SIZE <= sizeof(uint32_t) * BITS_PER_BYTE, "Invalid");
402 
403     static constexpr int DEFAULT_CAPACITY_OF_IN_OBJECTS = 4;
404     static constexpr int OFFSET_MAX_OBJECT_SIZE_IN_WORDS_WITHOUT_INLINED = 5;
405     static constexpr int OFFSET_MAX_OBJECT_SIZE_IN_WORDS =
406         PropertyAttributes::MAX_FAST_PROPS_CAPACITY_LOG2 + OFFSET_MAX_OBJECT_SIZE_IN_WORDS_WITHOUT_INLINED;
407     static constexpr int MAX_OBJECT_SIZE_IN_WORDS = (1U << OFFSET_MAX_OBJECT_SIZE_IN_WORDS) - 1;
408     static constexpr uint8_t SLACK_TRACKING_COUNT = (1 << CONSTRUCTION_COUNTER_BITFIELD_NUM) - 1;
409 
410     using NumberOfPropsBits = BitField<uint32_t, 0, PropertyAttributes::MAX_FAST_PROPS_CAPACITY_LOG2>;         // 10
411     using InlinedPropsStartBits = NumberOfPropsBits::NextField<uint32_t,
412         OFFSET_MAX_OBJECT_SIZE_IN_WORDS_WITHOUT_INLINED>;                                                      // 15
413     using ObjectSizeInWordsBits = InlinedPropsStartBits::NextField<uint32_t, OFFSET_MAX_OBJECT_SIZE_IN_WORDS>; // 30
414     using HasDeletePropertyBit = ObjectSizeInWordsBits::NextFlag;                                              //
415     using IsAllTaggedPropBit = HasDeletePropertyBit::NextFlag;                                                 // 32
416     using BitField1LastBit = IsAllTaggedPropBit;
417     static_assert(BitField1LastBit::START_BIT + BitField1LastBit::SIZE <= sizeof(uint32_t) * BITS_PER_BYTE, "Invalid");
418 
Cast(const TaggedObject * object)419     static JSHClass *Cast(const TaggedObject *object)
420     {
421         ASSERT(JSTaggedValue(object).IsJSHClass());
422         return static_cast<JSHClass *>(const_cast<TaggedObject *>(object));
423     }
424 
425     inline size_t SizeFromJSHClass(TaggedObject *header);
426     inline bool HasReferenceField();
427 
428     // size need to add inlined property numbers
429     void Initialize(const JSThread *thread, uint32_t size, JSType type, uint32_t inlinedProps);
430     // for sharedHeap
431     void Initialize(const JSThread *thread, uint32_t size, JSType type, uint32_t inlinedProps,
432         const JSHandle<JSTaggedValue> &layout);
433     static size_t GetCloneSize(JSHClass* jshclass);
434     static JSHandle<JSHClass> Clone(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
435                                     bool specificInlinedProps = false, uint32_t specificNumInlinedProps = 0);
436     static JSHandle<JSHClass> CloneAndIncInlinedProperties(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
437                                                            uint32_t expectedOfProperties);
438     static JSHandle<JSHClass> CloneWithoutInlinedProperties(const JSThread *thread, const JSHandle<JSHClass> &jshclass);
439     static JSHandle<JSHClass> CloneWithElementsKind(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
440                                                     const ElementsKind kind, bool isPrototype);
441 
442     static void TransitionElementsToDictionary(const JSThread *thread, const JSHandle<JSObject> &obj);
443     static void OptimizeAsFastElements(const JSThread *thread, JSHandle<JSObject> obj);
444     static void OptimizeAsFastProperties(const JSThread *thread, const JSHandle<JSObject> &obj,
445                                          const std::vector<int> &indexArray = {}, bool isDictionary = false);
446     template<bool checkDuplicateKeys = false>
447     static JSHandle<JSHClass> SetPropertyOfObjHClass(const JSThread *thread, JSHandle<JSHClass> &jshclass,
448                                                      const JSHandle<JSTaggedValue> &key,
449                                                      const PropertyAttributes &attr,
450                                                      const Representation &rep,
451                                                      bool specificInlinedProps = false,
452                                                      uint32_t specificNumInlinedProps = 0);
453     static void PUBLIC_API AddProperty(const JSThread *thread, const JSHandle<JSObject> &obj,
454                                        const JSHandle<JSTaggedValue> &key, const PropertyAttributes &attr,
455                                        const Representation &rep = Representation::NONE);
456     static void AddPropertyToNewHClassWithoutTransition(const JSThread *thread, JSHandle<JSHClass> &newJsHClass,
457                                                         const JSHandle<JSTaggedValue> &key,
458                                                         const PropertyAttributes &attr);
459     static inline void AddInlinedPropToHClass(const JSThread *thread, const PropertyDescriptor &desc, size_t attrOffset,
460                                               const JSHandle<JSTaggedValue> &key, JSHandle<JSHClass> &hClass);
461 
462     static void ProcessAotHClassTransition(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
463                                            const JSHandle<JSHClass> newHClass, const JSTaggedValue &key);
464 
465     inline static void RestoreElementsKindToGeneric(JSHClass *newJsHClass);
466 
467     static JSHandle<JSHClass> TransitionExtension(const JSThread *thread, const JSHandle<JSHClass> &jshclass);
468     static void ReBuildFunctionInheritanceRelationship(const JSThread *thread,
469                                                        const JSHandle<JSTaggedValue> &proto,
470                                                        const JSHandle<JSTaggedValue> &baseIhc,
471                                                        const JSHandle<JSTaggedValue> &transIhc,
472                                                        const JSHandle<JSTaggedValue> &transPhc);
473     static JSHandle<JSHClass> TransitionProto(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
474                                               const JSHandle<JSTaggedValue> &proto, bool isChangeProto = false);
475     static JSHClass *FindTransitionProtoForAOT(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
476                                                const JSHandle<JSTaggedValue> &proto);
477     static JSHandle<JSHClass> TransProtoWithoutLayout(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
478                                                       const JSHandle<JSTaggedValue> &proto);
479     static JSHandle<JSHClass> CloneWithAddProto(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
480                                                 const JSHandle<JSTaggedValue> &key,
481                                                 const JSHandle<JSTaggedValue> &proto);
482     static void TransitionToDictionary(const JSThread *thread, const JSHandle<JSObject> &obj);
483     static void TransitionForRepChange(const JSThread *thread, const JSHandle<JSObject> &receiver,
484                                        const JSHandle<JSTaggedValue> &key, PropertyAttributes attr);
485     static void TransitionForElementsKindChange(const JSThread *thread, const JSHandle<JSObject> &receiver,
486                                          const ElementsKind newKind);
487     static bool IsInitialArrayHClassWithElementsKind(const JSThread *thread, const JSHClass *targetHClass,
488                                                      const ElementsKind targetKind);
489     static bool PUBLIC_API TransitToElementsKindUncheck(const JSThread *thread, const JSHandle<JSObject> &obj,
490                                                         ElementsKind newKind);
491     static void PUBLIC_API TransitToElementsKind(const JSThread *thread, const JSHandle<JSArray> &array,
492                                                  ElementsKind newKind = ElementsKind::NONE);
493     static bool PUBLIC_API TransitToElementsKind(const JSThread *thread, const JSHandle<JSObject> &object,
494                                                  const JSHandle<JSTaggedValue> &value,
495                                                  ElementsKind kind = ElementsKind::NONE);
496     static TransitionResult PUBLIC_API ConvertOrTransitionWithRep(const JSThread *thread,
497         const JSHandle<JSObject> &receiver, const JSHandle<JSTaggedValue> &key, const JSHandle<JSTaggedValue> &value,
498         PropertyAttributes &attr);
499     static void PUBLIC_API MergeRepresentation(const JSThread *thread, JSHClass *oldJsHClass, JSHClass *newJsHClass);
500 
501     static void UpdateFieldType(const JSThread *thread, JSHClass *hclass, const PropertyAttributes &attr);
502     static JSHClass *FindFieldOwnHClass(const JSThread *thread, JSHClass *hclass, const PropertyAttributes &attr);
503     static void VisitAndUpdateLayout(const JSThread *thread, JSHClass *ownHClass, const PropertyAttributes &attr);
504     static void VisitTransitionAndUpdateObjSize(const JSThread *thread, JSHClass *ownHClass,
505                                                 uint32_t finalInObjPropsNum);
506     static uint32_t VisitTransitionAndFindMaxNumOfProps(const JSThread *thread, JSHClass *ownHClass);
507 
508     static void NotifyHClassNotPrototypeChanged(JSThread *thread, const JSHandle<JSHClass> &jsHClass);
509     static void NotifyLeafHClassChanged(JSThread *thread, const JSHandle<JSHClass> &jsHClass);
510     static JSHandle<JSTaggedValue> PUBLIC_API EnableProtoChangeMarker(
511         const JSThread *thread, const JSHandle<JSHClass> &jshclass);
512     static JSHandle<JSTaggedValue> EnablePHCProtoChangeMarker(
513         const JSThread *thread, const JSHandle<JSHClass> &protoClass);
514 
515     static void NotifyHclassChanged(const JSThread *thread, JSHandle<JSHClass> oldHclass, JSHandle<JSHClass> newHclass,
516                                     JSTaggedValue addedKey = JSTaggedValue::Undefined());
517 
518     static void NotifyHClassChangedForAot(const JSThread *thread, const JSHandle<JSHClass> oldHclass,
519                                                const JSHandle<JSHClass> newHclass, const JSTaggedValue addedKey);
520 
521     static void NotifyAccessorChanged(const JSThread *thread, JSHandle<JSHClass> hclass);
522 
523     static void RegisterOnProtoChain(const JSThread *thread, const JSHandle<JSHClass> &jshclass);
524 
525     static bool UnregisterOnProtoChain(const JSThread *thread, const JSHandle<JSHClass> &jshclass);
526 
527     static JSHandle<ProtoChangeDetails> GetProtoChangeDetails(const JSThread *thread,
528                                                               const JSHandle<JSHClass> &jshclass);
529 
530     static JSHandle<ProtoChangeDetails> GetProtoChangeDetails(const JSThread *thread, const JSHandle<JSObject> &obj);
531 
532     static JSHandle<TaggedArray> GetEnumCacheOwnWithOutCheck(const JSThread *thread,
533                                                              const JSHandle<JSHClass> &jshclass);
534 
535     inline void UpdatePropertyMetaData(const JSThread *thread, const JSTaggedValue &key,
536                                       const PropertyAttributes &metaData);
537 
538     template<bool isForAot>
539     static void MarkProtoChanged(const JSThread *thread, const JSHandle<JSHClass> &jshclass);
540 
541     template<bool isForAot = false>
542     static void NoticeThroughChain(const JSThread *thread, const JSHandle<JSHClass> &jshclass,
543                                    JSTaggedValue addedKey = JSTaggedValue::Undefined());
544 
545     static void RefreshUsers(const JSThread *thread, const JSHandle<JSHClass> &oldHclass,
546                              const JSHandle<JSHClass> &newHclass);
547 
548     static bool IsNeedNotifyHclassChangedForAotTransition(const JSThread *thread, const JSHandle<JSHClass> &hclass,
549                                                           JSTaggedValue key);
550 
551     static JSHandle<JSTaggedValue> ParseKeyFromPGOCString(ObjectFactory* factory,
552                                                           const CString& key,
553                                                           const PGOHandler& handler);
554 
555     static CString GetJSTypeDesc(JSType type);
556 
ClearBitField()557     inline void ClearBitField()
558     {
559         SetBitField(0UL);
560         SetBitField1(0UL);
561         SetProfileType(0ULL);
562     }
563 
GetObjectType()564     inline JSType GetObjectType() const
565     {
566         uint32_t bits = GetBitField();
567         return ObjectTypeBits::Decode(bits);
568     }
569 
SetObjectType(JSType type)570     inline void SetObjectType(JSType type)
571     {
572         uint32_t bits = GetBitField();
573         uint32_t newVal = ObjectTypeBits::Update(bits, type);
574         SetBitField(newVal);
575     }
576 
SetCallable(bool flag)577     inline void SetCallable(bool flag)
578     {
579         CallableBit::Set<uint32_t>(flag, GetBitFieldAddr());
580     }
581 
SetConstructor(bool flag)582     inline void SetConstructor(bool flag) const
583     {
584         ConstructorBit::Set<uint32_t>(flag, GetBitFieldAddr());
585     }
586 
SetExtensible(bool flag)587     inline void SetExtensible(bool flag) const
588     {
589         ExtensibleBit::Set<uint32_t>(flag, GetBitFieldAddr());
590     }
591 
SetIsPrototype(bool flag)592     inline void SetIsPrototype(bool flag) const
593     {
594         IsPrototypeBit::Set<uint32_t>(flag, GetBitFieldAddr());
595     }
596 
SetClassConstructor(bool flag)597     inline void SetClassConstructor(bool flag) const
598     {
599         IsClassConstructorOrPrototypeBit::Set<uint32_t>(flag, GetBitFieldAddr());
600         SetConstructor(flag);
601     }
602 
SetClassPrototype(bool flag)603     inline void SetClassPrototype(bool flag) const
604     {
605         IsClassConstructorOrPrototypeBit::Set<uint32_t>(flag, GetBitFieldAddr());
606         SetIsPrototype(flag);
607     }
608 
SetIsNativeBindingObject(bool flag)609     inline void SetIsNativeBindingObject(bool flag) const
610     {
611         IsNativeBindingObjectBit::Set<uint32_t>(flag, GetBitFieldAddr());
612     }
613 
SetIsDictionaryMode(bool flag)614     inline void SetIsDictionaryMode(bool flag) const
615     {
616         SetIsStable(!flag);
617         IsDictionaryBit::Set<uint32_t>(flag, GetBitFieldAddr());
618     }
619 
SetIsJSArrayPrototypeModified(bool flag)620     inline void SetIsJSArrayPrototypeModified(bool flag) const
621     {
622         IsJSArrayPrototypeModifiedBit::Set<uint32_t>(flag, GetBitFieldAddr());
623     }
624 
SetAOT(bool flag)625     inline void SetAOT(bool flag) const
626     {
627         IsAOTBit::Set<uint32_t>(flag, GetBitFieldAddr());
628     }
629 
SetIsJSFunction(bool flag)630     inline void SetIsJSFunction(bool flag) const
631     {
632         IsJSFunctionBit::Set<uint32_t>(flag, GetBitFieldAddr());
633     }
634 
SetIsOnHeap(bool flag)635     inline void SetIsOnHeap(bool flag) const
636     {
637         IsOnHeap::Set<uint32_t>(flag, GetBitFieldAddr());
638     }
639 
SetIsStable(bool flag)640     inline void SetIsStable(bool flag) const
641     {
642         IsStableBit::Set<uint32_t>(flag, GetBitFieldAddr());
643     }
644 
IsStable()645     inline bool IsStable() const
646     {
647         uint32_t bits = GetBitField();
648         return IsStableBit::Decode(bits);
649     }
650 
IsJSObject()651     inline bool IsJSObject() const
652     {
653         return IsJSTypeObject(GetObjectType());
654     }
655 
IsOnlyJSObject()656     inline bool IsOnlyJSObject() const
657     {
658         return GetObjectType() == JSType::JS_OBJECT;
659     }
660 
IsECMAObject()661     inline bool IsECMAObject() const
662     {
663         JSType jsType = GetObjectType();
664         return (JSType::ECMA_OBJECT_FIRST <= jsType && jsType <= JSType::ECMA_OBJECT_LAST);
665     }
666 
ShouldSetDefaultSupers()667     inline bool ShouldSetDefaultSupers() const
668     {
669         return IsECMAObject() || IsStringOrSymbol();
670     }
671 
IsRealm()672     inline bool IsRealm() const
673     {
674         return GetObjectType() == JSType::JS_REALM;
675     }
676 
IsHClass()677     inline bool IsHClass() const
678     {
679         return GetObjectType() == JSType::HCLASS;
680     }
681 
682     // These types are not complete hclass, does not has profile field.
IsCompositeHClass()683     inline bool IsCompositeHClass() const
684     {
685         common::CommonType jsType = static_cast<common::CommonType>(GetObjectType());
686         return (common::CommonType::FIRST_OBJECT_TYPE <= jsType && jsType <= common::CommonType::LAST_OBJECT_TYPE);
687     }
688 
IsString()689     inline bool IsString() const
690     {
691         JSType jsType = GetObjectType();
692         return (JSType::STRING_FIRST <= jsType && jsType <= JSType::STRING_LAST);
693     }
694 
IsLineString()695     inline bool IsLineString() const
696     {
697         return GetObjectType() == JSType::LINE_STRING;
698     }
699 
IsSlicedString()700     inline bool IsSlicedString() const
701     {
702         return GetObjectType() == JSType::SLICED_STRING;
703     }
704 
IsTreeString()705     inline bool IsTreeString() const
706     {
707         return GetObjectType() == JSType::TREE_STRING;
708     }
709 
IsBigInt()710     inline bool IsBigInt() const
711     {
712         return GetObjectType() == JSType::BIGINT;
713     }
714 
IsSymbol()715     inline bool IsSymbol() const
716     {
717         return GetObjectType() == JSType::SYMBOL;
718     }
719 
IsStringOrSymbol()720     inline bool IsStringOrSymbol() const
721     {
722         JSType jsType = GetObjectType();
723         return (JSType::STRING_FIRST <= jsType && jsType <= JSType::STRING_LAST) || (jsType == JSType::SYMBOL);
724     }
725 
IsTaggedArray()726     inline bool IsTaggedArray() const
727     {
728         JSType jsType = GetObjectType();
729         switch (jsType) {
730             case JSType::TAGGED_ARRAY:
731             case JSType::TAGGED_DICTIONARY:
732             case JSType::LEXICAL_ENV:
733             case JSType::SFUNCTION_ENV:
734             case JSType::SENDABLE_ENV:
735             case JSType::CONSTANT_POOL:
736             case JSType::PROFILE_TYPE_INFO:
737             case JSType::AOT_LITERAL_INFO:
738             case JSType::VTABLE:
739             case JSType::COW_TAGGED_ARRAY:
740             case JSType::MUTANT_TAGGED_ARRAY:
741             case JSType::COW_MUTANT_TAGGED_ARRAY:
742                 return true;
743             default:
744                 return false;
745         }
746     }
747 
IsLexicalEnv()748     inline bool IsLexicalEnv() const
749     {
750         return GetObjectType() == JSType::LEXICAL_ENV;
751     }
752 
IsSFunctionEnv()753     inline bool IsSFunctionEnv() const
754     {
755         return GetObjectType() == JSType::SFUNCTION_ENV;
756     }
757 
IsByteArray()758     inline bool IsByteArray() const
759     {
760         return GetObjectType() == JSType::BYTE_ARRAY;
761     }
762 
IsConstantPool()763     inline bool IsConstantPool() const
764     {
765         return GetObjectType() == JSType::CONSTANT_POOL;
766     }
767 
IsDictionary()768     inline bool IsDictionary() const
769     {
770         return GetObjectType() == JSType::TAGGED_DICTIONARY;
771     }
772 
IsCOWArray()773     inline bool IsCOWArray() const
774     {
775         // Copy On Write ARRAY.
776         return GetObjectType() == JSType::COW_TAGGED_ARRAY ||
777                GetObjectType() == JSType::COW_MUTANT_TAGGED_ARRAY;
778     }
779 
IsMutantTaggedArray()780     inline bool IsMutantTaggedArray() const
781     {
782         return GetObjectType() == JSType::MUTANT_TAGGED_ARRAY ||
783                GetObjectType() == JSType::COW_MUTANT_TAGGED_ARRAY;
784     }
785 
IsJSNativePointer()786     inline bool IsJSNativePointer() const
787     {
788         return GetObjectType() == JSType::JS_NATIVE_POINTER;
789     }
790 
IsJSSymbol()791     inline bool IsJSSymbol() const
792     {
793         return GetObjectType() == JSType::SYMBOL;
794     }
795 
IsJSArray()796     inline bool IsJSArray() const
797     {
798         return GetObjectType() == JSType::JS_ARRAY;
799     }
800 
IsTypedArray()801     inline bool IsTypedArray() const
802     {
803         JSType jsType = GetObjectType();
804         return (JSType::JS_TYPED_ARRAY_FIRST < jsType && jsType <= JSType::JS_TYPED_ARRAY_LAST);
805     }
806 
IsSharedTypedArray()807     inline bool IsSharedTypedArray() const
808     {
809         JSType jsType = GetObjectType();
810         return (JSType::JS_SHARED_TYPED_ARRAY_FIRST < jsType && jsType <= JSType::JS_SHARED_TYPED_ARRAY_LAST);
811     }
812 
HasOrdinaryGet()813     inline bool HasOrdinaryGet() const
814     {
815         return (IsSpecialContainer() || IsModuleNamespace() || IsBigInt64Array());
816     }
817 
HasDependentInfos(const JSThread * thread)818     inline bool HasDependentInfos(const JSThread *thread) const
819     {
820         return GetDependentInfos(thread) != JSTaggedValue::Undefined();
821     }
822 
IsJSTypedArray()823     inline bool IsJSTypedArray() const
824     {
825         return GetObjectType() == JSType::JS_TYPED_ARRAY;
826     }
827 
IsJSInt8Array()828     inline bool IsJSInt8Array() const
829     {
830         return GetObjectType() == JSType::JS_INT8_ARRAY;
831     }
832 
IsJSUint8Array()833     inline bool IsJSUint8Array() const
834     {
835         return GetObjectType() == JSType::JS_UINT8_ARRAY;
836     }
837 
IsJSUint8ClampedArray()838     inline bool IsJSUint8ClampedArray() const
839     {
840         return GetObjectType() == JSType::JS_UINT8_CLAMPED_ARRAY;
841     }
842 
IsJSInt16Array()843     inline bool IsJSInt16Array() const
844     {
845         return GetObjectType() == JSType::JS_INT16_ARRAY;
846     }
847 
IsJSUint16Array()848     inline bool IsJSUint16Array() const
849     {
850         return GetObjectType() == JSType::JS_UINT16_ARRAY;
851     }
852 
IsJSInt32Array()853     inline bool IsJSInt32Array() const
854     {
855         return GetObjectType() == JSType::JS_INT32_ARRAY;
856     }
857 
IsJSUint32Array()858     inline bool IsJSUint32Array() const
859     {
860         return GetObjectType() == JSType::JS_UINT32_ARRAY;
861     }
862 
IsJSFloat32Array()863     inline bool IsJSFloat32Array() const
864     {
865         return GetObjectType() == JSType::JS_FLOAT32_ARRAY;
866     }
867 
IsJSFloat64Array()868     inline bool IsJSFloat64Array() const
869     {
870         return GetObjectType() == JSType::JS_FLOAT64_ARRAY;
871     }
872 
IsJSBigInt64Array()873     inline bool IsJSBigInt64Array() const
874     {
875         return GetObjectType() == JSType::JS_BIGINT64_ARRAY;
876     }
877 
IsJSBigUint64Array()878     inline bool IsJSBigUint64Array() const
879     {
880         return GetObjectType() == JSType::JS_BIGUINT64_ARRAY;
881     }
882 
IsJSSharedTypedArray()883     inline bool IsJSSharedTypedArray() const
884     {
885         return GetObjectType() == JSType::JS_SHARED_TYPED_ARRAY;
886     }
887 
IsJSSharedInt8Array()888     inline bool IsJSSharedInt8Array() const
889     {
890         return GetObjectType() == JSType::JS_SHARED_INT8_ARRAY;
891     }
892 
IsJSSharedUint8Array()893     inline bool IsJSSharedUint8Array() const
894     {
895         return GetObjectType() == JSType::JS_SHARED_UINT8_ARRAY;
896     }
897 
IsJSSharedUint8ClampedArray()898     inline bool IsJSSharedUint8ClampedArray() const
899     {
900         return GetObjectType() == JSType::JS_SHARED_UINT8_CLAMPED_ARRAY;
901     }
902 
IsJSSharedInt16Array()903     inline bool IsJSSharedInt16Array() const
904     {
905         return GetObjectType() == JSType::JS_SHARED_INT16_ARRAY;
906     }
907 
IsJSSharedUint16Array()908     inline bool IsJSSharedUint16Array() const
909     {
910         return GetObjectType() == JSType::JS_SHARED_UINT16_ARRAY;
911     }
912 
IsJSSharedInt32Array()913     inline bool IsJSSharedInt32Array() const
914     {
915         return GetObjectType() == JSType::JS_SHARED_INT32_ARRAY;
916     }
917 
IsJSSharedUint32Array()918     inline bool IsJSSharedUint32Array() const
919     {
920         return GetObjectType() == JSType::JS_SHARED_UINT32_ARRAY;
921     }
922 
IsJSSharedFloat32Array()923     inline bool IsJSSharedFloat32Array() const
924     {
925         return GetObjectType() == JSType::JS_SHARED_FLOAT32_ARRAY;
926     }
927 
IsJSSharedFloat64Array()928     inline bool IsJSSharedFloat64Array() const
929     {
930         return GetObjectType() == JSType::JS_SHARED_FLOAT64_ARRAY;
931     }
932 
IsJSSharedBigInt64Array()933     inline bool IsJSSharedBigInt64Array() const
934     {
935         return GetObjectType() == JSType::JS_SHARED_BIGINT64_ARRAY;
936     }
937 
IsJSSharedBigUint64Array()938     inline bool IsJSSharedBigUint64Array() const
939     {
940         return GetObjectType() == JSType::JS_SHARED_BIGUINT64_ARRAY;
941     }
942 
IsBigInt64Array()943     inline bool IsBigInt64Array() const
944     {
945         JSType jsType = GetObjectType();
946         return jsType == JSType::JS_SHARED_BIGUINT64_ARRAY || jsType == JSType::JS_SHARED_BIGINT64_ARRAY ||
947                jsType == JSType::JS_BIGUINT64_ARRAY || jsType == JSType::JS_BIGINT64_ARRAY;
948     }
949 
IsJsGlobalEnv()950     inline bool IsJsGlobalEnv() const
951     {
952         return GetObjectType() == JSType::GLOBAL_ENV;
953     }
954 
IsJSFunctionBase()955     inline bool IsJSFunctionBase() const
956     {
957         JSType jsType = GetObjectType();
958         return jsType >= JSType::JS_FUNCTION_BASE && jsType <= JSType::JS_BOUND_FUNCTION;
959     }
960 
IsJsBoundFunction()961     inline bool IsJsBoundFunction() const
962     {
963         return GetObjectType() == JSType::JS_BOUND_FUNCTION;
964     }
965 
IsJSIntlBoundFunction()966     inline bool IsJSIntlBoundFunction() const
967     {
968         return GetObjectType() == JSType::JS_INTL_BOUND_FUNCTION;
969     }
970 
IsJSProxyRevocFunction()971     inline bool IsJSProxyRevocFunction() const
972     {
973         return GetObjectType() == JSType::JS_PROXY_REVOC_FUNCTION;
974     }
975 
IsJSAsyncFunction()976     inline bool IsJSAsyncFunction() const
977     {
978         return GetObjectType() == JSType::JS_ASYNC_FUNCTION || GetObjectType() == JSType::JS_SHARED_ASYNC_FUNCTION;
979     }
980 
IsJSSharedAsyncFunction()981     inline bool IsJSSharedAsyncFunction() const
982     {
983         return GetObjectType() == JSType::JS_SHARED_ASYNC_FUNCTION;
984     }
985 
IsJSAsyncAwaitStatusFunction()986     inline bool IsJSAsyncAwaitStatusFunction() const
987     {
988         return GetObjectType() == JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION;
989     }
990 
IsJSPromiseReactionFunction()991     inline bool IsJSPromiseReactionFunction() const
992     {
993         return GetObjectType() == JSType::JS_PROMISE_REACTIONS_FUNCTION;
994     }
995 
IsJSPromiseExecutorFunction()996     inline bool IsJSPromiseExecutorFunction() const
997     {
998         return GetObjectType() == JSType::JS_PROMISE_EXECUTOR_FUNCTION;
999     }
1000 
IsJSAsyncModuleFulfilledFunction()1001     inline bool IsJSAsyncModuleFulfilledFunction() const
1002     {
1003         return GetObjectType() == JSType::JS_ASYNC_MODULE_FULFILLED_FUNCTION;
1004     }
1005 
IsJSAsyncModuleRejectedFunction()1006     inline bool IsJSAsyncModuleRejectedFunction() const
1007     {
1008         return GetObjectType() == JSType::JS_ASYNC_MODULE_REJECTED_FUNCTION;
1009     }
1010 
IsJSAsyncFromSyncIterUnwarpFunction()1011     inline bool IsJSAsyncFromSyncIterUnwarpFunction() const
1012     {
1013         return GetObjectType() == JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION;
1014     }
1015 
IsJSPromiseAllResolveElementFunction()1016     inline bool IsJSPromiseAllResolveElementFunction() const
1017     {
1018         return GetObjectType() == JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION;
1019     }
1020 
IsJSAsyncGeneratorResNextRetProRstFtn()1021     inline bool IsJSAsyncGeneratorResNextRetProRstFtn() const
1022     {
1023         return GetObjectType() == JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN;
1024     }
1025 
IsJSPromiseAnyRejectElementFunction()1026     inline bool IsJSPromiseAnyRejectElementFunction() const
1027     {
1028         return GetObjectType() == JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION;
1029     }
1030 
IsJSPromiseAllSettledElementFunction()1031     inline bool IsJSPromiseAllSettledElementFunction() const
1032     {
1033         return GetObjectType() == JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION;
1034     }
1035 
IsJSPromiseFinallyFunction()1036     inline bool IsJSPromiseFinallyFunction() const
1037     {
1038         return GetObjectType() == JSType::JS_PROMISE_FINALLY_FUNCTION;
1039     }
1040 
IsJSPromiseValueThunkOrThrowerFunction()1041     inline bool IsJSPromiseValueThunkOrThrowerFunction() const
1042     {
1043         return GetObjectType() == JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION;
1044     }
1045 
IsMicroJobQueue()1046     inline bool IsMicroJobQueue() const
1047     {
1048         return GetObjectType() == JSType::MICRO_JOB_QUEUE;
1049     }
1050 
IsPendingJob()1051     inline bool IsPendingJob() const
1052     {
1053         return GetObjectType() == JSType::PENDING_JOB;
1054     }
1055 
IsJsPrimitiveRef()1056     inline bool IsJsPrimitiveRef() const
1057     {
1058         return GetObjectType() == JSType::JS_PRIMITIVE_REF;
1059     }
1060 
IsJSSet()1061     bool IsJSSet() const
1062     {
1063         return GetObjectType() == JSType::JS_SET;
1064     }
1065 
IsJSSharedSet()1066     bool IsJSSharedSet() const
1067     {
1068         return GetObjectType() == JSType::JS_SHARED_SET;
1069     }
1070 
IsJSMap()1071     bool IsJSMap() const
1072     {
1073         return GetObjectType() == JSType::JS_MAP;
1074     }
1075 
IsJSSharedMap()1076     bool IsJSSharedMap() const
1077     {
1078         return GetObjectType() == JSType::JS_SHARED_MAP;
1079     }
1080 
IsJSWeakMap()1081     bool IsJSWeakMap() const
1082     {
1083         return GetObjectType() == JSType::JS_WEAK_MAP;
1084     }
1085 
IsJSWeakSet()1086     bool IsJSWeakSet() const
1087     {
1088         return GetObjectType() == JSType::JS_WEAK_SET;
1089     }
1090 
IsJSWeakRef()1091     bool IsJSWeakRef() const
1092     {
1093         return GetObjectType() == JSType::JS_WEAK_REF;
1094     }
1095 
IsJSFinalizationRegistry()1096     bool IsJSFinalizationRegistry() const
1097     {
1098         return GetObjectType() == JSType::JS_FINALIZATION_REGISTRY;
1099     }
1100 
IsJSFunction()1101     bool IsJSFunction() const
1102     {
1103         return GetObjectType() >= JSType::JS_FUNCTION_FIRST && GetObjectType() <= JSType::JS_FUNCTION_LAST;
1104     }
1105 
IsJSSharedFunction()1106     bool IsJSSharedFunction() const
1107     {
1108         return GetObjectType() == JSType::JS_SHARED_FUNCTION;
1109     }
1110 
IsInSharedHeap()1111     bool IsInSharedHeap() const
1112     {
1113         return IsJSShared();
1114     }
1115 
IsJSShared()1116     bool IsJSShared() const
1117     {
1118         uint32_t bits = GetBitField();
1119         return IsJSSharedBit::Decode(bits);
1120     }
1121 
SetIsJSShared(bool flag)1122     inline void SetIsJSShared(bool flag) const
1123     {
1124         IsJSSharedBit::Set<uint32_t>(flag, GetBitFieldAddr());
1125     }
1126 
IsJSError()1127     inline bool IsJSError() const
1128     {
1129         JSType jsType = GetObjectType();
1130         return jsType >= JSType::JS_ERROR_FIRST && jsType <= JSType::JS_ERROR_LAST;
1131     }
1132 
IsArguments()1133     inline bool IsArguments() const
1134     {
1135         return GetObjectType() == JSType::JS_ARGUMENTS;
1136     }
1137 
IsDate()1138     inline bool IsDate() const
1139     {
1140         return GetObjectType() == JSType::JS_DATE;
1141     }
1142 
IsJSRegExp()1143     inline bool IsJSRegExp() const
1144     {
1145         return GetObjectType() == JSType::JS_REG_EXP;
1146     }
1147 
IsJSProxy()1148     inline bool IsJSProxy() const
1149     {
1150         return GetObjectType() == JSType::JS_PROXY;
1151     }
1152 
IsJSLocale()1153     inline bool IsJSLocale() const
1154     {
1155         return GetObjectType() == JSType::JS_LOCALE;
1156     }
1157 
IsJSIntl()1158     inline bool IsJSIntl() const
1159     {
1160         return GetObjectType() == JSType::JS_INTL;
1161     }
1162 
IsJSDateTimeFormat()1163     inline bool IsJSDateTimeFormat() const
1164     {
1165         return GetObjectType() == JSType::JS_DATE_TIME_FORMAT;
1166     }
1167 
IsJSRelativeTimeFormat()1168     inline bool IsJSRelativeTimeFormat() const
1169     {
1170         return GetObjectType() == JSType::JS_RELATIVE_TIME_FORMAT;
1171     }
1172 
IsJSNumberFormat()1173     inline bool IsJSNumberFormat() const
1174     {
1175         return GetObjectType() == JSType::JS_NUMBER_FORMAT;
1176     }
1177 
IsJSCollator()1178     inline bool IsJSCollator() const
1179     {
1180         return GetObjectType() == JSType::JS_COLLATOR;
1181     }
1182 
IsJSPluralRules()1183     inline bool IsJSPluralRules() const
1184     {
1185         return GetObjectType() == JSType::JS_PLURAL_RULES;
1186     }
1187 
IsJSDisplayNames()1188     inline bool IsJSDisplayNames() const
1189     {
1190         return GetObjectType() == JSType::JS_DISPLAYNAMES;
1191     }
1192 
IsJSSegmenter()1193     inline bool IsJSSegmenter() const
1194     {
1195         return GetObjectType() == JSType::JS_SEGMENTER;
1196     }
1197 
IsJSSegments()1198     inline bool IsJSSegments() const
1199     {
1200         return GetObjectType() == JSType::JS_SEGMENTS;
1201     }
1202 
IsJSSegmentIterator()1203     inline bool IsJSSegmentIterator() const
1204     {
1205         return GetObjectType() == JSType::JS_SEGMENT_ITERATOR;
1206     }
1207 
IsJSListFormat()1208     inline bool IsJSListFormat() const
1209     {
1210         return GetObjectType() == JSType::JS_LIST_FORMAT;
1211     }
1212 
IsMethod()1213     inline bool IsMethod() const
1214     {
1215         return GetObjectType() == JSType::METHOD;
1216     }
1217 
IsClassLiteral()1218     inline bool IsClassLiteral() const
1219     {
1220         return GetObjectType() == JSType::CLASS_LITERAL;
1221     }
1222 
1223     // non ECMA standard jsapi containers.
IsSpecialContainer()1224     inline bool IsSpecialContainer() const
1225     {
1226         return GetObjectType() >= JSType::JS_API_ARRAY_LIST && GetObjectType() <= JSType::JS_API_QUEUE;
1227     }
1228 
IsRegularObject()1229     inline bool IsRegularObject() const
1230     {
1231         return GetObjectType() < JSType::JS_API_ARRAY_LIST &&  GetObjectType() > JSType::STRING_LAST;
1232     }
1233 
IsJSAPIArrayList()1234     inline bool IsJSAPIArrayList() const
1235     {
1236         return GetObjectType() == JSType::JS_API_ARRAY_LIST;
1237     }
1238 
IsJSAPIArrayListIterator()1239     inline bool IsJSAPIArrayListIterator() const
1240     {
1241         return GetObjectType() == JSType::JS_API_ARRAYLIST_ITERATOR;
1242     }
IsJSAPILightWeightMap()1243     inline bool IsJSAPILightWeightMap() const
1244     {
1245         return GetObjectType() == JSType::JS_API_LIGHT_WEIGHT_MAP;
1246     }
IsJSAPILightWeightMapIterator()1247     inline bool IsJSAPILightWeightMapIterator() const
1248     {
1249         return GetObjectType() == JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR;
1250     }
IsJSAPILightWeightSet()1251     inline bool IsJSAPILightWeightSet() const
1252     {
1253         return GetObjectType() == JSType::JS_API_LIGHT_WEIGHT_SET;
1254     }
IsJSAPILightWeightSetIterator()1255     inline bool IsJSAPILightWeightSetIterator() const
1256     {
1257         return GetObjectType() == JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR;
1258     }
IsJSAPIStack()1259     inline bool IsJSAPIStack() const
1260     {
1261         return GetObjectType() == JSType::JS_API_STACK;
1262     }
IsJSAPIDeque()1263     inline bool IsJSAPIDeque() const
1264     {
1265         return GetObjectType() == JSType::JS_API_DEQUE;
1266     }
IsLinkedNode()1267     inline bool IsLinkedNode() const
1268     {
1269         return GetObjectType() == JSType::LINKED_NODE;
1270     }
1271 
IsRBTreeNode()1272     inline bool IsRBTreeNode() const
1273     {
1274         return GetObjectType() == JSType::RB_TREENODE;
1275     }
1276 
IsJSAPIHashMap()1277     inline bool IsJSAPIHashMap() const
1278     {
1279         return GetObjectType() == JSType::JS_API_HASH_MAP;
1280     }
1281 
IsJSAPIHashSet()1282     inline bool IsJSAPIHashSet() const
1283     {
1284         return GetObjectType() == JSType::JS_API_HASH_SET;
1285     }
1286 
IsJSAPIHashMapIterator()1287     inline bool IsJSAPIHashMapIterator() const
1288     {
1289         return GetObjectType() == JSType::JS_API_HASHMAP_ITERATOR;
1290     }
1291 
IsJSAPIHashSetIterator()1292     inline bool IsJSAPIHashSetIterator() const
1293     {
1294         return GetObjectType() == JSType::JS_API_HASHSET_ITERATOR;
1295     }
IsJSAPIQueue()1296     inline bool IsJSAPIQueue() const
1297     {
1298         return GetObjectType() == JSType::JS_API_QUEUE;
1299     }
1300 
IsJSAPIPlainArray()1301     inline bool IsJSAPIPlainArray() const
1302     {
1303         return GetObjectType() == JSType::JS_API_PLAIN_ARRAY;
1304     }
1305 
IsJSAPIQueueIterator()1306     inline bool IsJSAPIQueueIterator() const
1307     {
1308         return GetObjectType() == JSType::JS_API_QUEUE_ITERATOR;
1309     }
IsJSAPIList()1310     inline bool IsJSAPIList() const
1311     {
1312         return GetObjectType() == JSType::JS_API_LIST;
1313     }
IsJSAPILinkedList()1314     inline bool IsJSAPILinkedList() const
1315     {
1316         return GetObjectType() == JSType::JS_API_LINKED_LIST;
1317     }
IsJSAPITreeMap()1318     inline bool IsJSAPITreeMap() const
1319     {
1320         return GetObjectType() == JSType::JS_API_TREE_MAP;
1321     }
1322 
IsJSAPITreeSet()1323     inline bool IsJSAPITreeSet() const
1324     {
1325         return GetObjectType() == JSType::JS_API_TREE_SET;
1326     }
1327 
IsJSAPITreeMapIterator()1328     inline bool IsJSAPITreeMapIterator() const
1329     {
1330         return GetObjectType() == JSType::JS_API_TREEMAP_ITERATOR;
1331     }
1332 
IsJSAPITreeSetIterator()1333     inline bool IsJSAPITreeSetIterator() const
1334     {
1335         return GetObjectType() == JSType::JS_API_TREESET_ITERATOR;
1336     }
IsJSAPIVector()1337     inline bool IsJSAPIVector() const
1338     {
1339         return GetObjectType() == JSType::JS_API_VECTOR;
1340     }
IsJSAPIVectorIterator()1341     inline bool IsJSAPIVectorIterator() const
1342     {
1343         return GetObjectType() == JSType::JS_API_VECTOR_ITERATOR;
1344     }
IsJSAPIBitVector()1345     inline bool IsJSAPIBitVector() const
1346     {
1347         return GetObjectType() == JSType::JS_API_BITVECTOR;
1348     }
IsJSAPIBitVectorIterator()1349     inline bool IsJSAPIBitVectorIterator() const
1350     {
1351         return GetObjectType() == JSType::JS_API_BITVECTOR_ITERATOR;
1352     }
IsJSAPIBuffer()1353     inline bool IsJSAPIBuffer() const
1354     {
1355         return GetObjectType() == JSType::JS_API_FAST_BUFFER;
1356     }
1357 
IsAccessorData()1358     inline bool IsAccessorData() const
1359     {
1360         return GetObjectType() == JSType::ACCESSOR_DATA;
1361     }
1362 
IsInternalAccessor()1363     inline bool IsInternalAccessor() const
1364     {
1365         return GetObjectType() == JSType::INTERNAL_ACCESSOR;
1366     }
1367 
IsIterator()1368     inline bool IsIterator() const
1369     {
1370         JSType jsType = GetObjectType();
1371         return jsType >= JSType::JS_ITERATOR_FIRST && jsType <= JSType::JS_ITERATOR_LAST;
1372     }
1373 
IsAsyncIterator()1374     inline bool IsAsyncIterator() const
1375     {
1376         return GetObjectType() == JSType::JS_ASYNCITERATOR;
1377     }
1378 
IsAsyncFromSyncIterator()1379     inline bool IsAsyncFromSyncIterator() const
1380     {
1381         return GetObjectType() == JSType::JS_ASYNC_FROM_SYNC_ITERATOR;
1382     }
1383 
IsForinIterator()1384     inline bool IsForinIterator() const
1385     {
1386         return GetObjectType() == JSType::JS_FORIN_ITERATOR;
1387     }
1388 
IsStringIterator()1389     inline bool IsStringIterator() const
1390     {
1391         return GetObjectType() == JSType::JS_STRING_ITERATOR;
1392     }
1393 
IsArrayBuffer()1394     inline bool IsArrayBuffer() const
1395     {
1396         return GetObjectType() == JSType::JS_ARRAY_BUFFER;
1397     }
1398 
IsSharedArrayBuffer()1399     inline bool IsSharedArrayBuffer() const
1400     {
1401         return GetObjectType() == JSType::JS_SHARED_ARRAY_BUFFER;
1402     }
1403 
IsSendableArrayBuffer()1404     inline bool IsSendableArrayBuffer() const
1405     {
1406         return GetObjectType() == JSType::JS_SENDABLE_ARRAY_BUFFER;
1407     }
1408 
IsDataView()1409     inline bool IsDataView() const
1410     {
1411         return GetObjectType() == JSType::JS_DATA_VIEW;
1412     }
1413 
IsJSSetIterator()1414     inline bool IsJSSetIterator() const
1415     {
1416         return GetObjectType() == JSType::JS_SET_ITERATOR;
1417     }
1418 
1419     // iterator of shared set
IsJSSharedSetIterator()1420     inline bool IsJSSharedSetIterator() const
1421     {
1422         return GetObjectType() == JSType::JS_SHARED_SET_ITERATOR;
1423     }
1424 
IsJSRegExpIterator()1425     inline bool IsJSRegExpIterator() const
1426     {
1427         return GetObjectType() == JSType::JS_REG_EXP_ITERATOR;
1428     }
1429 
IsJSMapIterator()1430     inline bool IsJSMapIterator() const
1431     {
1432         return GetObjectType() == JSType::JS_MAP_ITERATOR;
1433     }
1434 
1435     // iterator of shared map
IsJSSharedMapIterator()1436     inline bool IsJSSharedMapIterator() const
1437     {
1438         return GetObjectType() == JSType::JS_SHARED_MAP_ITERATOR;
1439     }
1440 
IsJSArrayIterator()1441     inline bool IsJSArrayIterator() const
1442     {
1443         return GetObjectType() == JSType::JS_ARRAY_ITERATOR;
1444     }
1445 
IsJSSharedArrayIterator()1446     inline bool IsJSSharedArrayIterator() const
1447     {
1448         return GetObjectType() == JSType::JS_SHARED_ARRAY_ITERATOR;
1449     }
1450 
IsJSAPIPlainArrayIterator()1451     inline bool IsJSAPIPlainArrayIterator() const
1452     {
1453         return GetObjectType() == JSType::JS_API_PLAIN_ARRAY_ITERATOR;
1454     }
1455 
IsJSAPIDequeIterator()1456     inline bool IsJSAPIDequeIterator() const
1457     {
1458         return GetObjectType() == JSType::JS_API_DEQUE_ITERATOR;
1459     }
1460 
IsJSAPIStackIterator()1461     inline bool IsJSAPIStackIterator() const
1462     {
1463         return GetObjectType() == JSType::JS_API_STACK_ITERATOR;
1464     }
1465 
IsJSAPILinkedListIterator()1466     inline bool IsJSAPILinkedListIterator() const
1467     {
1468         return GetObjectType() == JSType::JS_API_LINKED_LIST_ITERATOR;
1469     }
1470 
IsJSAPIListIterator()1471     inline bool IsJSAPIListIterator() const
1472     {
1473         return GetObjectType() == JSType::JS_API_LIST_ITERATOR;
1474     }
1475 
IsPrototypeHandler()1476     inline bool IsPrototypeHandler() const
1477     {
1478         return GetObjectType() == JSType::PROTOTYPE_HANDLER;
1479     }
1480 
IsTransitionHandler()1481     inline bool IsTransitionHandler() const
1482     {
1483         return GetObjectType() == JSType::TRANSITION_HANDLER;
1484     }
1485 
IsTransWithProtoHandler()1486     inline bool IsTransWithProtoHandler() const
1487     {
1488         return GetObjectType() == JSType::TRANS_WITH_PROTO_HANDLER;
1489     }
1490 
IsStoreAOTHandler()1491     inline bool IsStoreAOTHandler() const
1492     {
1493         return GetObjectType() == JSType::STORE_TS_HANDLER;
1494     }
1495 
IsPropertyBox()1496     inline bool IsPropertyBox() const
1497     {
1498         return GetObjectType() == JSType::PROPERTY_BOX;
1499     }
1500 
IsEnumCache()1501     inline bool IsEnumCache() const
1502     {
1503         return GetObjectType() == JSType::ENUM_CACHE;
1504     }
1505 
IsProtoChangeMarker()1506     inline bool IsProtoChangeMarker() const
1507     {
1508         return GetObjectType() == JSType::PROTO_CHANGE_MARKER;
1509     }
1510 
IsMarkerCell()1511     inline bool IsMarkerCell() const
1512     {
1513         return GetObjectType() == JSType::MARKER_CELL;
1514     }
1515 
IsTrackInfoObject()1516     inline bool IsTrackInfoObject() const
1517     {
1518         return GetObjectType() == JSType::TRACK_INFO;
1519     }
1520 
IsProtoChangeDetails()1521     inline bool IsProtoChangeDetails() const
1522     {
1523         return GetObjectType() == JSType::PROTOTYPE_INFO;
1524     }
1525 
IsProgram()1526     inline bool IsProgram() const
1527     {
1528         return GetObjectType() == JSType::PROGRAM;
1529     }
1530 
IsClassInfoExtractor()1531     inline bool IsClassInfoExtractor() const
1532     {
1533         return GetObjectType() == JSType::CLASS_INFO_EXTRACTOR;
1534     }
1535 
IsCallable()1536     inline bool IsCallable() const
1537     {
1538         uint32_t bits = GetBitField();
1539         return CallableBit::Decode(bits);
1540     }
1541 
IsConstructor()1542     inline bool IsConstructor() const
1543     {
1544         uint32_t bits = GetBitField();
1545         return ConstructorBit::Decode(bits);
1546     }
1547 
IsExtensible()1548     inline bool IsExtensible() const
1549     {
1550         uint32_t bits = GetBitField();
1551         return ExtensibleBit::Decode(bits);
1552     }
1553 
IsPrototype()1554     inline bool IsPrototype() const
1555     {
1556         uint32_t bits = GetBitField();
1557         return IsPrototypeBit::Decode(bits);
1558     }
1559 
IsClassConstructor()1560     inline bool IsClassConstructor() const
1561     {
1562         uint32_t bits = GetBitField();
1563         return IsClassConstructorOrPrototypeBit::Decode(bits) && IsConstructor();
1564     }
1565 
IsJSGlobalObject()1566     inline bool IsJSGlobalObject() const
1567     {
1568         return GetObjectType() == JSType::JS_GLOBAL_OBJECT;
1569     }
1570 
IsClassPrototype()1571     inline bool IsClassPrototype() const
1572     {
1573         uint32_t bits = GetBitField();
1574         return IsClassConstructorOrPrototypeBit::Decode(bits) && IsPrototype();
1575     }
1576 
IsNativeBindingObject()1577     inline bool IsNativeBindingObject() const
1578     {
1579         uint32_t bits = GetBitField();
1580         return IsNativeBindingObjectBit::Decode(bits);
1581     }
1582 
IsDictionaryMode()1583     inline bool IsDictionaryMode() const
1584     {
1585         uint32_t bits = GetBitField();
1586         return IsDictionaryBit::Decode(bits);
1587     }
1588 
IsJSArrayPrototypeModifiedFromBitField()1589     inline bool IsJSArrayPrototypeModifiedFromBitField() const
1590     {
1591         uint32_t bits = GetBitField();
1592         return IsJSArrayPrototypeModifiedBit::Decode(bits);
1593     }
1594 
1595     // created from AOT
IsAOT()1596     inline bool IsAOT() const
1597     {
1598         uint32_t bits = GetBitField();
1599         return IsAOTBit::Decode(bits);
1600     }
1601 
IsJSFunctionFromBitField()1602     inline bool IsJSFunctionFromBitField() const
1603     {
1604         uint32_t bits = GetBitField();
1605         return IsJSFunctionBit::Decode(bits);
1606     }
1607 
IsOnHeapFromBitField()1608     inline bool IsOnHeapFromBitField() const
1609     {
1610         uint32_t bits = GetBitField();
1611         return IsOnHeap::Decode(bits);
1612     }
1613 
IsGeneratorFunction()1614     inline bool IsGeneratorFunction() const
1615     {
1616         return GetObjectType() == JSType::JS_GENERATOR_FUNCTION;
1617     }
1618 
IsAsyncGeneratorFunction()1619     inline bool IsAsyncGeneratorFunction() const
1620     {
1621         return GetObjectType() == JSType::JS_ASYNC_GENERATOR_FUNCTION;
1622     }
1623 
IsGeneratorObject()1624     inline bool IsGeneratorObject() const
1625     {
1626         JSType jsType = GetObjectType();
1627         return jsType == JSType::JS_GENERATOR_OBJECT || jsType == JSType::JS_ASYNC_FUNC_OBJECT;
1628     }
1629 
IsAsyncGeneratorObject()1630     inline bool IsAsyncGeneratorObject() const
1631     {
1632         JSType jsType = GetObjectType();
1633         return jsType == JSType::JS_ASYNC_GENERATOR_OBJECT;
1634     }
1635 
IsGeneratorContext()1636     inline bool IsGeneratorContext() const
1637     {
1638         return GetObjectType() == JSType::JS_GENERATOR_CONTEXT;
1639     }
1640 
IsAsyncGeneratorRequest()1641     inline bool IsAsyncGeneratorRequest() const
1642     {
1643         JSType jsType = GetObjectType();
1644         return jsType == JSType::ASYNC_GENERATOR_REQUEST;
1645     }
1646 
IsAsyncIteratorRecord()1647     inline bool IsAsyncIteratorRecord() const
1648     {
1649         JSType jsType = GetObjectType();
1650         return jsType == JSType::ASYNC_ITERATOR_RECORD;
1651     }
1652 
IsAsyncFuncObject()1653     inline bool IsAsyncFuncObject() const
1654     {
1655         return GetObjectType() == JSType::JS_ASYNC_FUNC_OBJECT;
1656     }
1657 
IsJSPromise()1658     inline bool IsJSPromise() const
1659     {
1660         return GetObjectType() == JSType::JS_PROMISE;
1661     }
1662 
IsResolvingFunctionsRecord()1663     inline bool IsResolvingFunctionsRecord() const
1664     {
1665         return GetObjectType() == JSType::RESOLVING_FUNCTIONS_RECORD;
1666     }
1667 
IsPromiseRecord()1668     inline bool IsPromiseRecord() const
1669     {
1670         return GetObjectType() == JSType::PROMISE_RECORD;
1671     }
1672 
IsPromiseIteratorRecord()1673     inline bool IsPromiseIteratorRecord() const
1674     {
1675         return GetObjectType() == JSType::PROMISE_ITERATOR_RECORD;
1676     }
1677 
IsPromiseCapability()1678     inline bool IsPromiseCapability() const
1679     {
1680         return GetObjectType() == JSType::PROMISE_CAPABILITY;
1681     }
1682 
IsPromiseReaction()1683     inline bool IsPromiseReaction() const
1684     {
1685         return GetObjectType() == JSType::PROMISE_REACTIONS;
1686     }
1687 
IsCellRecord()1688     inline bool IsCellRecord() const
1689     {
1690         return GetObjectType() == JSType::CELL_RECORD;
1691     }
1692 
IsCompletionRecord()1693     inline bool IsCompletionRecord() const
1694     {
1695         return GetObjectType() == JSType::COMPLETION_RECORD;
1696     }
1697 
IsRecord()1698     inline bool IsRecord() const
1699     {
1700         JSType jsType = GetObjectType();
1701         return jsType >= JSType::JS_RECORD_FIRST && jsType <= JSType::JS_RECORD_LAST;
1702     }
1703 
IsTemplateMap()1704     inline bool IsTemplateMap() const
1705     {
1706         return GetObjectType() == JSType::TEMPLATE_MAP;
1707     }
1708 
IsFreeObject()1709     inline bool IsFreeObject() const
1710     {
1711         JSType t = GetObjectType();
1712         return (t >= JSType::FREE_OBJECT_WITH_ONE_FIELD) && (t <= JSType::FREE_OBJECT_WITH_TWO_FIELD);
1713     }
1714 
IsFreeObjectWithShortField()1715     inline bool IsFreeObjectWithShortField() const
1716     {
1717         switch (GetObjectType()) {
1718             case JSType::FREE_OBJECT_WITH_ONE_FIELD:
1719             case JSType::FREE_OBJECT_WITH_NONE_FIELD:
1720                 return true;
1721             default:
1722                 return false;
1723         }
1724     }
1725 
IsFreeObjectWithOneField()1726     inline bool IsFreeObjectWithOneField() const
1727     {
1728         return GetObjectType() == JSType::FREE_OBJECT_WITH_ONE_FIELD;
1729     }
1730 
IsFreeObjectWithNoneField()1731     inline bool IsFreeObjectWithNoneField() const
1732     {
1733         return GetObjectType() == JSType::FREE_OBJECT_WITH_NONE_FIELD;
1734     }
1735 
IsFreeObjectWithTwoField()1736     inline bool IsFreeObjectWithTwoField() const
1737     {
1738         return GetObjectType() == JSType::FREE_OBJECT_WITH_TWO_FIELD;
1739     }
1740 
IsMachineCodeObject()1741     inline bool IsMachineCodeObject() const
1742     {
1743         return GetObjectType() == JSType::MACHINE_CODE_OBJECT;
1744     }
1745 
IsAOTLiteralInfo()1746     inline bool IsAOTLiteralInfo() const
1747     {
1748         return GetObjectType() == JSType::AOT_LITERAL_INFO;
1749     }
1750 
IsExtraProfileTypeInfo()1751     inline bool IsExtraProfileTypeInfo() const
1752     {
1753         return GetObjectType() == JSType::EXTRA_PROFILE_TYPE_INFO;
1754     }
1755 
IsProfileTypeInfoCell()1756     inline bool IsProfileTypeInfoCell() const
1757     {
1758         JSType jsType = GetObjectType();
1759         return jsType >= JSType::PROFILE_TYPE_INFO_CELL_FIRST && jsType <= JSType::PROFILE_TYPE_INFO_CELL_LAST;
1760     }
1761 
IsProfileTypeInfoCell0()1762     inline bool IsProfileTypeInfoCell0() const
1763     {
1764         JSType jsType = GetObjectType();
1765         return jsType == JSType::PROFILE_TYPE_INFO_CELL_0;
1766     }
1767 
IsFunctionTemplate()1768     inline bool IsFunctionTemplate() const
1769     {
1770         JSType jsType = GetObjectType();
1771         return jsType == JSType::FUNCTION_TEMPLATE;
1772     }
1773 
IsVTable()1774     inline bool IsVTable() const
1775     {
1776         return GetObjectType() == JSType::VTABLE;
1777     }
1778 
IsModuleRecord()1779     inline bool IsModuleRecord() const
1780     {
1781         JSType jsType = GetObjectType();
1782         return jsType >= JSType::MODULE_RECORD_FIRST && jsType <= JSType::MODULE_RECORD_LAST;
1783     }
1784 
IsSourceTextModule()1785     inline bool IsSourceTextModule() const
1786     {
1787         return GetObjectType() == JSType::SOURCE_TEXT_MODULE_RECORD;
1788     }
1789 
IsCjsExports()1790     inline bool IsCjsExports() const
1791     {
1792         return GetObjectType() == JSType::JS_CJS_EXPORTS;
1793     }
1794 
IsCjsModule()1795     inline bool IsCjsModule() const
1796     {
1797         return GetObjectType() == JSType::JS_CJS_MODULE;
1798     }
1799 
IsCjsRequire()1800     inline bool IsCjsRequire() const
1801     {
1802         return GetObjectType() == JSType::JS_CJS_REQUIRE;
1803     }
1804 
IsImportEntry()1805     inline bool IsImportEntry() const
1806     {
1807         return GetObjectType() == JSType::IMPORTENTRY_RECORD;
1808     }
1809 
IsLocalExportEntry()1810     inline bool IsLocalExportEntry() const
1811     {
1812         return GetObjectType() == JSType::LOCAL_EXPORTENTRY_RECORD;
1813     }
1814 
IsIndirectExportEntry()1815     inline bool IsIndirectExportEntry() const
1816     {
1817         return GetObjectType() == JSType::INDIRECT_EXPORTENTRY_RECORD;
1818     }
1819 
IsStarExportEntry()1820     inline bool IsStarExportEntry() const
1821     {
1822         return GetObjectType() == JSType::STAR_EXPORTENTRY_RECORD;
1823     }
1824 
IsResolvedBinding()1825     inline bool IsResolvedBinding() const
1826     {
1827         return GetObjectType() == JSType::RESOLVEDBINDING_RECORD;
1828     }
1829 
IsResolvedIndexBinding()1830     inline bool IsResolvedIndexBinding() const
1831     {
1832         return GetObjectType() == JSType::RESOLVEDINDEXBINDING_RECORD;
1833     }
1834 
IsResolvedRecordIndexBinding()1835     inline bool IsResolvedRecordIndexBinding() const
1836     {
1837         return GetObjectType() == JSType::RESOLVEDRECORDINDEXBINDING_RECORD;
1838     }
1839 
IsResolvedRecordBinding()1840     inline bool IsResolvedRecordBinding() const
1841     {
1842         return GetObjectType() == JSType::RESOLVEDRECORDBINDING_RECORD;
1843     }
1844 
IsModuleNamespace()1845     inline bool IsModuleNamespace() const
1846     {
1847         return GetObjectType() == JSType::JS_MODULE_NAMESPACE;
1848     }
1849 
IsNativeModuleFailureInfo()1850     inline bool IsNativeModuleFailureInfo() const
1851     {
1852         return GetObjectType() == JSType::NATIVE_MODULE_FAILURE_INFO;
1853     }
1854 
IsJSSharedObject()1855     inline bool IsJSSharedObject() const
1856     {
1857         return GetObjectType() == JSType::JS_SHARED_OBJECT;
1858     }
1859 
IsJSSharedArray()1860     inline bool IsJSSharedArray() const
1861     {
1862         return GetObjectType() == JSType::JS_SHARED_ARRAY;
1863     }
1864 
SetElementsKind(ElementsKind kind)1865     inline void SetElementsKind(ElementsKind kind)
1866     {
1867         uint32_t bits = GetBitField();
1868         uint32_t newVal = ElementsKindBits::Update(bits, kind);
1869         SetBitField(newVal);
1870     }
1871 
GetElementsKind()1872     inline ElementsKind GetElementsKind() const
1873     {
1874         uint32_t bits = GetBitField();
1875         return ElementsKindBits::Decode(bits);
1876     }
1877 
SetConstructionCounter(uint8_t count)1878     inline void SetConstructionCounter(uint8_t count)
1879     {
1880         uint32_t bits = GetBitField();
1881         uint32_t newVal = ConstructionCounterBits::Update(bits, count);
1882         SetBitField(newVal);
1883     }
1884 
GetConstructionCounter()1885     inline uint8_t GetConstructionCounter() const
1886     {
1887         uint32_t bits = GetBitField();
1888         return ConstructionCounterBits::Decode(bits);
1889     }
1890 
SetIsDictionaryElement(bool value)1891     inline void SetIsDictionaryElement(bool value)
1892     {
1893         uint32_t newVal = DictionaryElementBits::Update(GetBitField(), value);
1894         SetBitField(newVal);
1895     }
IsDictionaryElement()1896     inline bool IsDictionaryElement() const
1897     {
1898         return DictionaryElementBits::Decode(GetBitField());
1899     }
SetIsStableElements(bool value)1900     inline void SetIsStableElements(bool value)
1901     {
1902         uint32_t newVal = IsStableElementsBit::Update(GetBitField(), value);
1903         SetBitField(newVal);
1904     }
IsStableElements()1905     inline bool IsStableElements() const
1906     {
1907         return IsStableElementsBit::Decode(GetBitField());
1908     }
IsStableJSArguments()1909     inline bool IsStableJSArguments() const
1910     {
1911         uint32_t bits = GetBitField();
1912         auto type = ObjectTypeBits::Decode(bits);
1913         return IsStableElementsBit::Decode(bits) && (type == JSType::JS_ARGUMENTS);
1914     }
IsStableJSArray()1915     inline bool IsStableJSArray() const
1916     {
1917         uint32_t bits = GetBitField();
1918         auto type = ObjectTypeBits::Decode(bits);
1919         return IsStableElementsBit::Decode(bits) && (type == JSType::JS_ARRAY);
1920     }
SetHasConstructor(bool value)1921     inline void SetHasConstructor(bool value)
1922     {
1923         // only array and typedArray use this bitfield
1924         JSTaggedType newVal = HasConstructorBits::Update(GetBitField(), value);
1925         SetBitField(newVal);
1926     }
HasConstructor()1927     inline bool HasConstructor() const
1928     {
1929         // only array and typedArray use this bitfield
1930         return HasConstructorBits::Decode(GetBitField());
1931     }
1932 
SetNumberOfProps(uint32_t num)1933     inline void SetNumberOfProps(uint32_t num)
1934     {
1935         uint32_t bits = GetBitField1();
1936         uint32_t newVal = NumberOfPropsBits::Update(bits, num);
1937         SetBitField1(newVal);
1938     }
1939 
IncNumberOfProps()1940     inline void IncNumberOfProps()
1941     {
1942         ASSERT(NumberOfProps() < PropertyAttributes::MAX_FAST_PROPS_CAPACITY);
1943         SetNumberOfProps(NumberOfProps() + 1);
1944     }
1945 
NumberOfProps()1946     inline uint32_t NumberOfProps() const
1947     {
1948         uint32_t bits = GetBitField1();
1949         return NumberOfPropsBits::Decode(bits);
1950     }
1951 
HasProps()1952     inline bool HasProps() const
1953     {
1954         return NumberOfProps() > 0;
1955     }
1956 
PropsIsEmpty()1957     inline bool PropsIsEmpty() const
1958     {
1959         return NumberOfProps() == 0;
1960     }
1961 
LastPropIndex()1962     inline uint32_t LastPropIndex() const
1963     {
1964         ASSERT(NumberOfProps() > 0);
1965         return NumberOfProps() - 1;
1966     }
1967 
GetNextInlinedPropsIndex()1968     inline int32_t GetNextInlinedPropsIndex() const
1969     {
1970         uint32_t inlinedProperties = GetInlinedProperties();
1971         uint32_t numberOfProps = NumberOfProps();
1972         if (numberOfProps < inlinedProperties) {
1973             return numberOfProps;
1974         }
1975         return -1;
1976     }
1977 
GetNextNonInlinedPropsIndex()1978     inline int32_t GetNextNonInlinedPropsIndex() const
1979     {
1980         uint32_t inlinedProperties = GetInlinedProperties();
1981         uint32_t numberOfProps = NumberOfProps();
1982         if (numberOfProps >= inlinedProperties) {
1983             return numberOfProps - inlinedProperties;
1984         }
1985         return -1;
1986     }
1987 
GetObjectSize()1988     inline uint32_t GetObjectSize() const
1989     {
1990         uint32_t bits = GetBitField1();
1991         return ObjectSizeInWordsBits::Decode(bits) * JSTaggedValue::TaggedTypeSize();
1992     }
1993 
GetObjectSizeExcludeInlinedProps()1994     inline uint32_t GetObjectSizeExcludeInlinedProps() const
1995     {
1996         return GetObjectSize() - GetInlinedProperties() * JSTaggedValue::TaggedTypeSize();
1997     }
1998 
SetObjectSize(uint32_t num)1999     inline void SetObjectSize(uint32_t num)
2000     {
2001         ASSERT((num / JSTaggedValue::TaggedTypeSize()) <= MAX_OBJECT_SIZE_IN_WORDS);
2002         uint32_t bits = GetBitField1();
2003         uint32_t newVal = ObjectSizeInWordsBits::Update(bits, num / JSTaggedValue::TaggedTypeSize());
2004         SetBitField1(newVal);
2005     }
2006 
GetInlinedPropertiesOffset(uint32_t index)2007     inline uint32_t GetInlinedPropertiesOffset(uint32_t index) const
2008     {
2009         ASSERT(index < GetInlinedProperties());
2010         return GetInlinedPropertiesIndex(index) * JSTaggedValue::TaggedTypeSize();
2011     }
2012 
GetInlinedPropertiesIndex(uint32_t index)2013     inline uint32_t GetInlinedPropertiesIndex(uint32_t index) const
2014     {
2015         ASSERT(index < GetInlinedProperties());
2016         uint32_t bits = GetBitField1();
2017         return InlinedPropsStartBits::Decode(bits) + index;
2018     }
2019 
SetInlinedPropsStart(uint32_t num)2020     inline void SetInlinedPropsStart(uint32_t num)
2021     {
2022         uint32_t bits = GetBitField1();
2023         uint32_t newVal = InlinedPropsStartBits::Update(bits, num / JSTaggedValue::TaggedTypeSize());
2024         SetBitField1(newVal);
2025     }
2026 
GetInlinedPropsStartSize()2027     inline uint32_t GetInlinedPropsStartSize() const
2028     {
2029         uint32_t bits = GetBitField1();
2030         return InlinedPropsStartBits::Decode(bits) * JSTaggedValue::TaggedTypeSize();
2031     }
2032 
GetInlinedProperties()2033     inline uint32_t GetInlinedProperties() const
2034     {
2035         if (IsJSObject()) {
2036             uint32_t bits = GetBitField1();
2037             return static_cast<uint32_t>(ObjectSizeInWordsBits::Decode(bits) - InlinedPropsStartBits::Decode(bits));
2038         } else {
2039             return 0;
2040         }
2041     }
2042 
SetHasDeleteProperty(bool flag)2043     inline void SetHasDeleteProperty(bool flag) const
2044     {
2045         HasDeletePropertyBit::Set<uint32_t>(flag, GetBitField1Addr());
2046     }
2047 
HasDeleteProperty()2048     inline bool HasDeleteProperty() const
2049     {
2050         uint32_t bits = GetBitField1();
2051         return HasDeletePropertyBit::Decode(bits);
2052     }
2053 
SetIsAllTaggedProp(bool flag)2054     inline void SetIsAllTaggedProp(bool flag) const
2055     {
2056         IsAllTaggedPropBit::Set<uint32_t>(flag, GetBitField1Addr());
2057     }
2058 
IsAllTaggedProp()2059     inline bool IsAllTaggedProp() const
2060     {
2061         uint32_t bits = GetBitField1();
2062         return IsAllTaggedPropBit::Decode(bits);
2063     }
2064 
IsObjSizeTrackingInProgress()2065     inline bool IsObjSizeTrackingInProgress() const
2066     {
2067         return GetConstructionCounter() != 0;
2068     }
2069 
StartObjSizeTracking()2070     inline void StartObjSizeTracking()
2071     {
2072         SetConstructionCounter(SLACK_TRACKING_COUNT);
2073     }
2074 
2075     inline void CompleteObjSizeTracking(const JSThread *thread);
2076 
2077     inline void ObjSizeTrackingStep(const JSThread *thread);
2078 
2079     inline static JSHClass *FindRootHClass(const JSThread *thread, JSHClass *hclass);
2080     inline static JSTaggedValue FindProtoHClass(const JSThread *thread, JSHClass *hclass);
2081     inline static JSTaggedValue FindProtoRootHClass(const JSThread *thread, JSHClass *hclass);
2082     inline static void UpdateRootHClass(const JSThread *thread, const JSHandle<JSHClass> &parent,
2083                                         const JSHandle<JSHClass> &child);
2084 
2085     inline static int FindPropertyEntry(const JSThread *thread, JSHClass *hclass, JSTaggedValue key);
2086 
2087     static PUBLIC_API PropertyLookupResult LookupPropertyInAotHClass(const JSThread *thread, JSHClass *hclass,
2088         JSTaggedValue key);
2089     static PUBLIC_API PropertyLookupResult LookupPropertyInPGOHClass(const JSThread *thread, JSHClass *hclass,
2090         JSTaggedValue key);
2091     static PUBLIC_API PropertyLookupResult LookupPropertyInBuiltinPrototypeHClass(const JSThread *thread,
2092                                                                                   JSHClass *hclass, JSTaggedValue key);
2093     static PUBLIC_API PropertyLookupResult LookupPropertyInBuiltinHClass(const JSThread *thread, JSHClass *hclass,
2094                                                                          JSTaggedValue key);
2095 
2096     static constexpr size_t BIT_FIELD_OFFSET = TaggedObjectSize();
2097     ACCESSORS_PRIMITIVE_FIELD(BitField, uint32_t, BIT_FIELD_OFFSET, BIT_FIELD1_OFFSET);
2098     ACCESSORS_PRIMITIVE_FIELD(BitField1, uint32_t, BIT_FIELD1_OFFSET, PROTOTYPE_OFFSET);
2099     ACCESSORS_DCHECK(Proto, PROTOTYPE_OFFSET, LAYOUT_OFFSET, IsString);
2100     ACCESSORS_SYNCHRONIZED_DCHECK_WITH_RB_MODE(Layout, LAYOUT_OFFSET, TRANSTIONS_OFFSET, IsString);
2101     ACCESSORS_DCHECK(Transitions, TRANSTIONS_OFFSET, PARENT_OFFSET, IsString);
2102     ACCESSORS_DCHECK(Parent, PARENT_OFFSET, PROTO_CHANGE_MARKER_OFFSET, IsString);
2103     ACCESSORS_DCHECK(ProtoChangeMarker, PROTO_CHANGE_MARKER_OFFSET, PROTO_CHANGE_DETAILS_OFFSET, IsString);
2104     ACCESSORS_DCHECK(ProtoChangeDetails, PROTO_CHANGE_DETAILS_OFFSET, ENUM_CACHE_OFFSET, IsString);
2105     ACCESSORS_DCHECK(EnumCache, ENUM_CACHE_OFFSET, DEPENDENT_INFOS_OFFSET, IsString);
2106     ACCESSORS_DCHECK(DependentInfos, DEPENDENT_INFOS_OFFSET, PROFILE_TYPE_OFFSET, IsString);
2107     ACCESSORS_PRIMITIVE_FIELD_DCHECK(ProfileType, uint64_t, PROFILE_TYPE_OFFSET, LAST_OFFSET, IsString);
2108     DEFINE_ALIGN_SIZE(LAST_OFFSET);
2109     static_assert(common::CompositeBaseClass::SIZE >= SIZE,
2110                   "CompositeBaseClass::SIZE should be larger than JSHClass::SIZE");
2111 
2112     static JSHandle<JSHClass> SetPrototypeWithNotification(const JSThread *thread,
2113                                                            const JSHandle<JSHClass> &hclass,
2114                                                            const JSHandle<JSTaggedValue> &proto,
2115                                                            bool isChangeProto = false);
2116     static void SetPrototypeTransition(JSThread *thread, const JSHandle<JSObject> &object,
2117                                        const JSHandle<JSTaggedValue> &proto,
2118                                        bool isChangeProto = false);
2119     void SetPrototype(const JSThread *thread, JSTaggedValue proto, bool isChangeProto = false);
2120     void SetPrototype(const JSThread *thread, const JSHandle<GlobalEnv> &env,
2121                       JSTaggedValue proto, bool isChangeProto = false);
2122     void PUBLIC_API SetPrototype(const JSThread *thread,
2123                                  const JSHandle<JSTaggedValue> &proto,
2124                                  bool isChangeProto = false);
2125     static void OptimizePrototypeForIC(const JSThread *thread, const JSHandle<GlobalEnv> &env,
2126                                        const JSHandle<JSTaggedValue> &proto,
2127                                        bool isChangeProto = false);
GetPrototype(const JSThread * thread)2128     inline JSTaggedValue GetPrototype(const JSThread *thread) const
2129     {
2130         return GetProto(thread);
2131     }
2132 
2133     inline JSHClass *FindTransitions(const JSThread *thread,
2134                                      const JSTaggedValue &key,
2135                                      const JSTaggedValue &metaData,
2136                                      const Representation &rep);
2137     inline JSHClass *CheckHClassForRep(const JSThread *thread, JSHClass *hclass, const Representation &rep);
2138 
2139     DECL_DUMP()
2140 
2141     static CString DumpJSType(JSType type);
2142 
2143     static JSHandle<JSHClass> CreateRootHClassFromPGO(const JSThread* thread,
2144                                                       const HClassLayoutDesc* desc,
2145                                                       uint32_t maxNum);
2146     static JSHandle<JSHClass> CreateRootHClassWithCached(const JSThread* thread,
2147                                                          const HClassLayoutDesc* desc,
2148                                                          uint32_t literalLength,
2149                                                          uint32_t maxPropsNum);
2150     static JSHandle<JSHClass> CreateChildHClassFromPGO(const JSThread* thread,
2151                                                        const JSHandle<JSHClass>& parent,
2152                                                        const HClassLayoutDesc* desc);
2153     static bool DumpRootHClassByPGO(const JSThread *thread, const JSHClass* hclass, HClassLayoutDesc* desc);
2154     static bool DumpChildHClassByPGO(const JSThread *thread, const JSHClass* hclass, HClassLayoutDesc* desc);
2155     static bool UpdateRootLayoutDescByPGO(const JSThread* thread, const JSHClass* hclass, HClassLayoutDesc* rootDesc);
2156     static bool UpdateChildLayoutDescByPGO(const JSThread* thread, const JSHClass* hclass, HClassLayoutDesc* childDesc);
2157     static std::pair<bool, CString> DumpToString(const JSThread *thread, JSTaggedType hclassVal);
2158 
2159     DECL_VISIT_OBJECT(PROTOTYPE_OFFSET, PROFILE_TYPE_OFFSET);
2160     inline JSHClass *FindProtoTransitions(const JSThread *thread, const JSTaggedValue &key,
2161         const JSTaggedValue &proto);
HasTransitions(const JSThread * thread)2162     inline bool HasTransitions(const JSThread *thread) const
2163     {
2164         return !GetTransitions(thread).IsUndefined();
2165     }
2166 
2167     static JSHandle<JSHClass> CreateSHClass(JSThread *thread,
2168                                             const std::vector<PropertyDescriptor> &descs,
2169                                             const JSHClass *parentHClass = nullptr,
2170                                             bool isFunction = false);
2171     static JSHandle<JSHClass> CreateSConstructorHClass(JSThread *thread, const std::vector<PropertyDescriptor> &descs);
2172     static JSHandle<JSHClass> CreateSPrototypeHClass(JSThread *thread, const std::vector<PropertyDescriptor> &descs);
2173     JSHCLASS_PUBLIC_HYBRID_EXTENSION()
2174 
2175 private:
2176 
2177     static inline bool ProtoIsFastJSArray(const JSHandle<GlobalEnv> &env,
2178                                           const JSHandle<JSTaggedValue> proto, const JSHandle<JSHClass> hclass);
2179 
2180     static void CreateSInlinedLayout(JSThread *thread,
2181                                      const std::vector<PropertyDescriptor> &descs,
2182                                      const JSHandle<JSHClass> &hclass,
2183                                      const JSHClass *parentHClass = nullptr);
2184     static void CreateSDictLayout(JSThread *thread,
2185                                   const std::vector<PropertyDescriptor> &descs,
2186                                   const JSHandle<JSHClass> &hclass,
2187                                   const JSHClass *parentHClass = nullptr);
2188     static inline void AddTransitions(const JSThread *thread, const JSHandle<JSHClass> &parent,
2189                                       const JSHandle<JSHClass> &child, const JSHandle<JSTaggedValue> &key,
2190                                       PropertyAttributes attr);
2191     static inline void AddExtensionTransitions(const JSThread *thread, const JSHandle<JSHClass> &parent,
2192                                                const JSHandle<JSHClass> &child, const JSHandle<JSTaggedValue> &key);
2193     static inline void AddProtoTransitions(const JSThread *thread, const JSHandle<JSHClass> &parent,
2194                                            const JSHandle<JSHClass> &child, const JSHandle<JSTaggedValue> &key,
2195                                            const JSHandle<JSTaggedValue> &proto);
2196     template<bool checkDuplicateKeys = false>
2197     static inline void AddPropertyToNewHClass(const JSThread *thread, JSHandle<JSHClass> &jshclass,
2198                                               JSHandle<JSHClass> &newJsHClass, const JSHandle<JSTaggedValue> &key,
2199                                               const PropertyAttributes &attr);
2200 
2201     void InitializeWithDefaultValue(const JSThread *thread, uint32_t size, JSType type, uint32_t inlinedProps);
2202 
IsJSTypeObject(JSType type)2203     static bool IsJSTypeObject(JSType type)
2204     {
2205         return JSType::JS_OBJECT_FIRST <= type && type <= JSType::JS_OBJECT_LAST;
2206     }
2207 
2208     static bool IsJSTypeShared(JSType type);
2209 
2210     inline void Copy(const JSThread *thread, const JSHClass *jshclass);
2211 
GetBitFieldAddr()2212     uint32_t *GetBitFieldAddr() const
2213     {
2214         return reinterpret_cast<uint32_t *>(ToUintPtr(this) + BIT_FIELD_OFFSET);
2215     }
2216 
GetBitField1Addr()2217     uint32_t *GetBitField1Addr() const
2218     {
2219         return reinterpret_cast<uint32_t *>(ToUintPtr(this) + BIT_FIELD1_OFFSET);
2220     }
2221     friend class RuntimeStubs;
2222 };
2223 static_assert(JSHClass::BIT_FIELD_OFFSET % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT) == 0);
2224 
2225 // record property look up info in local and vtable
2226 class PropertyLookupResult {
2227 public:
2228     static constexpr uint32_t OFFSET_BITFIELD_NUM = 14;
2229     using IsFoundBit = BitField<bool, 0, 1>;
2230     using IsLocalBit = IsFoundBit::NextFlag;
2231     using IsNotHoleBit = IsLocalBit::NextFlag;
2232     using IsAccessorBit = IsNotHoleBit::NextFlag;
2233     using OffsetBits = IsAccessorBit::NextField<uint32_t, OFFSET_BITFIELD_NUM>;
2234     using WritableField = OffsetBits::NextFlag;
2235     using RepresentationBits = WritableField::NextField<Representation, PropertyAttributes::REPRESENTATION_NUM>;
2236     using IsInlinedPropsBits = RepresentationBits::NextFlag;
2237     using IsLoadFromIterResultBit = IsInlinedPropsBits::NextFlag;
2238 
data_(data)2239     explicit PropertyLookupResult(uint32_t data = 0) : data_(data) {}
2240     ~PropertyLookupResult() = default;
2241     DEFAULT_NOEXCEPT_MOVE_SEMANTIC(PropertyLookupResult);
2242     DEFAULT_COPY_SEMANTIC(PropertyLookupResult);
2243 
IsFound()2244     inline bool IsFound() const
2245     {
2246         return IsFoundBit::Get(data_);
2247     }
2248 
SetIsFound(bool flag)2249     inline void SetIsFound(bool flag)
2250     {
2251         IsFoundBit::Set(flag, &data_);
2252     }
2253 
IsWritable()2254     inline bool IsWritable() const
2255     {
2256         return WritableField::Get(data_);
2257     }
2258 
SetIsWritable(bool flag)2259     inline void SetIsWritable(bool flag)
2260     {
2261         WritableField::Set(flag, &data_);
2262     }
2263 
IsLocal()2264     inline bool IsLocal() const
2265     {
2266         return IsLocalBit::Get(data_);
2267     }
2268 
SetIsLocal(bool flag)2269     inline void SetIsLocal(bool flag)
2270     {
2271         IsLocalBit::Set(flag, &data_);
2272     }
2273 
IsNotHole()2274     inline bool IsNotHole() const
2275     {
2276         return IsNotHoleBit::Get(data_);
2277     }
2278 
SetIsNotHole(bool flag)2279     inline void SetIsNotHole(bool flag)
2280     {
2281         IsNotHoleBit::Set(flag, &data_);
2282     }
2283 
IsVtable()2284     inline bool IsVtable() const
2285     {
2286         return IsFound() && !IsLocal();
2287     }
2288 
SetIsVtable()2289     inline void SetIsVtable()
2290     {
2291         SetIsFound(true);
2292         SetIsLocal(false);
2293     }
2294 
IsAccessor()2295     inline bool IsAccessor() const
2296     {
2297         return IsAccessorBit::Get(data_);
2298     }
2299 
SetIsAccessor(bool flag)2300     inline void SetIsAccessor(bool flag)
2301     {
2302         IsAccessorBit::Set(flag, &data_);
2303     }
2304 
IsFunction()2305     inline bool IsFunction() const
2306     {
2307         return IsVtable() && !IsAccessor();
2308     }
2309 
GetOffset()2310     inline uint32_t GetOffset() const
2311     {
2312         return OffsetBits::Get(data_);
2313     }
2314 
SetOffset(uint32_t offset)2315     inline void SetOffset(uint32_t offset)
2316     {
2317         OffsetBits::Set<uint32_t>(offset, &data_);
2318     }
2319 
SetRepresentation(Representation rep)2320     inline void SetRepresentation(Representation rep)
2321     {
2322         RepresentationBits::Set(rep, &data_);
2323     }
2324 
GetRepresentation()2325     inline Representation GetRepresentation()
2326     {
2327         return RepresentationBits::Get(data_);
2328     }
2329 
SetIsInlinedProps(bool flag)2330     inline void SetIsInlinedProps(bool flag)
2331     {
2332         IsInlinedPropsBits::Set(flag, &data_);
2333     }
2334 
IsInlinedProps()2335     inline bool IsInlinedProps()
2336     {
2337         return IsInlinedPropsBits::Get(data_);
2338     }
2339 
SetIsLoadFromIterResult(bool flag)2340     inline void SetIsLoadFromIterResult(bool flag)
2341     {
2342         IsLoadFromIterResultBit::Set(flag, &data_);
2343     }
2344 
IsLoadFromIterResult()2345     inline bool IsLoadFromIterResult() const
2346     {
2347         return IsLoadFromIterResultBit::Get(data_);
2348     }
2349 
GetData()2350     inline uint32_t GetData() const
2351     {
2352         return data_;
2353     }
2354 
2355 private:
2356     uint32_t data_ {0};
2357 };
2358 static_assert(PropertyLookupResult::OffsetBits::MaxValue() >
2359               (PropertyAttributes::MAX_FAST_PROPS_CAPACITY * JSTaggedValue::TaggedTypeSize()));
2360 }  // namespace panda::ecmascript
2361 
2362 #endif  // ECMASCRIPT_JS_HCLASS_H
2363