1 /*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <codecvt>
17 #include <iomanip>
18 #include <iostream>
19 #include <string>
20
21 #include "ecmascript/accessor_data.h"
22 #include "ecmascript/ecma_vm.h"
23 #include "ecmascript/global_dictionary-inl.h"
24 #include "ecmascript/global_env.h"
25 #include "ecmascript/vtable.h"
26 #include "ecmascript/ic/ic_handler.h"
27 #include "ecmascript/ic/property_box.h"
28 #include "ecmascript/ic/proto_change_details.h"
29 #include "ecmascript/interpreter/frame_handler.h"
30 #include "ecmascript/jobs/micro_job_queue.h"
31 #include "ecmascript/jobs/pending_job.h"
32 #include "ecmascript/jspandafile/class_info_extractor.h"
33 #include "ecmascript/jspandafile/class_literal.h"
34 #include "ecmascript/jspandafile/program_object.h"
35 #include "ecmascript/js_api/js_api_arraylist.h"
36 #include "ecmascript/js_api/js_api_arraylist_iterator.h"
37 #include "ecmascript/js_api/js_api_deque.h"
38 #include "ecmascript/js_api/js_api_deque_iterator.h"
39 #include "ecmascript/js_api/js_api_hashmap.h"
40 #include "ecmascript/js_api/js_api_hashmap_iterator.h"
41 #include "ecmascript/js_api/js_api_hashset.h"
42 #include "ecmascript/js_api/js_api_hashset_iterator.h"
43 #include "ecmascript/js_api/js_api_lightweightmap.h"
44 #include "ecmascript/js_api/js_api_lightweightmap_iterator.h"
45 #include "ecmascript/js_api/js_api_lightweightset.h"
46 #include "ecmascript/js_api/js_api_lightweightset_iterator.h"
47 #include "ecmascript/js_api/js_api_linked_list.h"
48 #include "ecmascript/js_api/js_api_linked_list_iterator.h"
49 #include "ecmascript/js_api/js_api_list.h"
50 #include "ecmascript/js_api/js_api_list_iterator.h"
51 #include "ecmascript/js_api/js_api_plain_array.h"
52 #include "ecmascript/js_api/js_api_plain_array_iterator.h"
53 #include "ecmascript/js_api/js_api_queue.h"
54 #include "ecmascript/js_api/js_api_queue_iterator.h"
55 #include "ecmascript/js_api/js_api_stack.h"
56 #include "ecmascript/js_api/js_api_stack_iterator.h"
57 #include "ecmascript/js_api/js_api_tree_map.h"
58 #include "ecmascript/js_api/js_api_tree_map_iterator.h"
59 #include "ecmascript/js_api/js_api_tree_set.h"
60 #include "ecmascript/js_api/js_api_tree_set_iterator.h"
61 #include "ecmascript/js_api/js_api_vector.h"
62 #include "ecmascript/js_api/js_api_vector_iterator.h"
63 #include "ecmascript/js_array.h"
64 #include "ecmascript/js_array_iterator.h"
65 #include "ecmascript/js_arraybuffer.h"
66 #include "ecmascript/js_async_from_sync_iterator.h"
67 #include "ecmascript/js_async_function.h"
68 #include "ecmascript/js_async_generator_object.h"
69 #include "ecmascript/js_dataview.h"
70 #include "ecmascript/js_date.h"
71 #include "ecmascript/js_for_in_iterator.h"
72 #include "ecmascript/js_finalization_registry.h"
73 #include "ecmascript/js_function.h"
74 #include "ecmascript/js_generator_object.h"
75 #include "ecmascript/js_global_object.h"
76 #include "ecmascript/js_handle.h"
77 #include "ecmascript/js_map.h"
78 #include "ecmascript/js_map_iterator.h"
79 #include "ecmascript/js_number_format.h"
80 #include "ecmascript/js_object-inl.h"
81 #include "ecmascript/js_plural_rules.h"
82 #include "ecmascript/js_primitive_ref.h"
83 #include "ecmascript/js_promise.h"
84 #include "ecmascript/js_realm.h"
85 #include "ecmascript/js_regexp.h"
86 #include "ecmascript/js_regexp_iterator.h"
87 #include "ecmascript/js_set.h"
88 #include "ecmascript/js_set_iterator.h"
89 #include "ecmascript/js_string_iterator.h"
90 #include "ecmascript/js_tagged_number.h"
91 #include "ecmascript/js_tagged_value-inl.h"
92 #include "ecmascript/js_thread.h"
93 #include "ecmascript/js_typed_array.h"
94 #include "ecmascript/js_weak_container.h"
95 #include "ecmascript/js_weak_ref.h"
96 #include "ecmascript/layout_info-inl.h"
97 #include "ecmascript/lexical_env.h"
98 #include "ecmascript/linked_hash_table.h"
99 #include "ecmascript/mem/assert_scope.h"
100 #include "ecmascript/mem/c_containers.h"
101 #include "ecmascript/mem/machine_code.h"
102 #include "ecmascript/module/js_module_namespace.h"
103 #include "ecmascript/module/js_module_source_text.h"
104 #include "ecmascript/require/js_cjs_module.h"
105 #include "ecmascript/require/js_cjs_module_cache.h"
106 #include "ecmascript/require/js_cjs_require.h"
107 #include "ecmascript/require/js_cjs_exports.h"
108 #include "ecmascript/tagged_array.h"
109 #include "ecmascript/tagged_dictionary.h"
110 #include "ecmascript/tagged_hash_array.h"
111 #include "ecmascript/tagged_list.h"
112 #include "ecmascript/tagged_tree.h"
113 #include "ecmascript/template_map.h"
114 #include "ecmascript/transitions_dictionary.h"
115 #include "ecmascript/ts_types/ts_type.h"
116 #include "ecmascript/js_displaynames.h"
117 #include "ecmascript/js_list_format.h"
118 #ifdef ARK_SUPPORT_INTL
119 #include "ecmascript/js_bigint.h"
120 #include "ecmascript/js_collator.h"
121 #include "ecmascript/js_date_time_format.h"
122 #include "ecmascript/js_intl.h"
123 #include "ecmascript/js_locale.h"
124 #include "ecmascript/js_relative_time_format.h"
125 #endif
126
127 namespace panda::ecmascript {
128 using MicroJobQueue = panda::ecmascript::job::MicroJobQueue;
129 using PendingJob = panda::ecmascript::job::PendingJob;
130
131 static constexpr uint32_t DUMP_TYPE_OFFSET = 12;
132 static constexpr uint32_t DUMP_PROPERTY_OFFSET = 20;
133 static constexpr uint32_t DUMP_ELEMENT_OFFSET = 2;
134
DumpJSType(JSType type)135 CString JSHClass::DumpJSType(JSType type)
136 {
137 switch (type) {
138 case JSType::HCLASS:
139 return "JSHClass";
140 case JSType::TAGGED_ARRAY:
141 return "TaggedArray";
142 case JSType::LEXICAL_ENV:
143 return "LexicalEnv";
144 case JSType::TAGGED_DICTIONARY:
145 return "TaggedDictionary";
146 case JSType::CONSTANT_POOL:
147 return "ConstantPool";
148 case JSType::COW_TAGGED_ARRAY:
149 return "COWArray";
150 case JSType::LINE_STRING:
151 case JSType::CONSTANT_STRING:
152 case JSType::TREE_STRING:
153 return "BaseString";
154 case JSType::JS_NATIVE_POINTER:
155 return "NativePointer";
156 case JSType::JS_OBJECT:
157 return "Object";
158 case JSType::JS_FUNCTION_BASE:
159 return "Function Base";
160 case JSType::JS_FUNCTION:
161 return "Function";
162 case JSType::JS_ERROR:
163 return "Error";
164 case JSType::JS_EVAL_ERROR:
165 return "Eval Error";
166 case JSType::JS_RANGE_ERROR:
167 return "Range Error";
168 case JSType::JS_TYPE_ERROR:
169 return "Type Error";
170 case JSType::JS_AGGREGATE_ERROR:
171 return "Aggregate Error";
172 case JSType::JS_REFERENCE_ERROR:
173 return "Reference Error";
174 case JSType::JS_URI_ERROR:
175 return "Uri Error";
176 case JSType::JS_SYNTAX_ERROR:
177 return "Syntax Error";
178 case JSType::JS_OOM_ERROR:
179 return "OutOfMemory Error";
180 case JSType::JS_REG_EXP:
181 return "Regexp";
182 case JSType::JS_SET:
183 return "Set";
184 case JSType::JS_MAP:
185 return "Map";
186 case JSType::JS_WEAK_SET:
187 return "WeakSet";
188 case JSType::JS_WEAK_MAP:
189 return "WeakMap";
190 case JSType::JS_WEAK_REF:
191 return "WeakRef";
192 case JSType::JS_FINALIZATION_REGISTRY:
193 return "JSFinalizationRegistry";
194 case JSType::CELL_RECORD:
195 return "CellRecord";
196 case JSType::JS_DATE:
197 return "Date";
198 case JSType::JS_BOUND_FUNCTION:
199 return "Bound Function";
200 case JSType::JS_ARRAY:
201 return "Array";
202 case JSType::JS_TYPED_ARRAY:
203 return "Typed Array";
204 case JSType::JS_INT8_ARRAY:
205 return "Int8 Array";
206 case JSType::JS_UINT8_ARRAY:
207 return "Uint8 Array";
208 case JSType::JS_UINT8_CLAMPED_ARRAY:
209 return "Uint8 Clamped Array";
210 case JSType::JS_INT16_ARRAY:
211 return "Int16 Array";
212 case JSType::JS_UINT16_ARRAY:
213 return "Uint16 Array";
214 case JSType::JS_INT32_ARRAY:
215 return "Int32 Array";
216 case JSType::JS_UINT32_ARRAY:
217 return "Uint32 Array";
218 case JSType::BIGINT:
219 return "BigInt";
220 case JSType::JS_FLOAT32_ARRAY:
221 return "Float32 Array";
222 case JSType::JS_FLOAT64_ARRAY:
223 return "Float64 Array";
224 case JSType::JS_BIGINT64_ARRAY:
225 return "BigInt64 Array";
226 case JSType::JS_BIGUINT64_ARRAY:
227 return "BigUint64 Array";
228 case JSType::BYTE_ARRAY:
229 return "ByteArray";
230 case JSType::JS_ARGUMENTS:
231 return "Arguments";
232 case JSType::JS_PROXY:
233 return "Proxy";
234 case JSType::JS_PRIMITIVE_REF:
235 return "Primitive";
236 case JSType::JS_DATA_VIEW:
237 return "DataView";
238 case JSType::JS_ITERATOR:
239 return "Iterator";
240 case JSType::JS_ASYNCITERATOR:
241 return "AsyncIterator";
242 case JSType::JS_FORIN_ITERATOR:
243 return "ForinInterator";
244 case JSType::JS_MAP_ITERATOR:
245 return "MapIterator";
246 case JSType::JS_SET_ITERATOR:
247 return "SetIterator";
248 case JSType::JS_ARRAY_ITERATOR:
249 return "ArrayIterator";
250 case JSType::JS_STRING_ITERATOR:
251 return "StringIterator";
252 case JSType::JS_REG_EXP_ITERATOR:
253 return "RegExpIterator";
254 case JSType::JS_ARRAY_BUFFER:
255 return "ArrayBuffer";
256 case JSType::JS_SHARED_ARRAY_BUFFER:
257 return "SharedArrayBuffer";
258 case JSType::JS_PROXY_REVOC_FUNCTION:
259 return "ProxyRevocFunction";
260 case JSType::PROMISE_REACTIONS:
261 return "PromiseReaction";
262 case JSType::PROMISE_CAPABILITY:
263 return "PromiseCapability";
264 case JSType::PROMISE_ITERATOR_RECORD:
265 return "PromiseIteratorRecord";
266 case JSType::PROMISE_RECORD:
267 return "PromiseRecord";
268 case JSType::RESOLVING_FUNCTIONS_RECORD:
269 return "ResolvingFunctionsRecord";
270 case JSType::ASYNC_GENERATOR_REQUEST:
271 return "AsyncGeneratorRequest";
272 case JSType::ASYNC_ITERATOR_RECORD:
273 return "AsyncIteratorRecord";
274 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR:
275 return "AsyncFromSyncIterator";
276 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION:
277 return "AsyncFromSyncIterUnwarpFunction";
278 case JSType::JS_PROMISE:
279 return "Promise";
280 case JSType::JS_PROMISE_REACTIONS_FUNCTION:
281 return "PromiseReactionsFunction";
282 case JSType::JS_PROMISE_EXECUTOR_FUNCTION:
283 return "PromiseExecutorFunction";
284 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION:
285 return "PromiseAllResolveElementFunction";
286 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION:
287 return "PromiseAnyRejectElementFunction";
288 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION:
289 return "PromiseAllSettledElementFunction";
290 case JSType::JS_PROMISE_FINALLY_FUNCTION:
291 return "PromiseFinallyFunction";
292 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION:
293 return "PromiseValueThunkOrThrowerFunction";
294 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN:
295 return "AsyncGeneratorResumeNextReturnProcessorRstFtn";
296 case JSType::MICRO_JOB_QUEUE:
297 return "MicroJobQueue";
298 case JSType::PENDING_JOB:
299 return "PendingJob";
300 case JSType::COMPLETION_RECORD:
301 return "CompletionRecord";
302 case JSType::GLOBAL_ENV:
303 return "GlobalEnv";
304 case JSType::ACCESSOR_DATA:
305 return "AccessorData";
306 case JSType::INTERNAL_ACCESSOR:
307 return "InternalAccessor";
308 case JSType::SYMBOL:
309 return "Symbol";
310 case JSType::PROPERTY_BOX:
311 return "PropertyBox";
312 case JSType::JS_ASYNC_FUNCTION:
313 return "AsyncFunction";
314 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION:
315 return "AsyncAwaitStatusFunction";
316 case JSType::JS_ASYNC_FUNC_OBJECT:
317 return "AsyncFunctionObject";
318 case JSType::JS_REALM:
319 return "Realm";
320 case JSType::JS_GLOBAL_OBJECT:
321 return "GlobalObject";
322 case JSType::JS_INTL:
323 return "JSIntl";
324 case JSType::JS_LOCALE:
325 return "JSLocale";
326 case JSType::JS_DATE_TIME_FORMAT:
327 return "JSDateTimeFormat";
328 case JSType::JS_RELATIVE_TIME_FORMAT:
329 return "JSRelativeTimeFormat";
330 case JSType::JS_NUMBER_FORMAT:
331 return "JSNumberFormat";
332 case JSType::JS_COLLATOR:
333 return "JSCollator";
334 case JSType::JS_PLURAL_RULES:
335 return "JSPluralRules";
336 case JSType::JS_DISPLAYNAMES:
337 return "JSDisplayNames";
338 case JSType::JS_LIST_FORMAT:
339 return "JSListFormat";
340 case JSType::JS_GENERATOR_OBJECT:
341 return "JSGeneratorObject";
342 case JSType::JS_ASYNC_GENERATOR_OBJECT:
343 return "JSAsyncGeneratorObject";
344 case JSType::JS_GENERATOR_CONTEXT:
345 return "JSGeneratorContext";
346 case JSType::PROTO_CHANGE_MARKER:
347 return "ProtoChangeMarker";
348 case JSType::PROTOTYPE_INFO:
349 return "PrototypeInfo";
350 case JSType::PROGRAM:
351 return "program";
352 case JSType::MACHINE_CODE_OBJECT:
353 return "MachineCode";
354 case JSType::CLASS_INFO_EXTRACTOR:
355 return "ClassInfoExtractor";
356 case JSType::JS_API_ARRAY_LIST:
357 return "ArrayList";
358 case JSType::TS_OBJECT_TYPE:
359 return "TSObjectType";
360 case JSType::TS_CLASS_TYPE:
361 return "TSClassType";
362 case JSType::TS_INTERFACE_TYPE:
363 return "TSInterfaceType";
364 case JSType::TS_CLASS_INSTANCE_TYPE:
365 return "TSClassInstanceType";
366 case JSType::TS_UNION_TYPE:
367 return "TSUnionType";
368 case JSType::TS_FUNCTION_TYPE:
369 return "TSFunctionType";
370 case JSType::TS_ARRAY_TYPE:
371 return "TSArrayType";
372 case JSType::TS_ITERATOR_INSTANCE_TYPE:
373 return "TSIteratorInstanceType";
374 case JSType::TS_NAMESPACE_TYPE:
375 return "TSNamespaceType";
376 case JSType::JS_API_ARRAYLIST_ITERATOR:
377 return "JSArraylistIterator";
378 case JSType::LINKED_NODE:
379 return "LinkedNode";
380 case JSType::RB_TREENODE:
381 return "RBTreeNode";
382 case JSType::JS_API_HASH_MAP:
383 return "HashMap";
384 case JSType::JS_API_HASH_SET:
385 return "HashSet";
386 case JSType::JS_API_HASHMAP_ITERATOR:
387 return "HashMapIterator";
388 case JSType::JS_API_HASHSET_ITERATOR:
389 return "HashSetIterator";
390 case JSType::JS_API_LIGHT_WEIGHT_MAP:
391 return "LightWeightMap";
392 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR:
393 return "LightWeightMapIterator";
394 case JSType::JS_API_LIGHT_WEIGHT_SET:
395 return "LightWeightSet";
396 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR:
397 return "LightWeightSetIterator";
398 case JSType::JS_API_TREE_MAP:
399 return "TreeMap";
400 case JSType::JS_API_TREE_SET:
401 return "TreeSet";
402 case JSType::JS_API_TREEMAP_ITERATOR:
403 return "TreeMapIterator";
404 case JSType::JS_API_TREESET_ITERATOR:
405 return "TreeSetIterator";
406 case JSType::JS_API_VECTOR:
407 return "Vector";
408 case JSType::JS_API_VECTOR_ITERATOR:
409 return "VectorIterator";
410 case JSType::JS_API_QUEUE:
411 return "Queue";
412 case JSType::JS_API_QUEUE_ITERATOR:
413 return "QueueIterator";
414 case JSType::JS_API_PLAIN_ARRAY:
415 return "PlainArray";
416 case JSType::JS_API_PLAIN_ARRAY_ITERATOR:
417 return "PlainArrayIterator";
418 case JSType::JS_API_DEQUE:
419 return "Deque";
420 case JSType::JS_API_DEQUE_ITERATOR:
421 return "DequeIterator";
422 case JSType::JS_API_STACK:
423 return "Stack";
424 case JSType::JS_API_STACK_ITERATOR:
425 return "StackIterator";
426 case JSType::JS_API_LIST:
427 return "List";
428 case JSType::JS_API_LIST_ITERATOR:
429 return "ListIterator";
430 case JSType::JS_API_LINKED_LIST:
431 return "LinkedList";
432 case JSType::JS_API_LINKED_LIST_ITERATOR:
433 return "LinkedListIterator";
434 case JSType::JS_CJS_EXPORTS:
435 return "CommonJSExports";
436 case JSType::JS_CJS_MODULE:
437 return "CommonJSModule";
438 case JSType::JS_CJS_REQUIRE:
439 return "CommonJSRequire";
440 case JSType::METHOD:
441 return "Method";
442 case JSType::AOT_LITERAL_INFO:
443 return "AOTLiteralInfo";
444 case JSType::CLASS_LITERAL:
445 return "ClassLiteral";
446 case JSType::VTABLE:
447 return "VTable";
448 case JSType::SOURCE_TEXT_MODULE_RECORD:
449 return "SourceTextModuleRecord";
450 case JSType::RESOLVEDBINDING_RECORD:
451 return "ResolvedBingingRecord";
452 case JSType::RESOLVEDINDEXBINDING_RECORD:
453 return "ResolvedIndexBingingRecord";
454 case JSType::IMPORTENTRY_RECORD:
455 return "ImportEntry";
456 case JSType::LOCAL_EXPORTENTRY_RECORD:
457 return "LocalExportEntry";
458 case JSType::STAR_EXPORTENTRY_RECORD:
459 return "StarExportEntry";
460 default: {
461 CString ret = "unknown type ";
462 return ret + static_cast<char>(type);
463 }
464 }
465 }
466
DumpArrayClass(const TaggedArray * arr,std::ostream & os)467 static void DumpArrayClass(const TaggedArray *arr, std::ostream &os)
468 {
469 DISALLOW_GARBAGE_COLLECTION;
470 uint32_t len = arr->GetLength();
471 os << " <TaggedArray[" << std::dec << len << "]>\n";
472 for (uint32_t i = 0; i < len; i++) {
473 JSTaggedValue val(arr->Get(i));
474 if (!val.IsHole()) {
475 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
476 val.DumpTaggedValue(os);
477 os << "\n";
478 }
479 }
480 }
481
DumpConstantPoolClass(const ConstantPool * pool,std::ostream & os)482 static void DumpConstantPoolClass(const ConstantPool *pool, std::ostream &os)
483 {
484 DISALLOW_GARBAGE_COLLECTION;
485 uint32_t len = pool->GetCacheLength();
486 os << " <ConstantPool[" << std::dec << len << "]>\n";
487 for (uint32_t i = 0; i < len; i++) {
488 JSTaggedValue val(pool->GetObjectFromCache(i));
489 if (!val.IsHole()) {
490 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
491 val.DumpTaggedValue(os);
492 os << "\n";
493 }
494 }
495 }
496
DumpStringClass(const EcmaString * str,std::ostream & os)497 static void DumpStringClass(const EcmaString *str, std::ostream &os)
498 {
499 DISALLOW_GARBAGE_COLLECTION;
500 CString string = ConvertToString(str);
501 os << string;
502 }
503
DumpPropertyKey(JSTaggedValue key,std::ostream & os)504 static void DumpPropertyKey(JSTaggedValue key, std::ostream &os)
505 {
506 if (key.IsString()) {
507 DumpStringClass(EcmaString::Cast(key.GetTaggedObject()), os);
508 } else if (key.IsSymbol()) {
509 JSSymbol *sym = JSSymbol::Cast(key.GetTaggedObject());
510 DumpStringClass(EcmaString::Cast(sym->GetDescription().GetTaggedObject()), os);
511 } else {
512 LOG_ECMA(FATAL) << "this branch is unreachable";
513 UNREACHABLE();
514 }
515 }
516
DumpHClass(const JSHClass * jshclass,std::ostream & os,bool withDetail)517 static void DumpHClass(const JSHClass *jshclass, std::ostream &os, bool withDetail)
518 {
519 DISALLOW_GARBAGE_COLLECTION;
520 os << "JSHClass :" << std::setw(DUMP_TYPE_OFFSET);
521 os << "Type :" << JSHClass::DumpJSType(jshclass->GetObjectType()) << "\n";
522
523 os << " - Prototype :" << std::setw(DUMP_TYPE_OFFSET);
524 jshclass->GetPrototype().DumpTaggedValue(os);
525 os << "\n";
526 os << " - PropertyDescriptors :" << std::setw(DUMP_TYPE_OFFSET);
527 JSTaggedValue attrs = jshclass->GetLayout();
528 attrs.DumpTaggedValue(os);
529 os << "\n";
530 if (withDetail && !attrs.IsNull()) {
531 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
532 layoutInfo->Dump(os);
533 }
534
535 os << " - Transitions :" << std::setw(DUMP_TYPE_OFFSET);
536 JSTaggedValue transtions = jshclass->GetTransitions();
537 transtions.DumpTaggedValue(os);
538 os << "\n";
539 if (withDetail && !transtions.IsWeakForHeapObject() && transtions.IsDictionary()) {
540 transtions.Dump(os);
541 }
542
543 os << " - ProtoChangeMarker :" << std::setw(DUMP_TYPE_OFFSET);
544 JSTaggedValue marker = jshclass->GetProtoChangeMarker();
545 marker.DumpTaggedValue(os);
546 if (marker.IsHeapObject()) {
547 ProtoChangeMarker::Cast(marker.GetTaggedObject())->Dump(os);
548 } else {
549 os << "\n";
550 }
551
552 os << " - ProtoChangeDetails :" << std::setw(DUMP_TYPE_OFFSET);
553 JSTaggedValue details = jshclass->GetProtoChangeDetails();
554 details.DumpTaggedValue(os);
555 if (details.IsHeapObject()) {
556 ProtoChangeDetails::Cast(details.GetTaggedObject())->Dump(os);
557 } else {
558 os << "\n";
559 }
560
561 JSTaggedValue supers = jshclass->GetSupers();
562 uint32_t length = 0;
563 if (supers.IsTaggedArray()) {
564 length = WeakVector::Cast(supers.GetTaggedObject())->GetExtraLength();
565 }
566 os << " - Supers[" << std::dec << length << "]: ";
567 os << std::setw(DUMP_TYPE_OFFSET);
568 supers.DumpTaggedValue(os);
569 if (withDetail && !supers.IsUndefined()) {
570 WeakVector::Cast(supers.GetTaggedObject())->Dump(os);
571 } else {
572 os << "\n";
573 }
574
575 os << " - VTable :" << std::setw(DUMP_TYPE_OFFSET);
576 JSTaggedValue vtable = jshclass->GetVTable();
577 vtable.DumpTaggedValue(os);
578 if (withDetail && !vtable.IsUndefined()) {
579 VTable::Cast(vtable.GetTaggedObject())->Dump(os);
580 } else {
581 os << "\n";
582 }
583
584 os << " - Flags : " << std::setw(DUMP_TYPE_OFFSET);
585 os << "IsCtor :" << std::boolalpha << jshclass->IsConstructor();
586 os << "| IsCallable :" << std::boolalpha << jshclass->IsCallable();
587 os << "| IsExtensible :" << std::boolalpha << jshclass->IsExtensible();
588 os << "| ElementsKind :" << Elements::GetString(jshclass->GetElementsKind());
589 os << "| NumberOfProps :" << std::dec << jshclass->NumberOfProps();
590 os << "| InlinedProperties :" << std::dec << jshclass->GetInlinedProperties();
591 os << "| IsTS :" << std::boolalpha << jshclass->IsTS();
592 os << "| Level :" << std::dec << static_cast<int>(jshclass->GetLevel());
593 os << "\n";
594 }
595
DumpClass(TaggedObject * obj,std::ostream & os)596 static void DumpClass(TaggedObject *obj, std::ostream &os)
597 {
598 ASSERT(obj->GetClass()->GetObjectType() == JSType::HCLASS);
599 DumpHClass(JSHClass::Cast(obj), os, true);
600 }
601
DumpAttr(const PropertyAttributes & attr,bool fastMode,std::ostream & os)602 static void DumpAttr(const PropertyAttributes &attr, bool fastMode, std::ostream &os)
603 {
604 if (attr.IsAccessor()) {
605 os << "(Accessor) ";
606 }
607
608 os << "Attr(";
609 if (attr.IsNoneAttributes()) {
610 os << "NONE";
611 }
612 if (attr.IsWritable()) {
613 os << "W";
614 }
615 if (attr.IsEnumerable()) {
616 os << "E";
617 }
618 if (attr.IsConfigurable()) {
619 os << "C";
620 }
621 os << ")";
622
623 os << " InlinedProps: " << attr.IsInlinedProps();
624
625 if (fastMode) {
626 os << " Order: " << std::dec << attr.GetOffset();
627 os << " SortedIndex: " << std::dec << attr.GetSortedIndex();
628 } else {
629 os << " Order: " << std::dec << attr.GetDictionaryOrder();
630 }
631 }
632
DumpObject(TaggedObject * obj,std::ostream & os)633 static void DumpObject(TaggedObject *obj, std::ostream &os)
634 {
635 DISALLOW_GARBAGE_COLLECTION;
636 auto jsHclass = obj->GetClass();
637 JSType type = jsHclass->GetObjectType();
638
639 bool needDumpHClass = false;
640 switch (type) {
641 case JSType::HCLASS:
642 return DumpClass(obj, os);
643 case JSType::TAGGED_ARRAY:
644 case JSType::TAGGED_DICTIONARY:
645 case JSType::TEMPLATE_MAP:
646 case JSType::LEXICAL_ENV:
647 case JSType::COW_TAGGED_ARRAY:
648 case JSType::AOT_LITERAL_INFO:
649 DumpArrayClass(TaggedArray::Cast(obj), os);
650 break;
651 case JSType::CONSTANT_POOL:
652 DumpConstantPoolClass(ConstantPool::Cast(obj), os);
653 break;
654 case JSType::VTABLE:
655 VTable::Cast(obj)->Dump(os);
656 break;
657 case JSType::LINE_STRING:
658 case JSType::CONSTANT_STRING:
659 case JSType::TREE_STRING:
660 DumpStringClass(EcmaString::Cast(obj), os);
661 os << "\n";
662 break;
663 case JSType::JS_NATIVE_POINTER:
664 break;
665 case JSType::JS_OBJECT:
666 case JSType::JS_GLOBAL_OBJECT:
667 case JSType::JS_ERROR:
668 case JSType::JS_EVAL_ERROR:
669 case JSType::JS_RANGE_ERROR:
670 case JSType::JS_TYPE_ERROR:
671 case JSType::JS_AGGREGATE_ERROR:
672 case JSType::JS_REFERENCE_ERROR:
673 case JSType::JS_URI_ERROR:
674 case JSType::JS_SYNTAX_ERROR:
675 case JSType::JS_OOM_ERROR:
676 case JSType::JS_ARGUMENTS:
677 needDumpHClass = true;
678 JSObject::Cast(obj)->Dump(os);
679 break;
680 case JSType::JS_FUNCTION_BASE:
681 needDumpHClass = true;
682 JSFunctionBase::Cast(obj)->Dump(os);
683 break;
684 case JSType::GLOBAL_ENV:
685 GlobalEnv::Cast(obj)->Dump(os);
686 break;
687 case JSType::ACCESSOR_DATA:
688 break;
689 case JSType::JS_FUNCTION:
690 needDumpHClass = true;
691 JSFunction::Cast(obj)->Dump(os);
692 break;
693 case JSType::JS_BOUND_FUNCTION:
694 needDumpHClass = true;
695 JSBoundFunction::Cast(obj)->Dump(os);
696 break;
697 case JSType::JS_SET:
698 needDumpHClass = true;
699 JSSet::Cast(obj)->Dump(os);
700 break;
701 case JSType::JS_MAP:
702 needDumpHClass = true;
703 JSMap::Cast(obj)->Dump(os);
704 break;
705 case JSType::JS_WEAK_SET:
706 needDumpHClass = true;
707 JSWeakSet::Cast(obj)->Dump(os);
708 break;
709 case JSType::JS_WEAK_MAP:
710 needDumpHClass = true;
711 JSWeakMap::Cast(obj)->Dump(os);
712 break;
713 case JSType::JS_WEAK_REF:
714 needDumpHClass = true;
715 JSWeakRef::Cast(obj)->Dump(os);
716 break;
717 case JSType::JS_FINALIZATION_REGISTRY:
718 JSFinalizationRegistry::Cast(obj)->Dump(os);
719 break;
720 case JSType::CELL_RECORD:
721 CellRecord::Cast(obj)->Dump(os);
722 break;
723 case JSType::JS_REG_EXP:
724 needDumpHClass = true;
725 JSRegExp::Cast(obj)->Dump(os);
726 break;
727 case JSType::JS_DATE:
728 needDumpHClass = true;
729 JSDate::Cast(obj)->Dump(os);
730 break;
731 case JSType::JS_ARRAY:
732 needDumpHClass = true;
733 JSArray::Cast(obj)->Dump(os);
734 break;
735 case JSType::JS_TYPED_ARRAY:
736 case JSType::JS_INT8_ARRAY:
737 case JSType::JS_UINT8_ARRAY:
738 case JSType::JS_UINT8_CLAMPED_ARRAY:
739 case JSType::JS_INT16_ARRAY:
740 case JSType::JS_UINT16_ARRAY:
741 case JSType::JS_INT32_ARRAY:
742 case JSType::JS_UINT32_ARRAY:
743 case JSType::JS_FLOAT32_ARRAY:
744 case JSType::JS_FLOAT64_ARRAY:
745 case JSType::JS_BIGINT64_ARRAY:
746 case JSType::JS_BIGUINT64_ARRAY:
747 needDumpHClass = true;
748 JSTypedArray::Cast(obj)->Dump(os);
749 break;
750 case JSType::BIGINT:
751 BigInt::Cast(obj)->Dump(os);
752 break;
753 case JSType::BYTE_ARRAY:
754 ByteArray::Cast(obj)->Dump(os);
755 break;
756 case JSType::JS_PROXY:
757 needDumpHClass = true;
758 JSProxy::Cast(obj)->Dump(os);
759 break;
760 case JSType::JS_PRIMITIVE_REF:
761 JSPrimitiveRef::Cast(obj)->Dump(os);
762 break;
763 case JSType::SYMBOL:
764 JSSymbol::Cast(obj)->Dump(os);
765 break;
766 case JSType::JS_DATA_VIEW:
767 JSDataView::Cast(obj)->Dump(os);
768 break;
769 case JSType::JS_ARRAY_BUFFER:
770 JSArrayBuffer::Cast(obj)->Dump(os);
771 break;
772 case JSType::JS_SHARED_ARRAY_BUFFER:
773 JSArrayBuffer::Cast(obj)->Dump(os);
774 break;
775 case JSType::PROMISE_REACTIONS:
776 PromiseReaction::Cast(obj)->Dump(os);
777 break;
778 case JSType::PROMISE_CAPABILITY:
779 PromiseCapability::Cast(obj)->Dump(os);
780 break;
781 case JSType::PROMISE_ITERATOR_RECORD:
782 PromiseIteratorRecord::Cast(obj)->Dump(os);
783 break;
784 case JSType::PROMISE_RECORD:
785 PromiseRecord::Cast(obj)->Dump(os);
786 break;
787 case JSType::RESOLVING_FUNCTIONS_RECORD:
788 ResolvingFunctionsRecord::Cast(obj)->Dump(os);
789 break;
790 case JSType::JS_PROMISE:
791 needDumpHClass = true;
792 JSPromise::Cast(obj)->Dump(os);
793 break;
794 case JSType::JS_PROMISE_REACTIONS_FUNCTION:
795 JSPromiseReactionsFunction::Cast(obj)->Dump(os);
796 break;
797 case JSType::JS_PROMISE_EXECUTOR_FUNCTION:
798 JSPromiseExecutorFunction::Cast(obj)->Dump(os);
799 break;
800 case JSType::ASYNC_GENERATOR_REQUEST:
801 AsyncGeneratorRequest::Cast(obj)->Dump(os);
802 break;
803 case JSType::ASYNC_ITERATOR_RECORD:
804 AsyncIteratorRecord::Cast(obj)->Dump(os);
805 break;
806 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR:
807 JSAsyncFromSyncIterator::Cast(obj)->Dump(os);
808 break;
809 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION:
810 JSAsyncFromSyncIterUnwarpFunction::Cast(obj)->Dump(os);
811 break;
812 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION:
813 JSPromiseAllResolveElementFunction::Cast(obj)->Dump(os);
814 break;
815 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION:
816 JSPromiseAnyRejectElementFunction::Cast(obj)->Dump(os);
817 break;
818 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION:
819 JSPromiseAllSettledElementFunction::Cast(obj)->Dump(os);
820 break;
821 case JSType::JS_PROMISE_FINALLY_FUNCTION:
822 JSPromiseFinallyFunction::Cast(obj)->Dump(os);
823 break;
824 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION:
825 JSPromiseValueThunkOrThrowerFunction::Cast(obj)->Dump(os);
826 break;
827 case JSType::MICRO_JOB_QUEUE:
828 MicroJobQueue::Cast(obj)->Dump(os);
829 break;
830 case JSType::PENDING_JOB:
831 PendingJob::Cast(obj)->Dump(os);
832 break;
833 case JSType::COMPLETION_RECORD:
834 CompletionRecord::Cast(obj)->Dump(os);
835 break;
836 case JSType::JS_PROXY_REVOC_FUNCTION:
837 JSProxyRevocFunction::Cast(obj)->Dump(os);
838 break;
839 case JSType::JS_ASYNC_FUNCTION:
840 needDumpHClass = true;
841 JSAsyncFunction::Cast(obj)->Dump(os);
842 break;
843 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION:
844 JSAsyncAwaitStatusFunction::Cast(obj)->Dump(os);
845 break;
846 case JSType::JS_GENERATOR_FUNCTION:
847 JSGeneratorFunction::Cast(obj)->Dump(os);
848 break;
849 case JSType::JS_ASYNC_GENERATOR_FUNCTION:
850 needDumpHClass = true;
851 JSAsyncGeneratorFunction::Cast(obj)->Dump(os);
852 break;
853 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN:
854 JSAsyncGeneratorResNextRetProRstFtn::Cast(obj)->Dump(os);
855 break;
856 case JSType::JS_INTL_BOUND_FUNCTION:
857 JSIntlBoundFunction::Cast(obj)->Dump(os);
858 break;
859 case JSType::JS_ITERATOR:
860 break;
861 case JSType::JS_ASYNCITERATOR:
862 break;
863 case JSType::JS_FORIN_ITERATOR:
864 JSForInIterator::Cast(obj)->Dump(os);
865 break;
866 case JSType::JS_MAP_ITERATOR:
867 JSMapIterator::Cast(obj)->Dump(os);
868 break;
869 case JSType::JS_SET_ITERATOR:
870 JSSetIterator::Cast(obj)->Dump(os);
871 break;
872 case JSType::JS_REG_EXP_ITERATOR:
873 JSRegExpIterator::Cast(obj)->Dump(os);
874 break;
875 case JSType::JS_ARRAY_ITERATOR:
876 JSArrayIterator::Cast(obj)->Dump(os);
877 break;
878 case JSType::JS_STRING_ITERATOR:
879 JSStringIterator::Cast(obj)->Dump(os);
880 break;
881 case JSType::PROTOTYPE_HANDLER:
882 PrototypeHandler::Cast(obj)->Dump(os);
883 break;
884 case JSType::TRANSITION_HANDLER:
885 TransitionHandler::Cast(obj)->Dump(os);
886 break;
887 case JSType::TRANS_WITH_PROTO_HANDLER:
888 TransWithProtoHandler::Cast(obj)->Dump(os);
889 break;
890 case JSType::STORE_TS_HANDLER:
891 StoreTSHandler::Cast(obj)->Dump(os);
892 break;
893 case JSType::PROPERTY_BOX:
894 PropertyBox::Cast(obj)->Dump(os);
895 break;
896 case JSType::JS_REALM:
897 needDumpHClass = true;
898 JSRealm::Cast(obj)->Dump(os);
899 break;
900 #ifdef ARK_SUPPORT_INTL
901 case JSType::JS_INTL:
902 needDumpHClass = true;
903 JSIntl::Cast(obj)->Dump(os);
904 break;
905 case JSType::JS_LOCALE:
906 needDumpHClass = true;
907 JSLocale::Cast(obj)->Dump(os);
908 break;
909 case JSType::JS_DATE_TIME_FORMAT:
910 JSDateTimeFormat::Cast(obj)->Dump(os);
911 break;
912 case JSType::JS_RELATIVE_TIME_FORMAT:
913 JSRelativeTimeFormat::Cast(obj)->Dump(os);
914 break;
915 case JSType::JS_NUMBER_FORMAT:
916 JSNumberFormat::Cast(obj)->Dump(os);
917 break;
918 case JSType::JS_COLLATOR:
919 needDumpHClass = true;
920 JSCollator::Cast(obj)->Dump(os);
921 break;
922 case JSType::JS_PLURAL_RULES:
923 JSPluralRules::Cast(obj)->Dump(os);
924 break;
925 case JSType::JS_DISPLAYNAMES:
926 JSDisplayNames::Cast(obj)->Dump(os);
927 break;
928 case JSType::JS_LIST_FORMAT:
929 JSListFormat::Cast(obj)->Dump(os);
930 break;
931 #else
932 case JSType::JS_INTL:
933 case JSType::JS_LOCALE:
934 case JSType::JS_DATE_TIME_FORMAT:
935 case JSType::JS_RELATIVE_TIME_FORMAT:
936 case JSType::JS_NUMBER_FORMAT:
937 case JSType::JS_COLLATOR:
938 case JSType::JS_PLURAL_RULES:
939 case JSType::JS_DISPLAYNAMES:
940 case JSType::JS_LIST_FORMAT:
941 break;
942 #endif
943 case JSType::JS_GENERATOR_OBJECT:
944 needDumpHClass = true;
945 JSGeneratorObject::Cast(obj)->Dump(os);
946 break;
947 case JSType::JS_ASYNC_GENERATOR_OBJECT:
948 needDumpHClass = true;
949 JSAsyncGeneratorObject::Cast(obj)->Dump(os);
950 break;
951 case JSType::JS_ASYNC_FUNC_OBJECT:
952 needDumpHClass = true;
953 JSAsyncFuncObject::Cast(obj)->Dump(os);
954 break;
955 case JSType::JS_GENERATOR_CONTEXT:
956 GeneratorContext::Cast(obj)->Dump(os);
957 break;
958 case JSType::PROTOTYPE_INFO:
959 ProtoChangeDetails::Cast(obj)->Dump(os);
960 break;
961 case JSType::PROTO_CHANGE_MARKER:
962 ProtoChangeMarker::Cast(obj)->Dump(os);
963 break;
964 case JSType::PROGRAM:
965 Program::Cast(obj)->Dump(os);
966 break;
967 case JSType::MACHINE_CODE_OBJECT:
968 MachineCode::Cast(obj)->Dump(os);
969 break;
970 case JSType::CLASS_INFO_EXTRACTOR:
971 ClassInfoExtractor::Cast(obj)->Dump(os);
972 break;
973 case JSType::JS_API_ARRAY_LIST:
974 JSAPIArrayList::Cast(obj)->Dump(os);
975 break;
976 case JSType::JS_API_ARRAYLIST_ITERATOR:
977 JSAPIArrayListIterator::Cast(obj)->Dump(os);
978 break;
979 case JSType::JS_API_LIGHT_WEIGHT_MAP:
980 JSAPILightWeightMap::Cast(obj)->Dump(os);
981 break;
982 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR:
983 JSAPILightWeightMapIterator::Cast(obj)->Dump(os);
984 break;
985 case JSType::JS_API_LIGHT_WEIGHT_SET:
986 JSAPILightWeightSet::Cast(obj)->Dump(os);
987 break;
988 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR:
989 JSAPILightWeightSetIterator::Cast(obj)->Dump(os);
990 break;
991 case JSType::TS_OBJECT_TYPE:
992 TSObjectType::Cast(obj)->Dump(os);
993 break;
994 case JSType::TS_CLASS_TYPE:
995 TSClassType::Cast(obj)->Dump(os);
996 break;
997 case JSType::TS_INTERFACE_TYPE:
998 TSInterfaceType::Cast(obj)->Dump(os);
999 break;
1000 case JSType::TS_CLASS_INSTANCE_TYPE:
1001 TSClassInstanceType::Cast(obj)->Dump(os);
1002 break;
1003 case JSType::TS_UNION_TYPE:
1004 TSUnionType::Cast(obj)->Dump(os);
1005 break;
1006 case JSType::TS_FUNCTION_TYPE:
1007 TSFunctionType::Cast(obj)->Dump(os);
1008 break;
1009 case JSType::TS_ARRAY_TYPE:
1010 TSArrayType::Cast(obj)->Dump(os);
1011 break;
1012 case JSType::TS_ITERATOR_INSTANCE_TYPE:
1013 TSIteratorInstanceType::Cast(obj)->Dump(os);
1014 break;
1015 case JSType::TS_NAMESPACE_TYPE:
1016 TSNamespaceType::Cast(obj)->Dump(os);
1017 break;
1018 case JSType::LINKED_NODE:
1019 case JSType::RB_TREENODE:
1020 break;
1021 case JSType::JS_API_HASH_MAP:
1022 JSAPIHashMap::Cast(obj)->Dump(os);
1023 break;
1024 case JSType::JS_API_HASH_SET:
1025 JSAPIHashSet::Cast(obj)->Dump(os);
1026 break;
1027 case JSType::JS_API_HASHMAP_ITERATOR:
1028 JSAPIHashMapIterator::Cast(obj)->Dump(os);
1029 break;
1030 case JSType::JS_API_HASHSET_ITERATOR:
1031 JSAPIHashSetIterator::Cast(obj)->Dump(os);
1032 break;
1033 case JSType::JS_API_TREE_MAP:
1034 JSAPITreeMap::Cast(obj)->Dump(os);
1035 break;
1036 case JSType::JS_API_TREE_SET:
1037 JSAPITreeSet::Cast(obj)->Dump(os);
1038 break;
1039 case JSType::JS_API_TREEMAP_ITERATOR:
1040 JSAPITreeMapIterator::Cast(obj)->Dump(os);
1041 break;
1042 case JSType::JS_API_TREESET_ITERATOR:
1043 JSAPITreeSetIterator::Cast(obj)->Dump(os);
1044 break;
1045 case JSType::JS_API_VECTOR:
1046 JSAPIVector::Cast(obj)->Dump(os);
1047 break;
1048 case JSType::JS_API_VECTOR_ITERATOR:
1049 JSAPIVectorIterator::Cast(obj)->Dump(os);
1050 break;
1051 case JSType::JS_API_QUEUE:
1052 JSAPIQueue::Cast(obj)->Dump(os);
1053 break;
1054 case JSType::JS_API_QUEUE_ITERATOR:
1055 JSAPIQueueIterator::Cast(obj)->Dump(os);
1056 break;
1057 case JSType::JS_API_DEQUE:
1058 JSAPIDeque::Cast(obj)->Dump(os);
1059 break;
1060 case JSType::JS_API_DEQUE_ITERATOR:
1061 JSAPIDequeIterator::Cast(obj)->Dump(os);
1062 break;
1063 case JSType::JS_API_STACK:
1064 JSAPIStack::Cast(obj)->Dump(os);
1065 break;
1066 case JSType::JS_API_STACK_ITERATOR:
1067 JSAPIStackIterator::Cast(obj)->Dump(os);
1068 break;
1069 case JSType::JS_API_LIST:
1070 JSAPIList::Cast(obj)->Dump(os);
1071 break;
1072 case JSType::JS_API_LIST_ITERATOR:
1073 JSAPIListIterator::Cast(obj)->Dump(os);
1074 break;
1075 case JSType::JS_API_LINKED_LIST:
1076 JSAPILinkedList::Cast(obj)->Dump(os);
1077 break;
1078 case JSType::JS_API_LINKED_LIST_ITERATOR:
1079 JSAPILinkedListIterator::Cast(obj)->Dump(os);
1080 break;
1081 case JSType::SOURCE_TEXT_MODULE_RECORD:
1082 SourceTextModule::Cast(obj)->Dump(os);
1083 break;
1084 case JSType::IMPORTENTRY_RECORD:
1085 ImportEntry::Cast(obj)->Dump(os);
1086 break;
1087 case JSType::LOCAL_EXPORTENTRY_RECORD:
1088 LocalExportEntry::Cast(obj)->Dump(os);
1089 break;
1090 case JSType::INDIRECT_EXPORTENTRY_RECORD:
1091 IndirectExportEntry::Cast(obj)->Dump(os);
1092 break;
1093 case JSType::STAR_EXPORTENTRY_RECORD:
1094 StarExportEntry::Cast(obj)->Dump(os);
1095 break;
1096 case JSType::RESOLVEDBINDING_RECORD:
1097 ResolvedBinding::Cast(obj)->Dump(os);
1098 break;
1099 case JSType::RESOLVEDINDEXBINDING_RECORD:
1100 ResolvedIndexBinding::Cast(obj)->Dump(os);
1101 break;
1102 case JSType::JS_MODULE_NAMESPACE:
1103 ModuleNamespace::Cast(obj)->Dump(os);
1104 break;
1105 case JSType::JS_API_PLAIN_ARRAY:
1106 JSAPIPlainArray::Cast(obj)->Dump(os);
1107 break;
1108 case JSType::JS_API_PLAIN_ARRAY_ITERATOR:
1109 JSAPIPlainArrayIterator::Cast(obj)->Dump(os);
1110 break;
1111 case JSType::JS_CJS_MODULE:
1112 CjsModule::Cast(obj)->Dump(os);
1113 break;
1114 case JSType::JS_CJS_REQUIRE:
1115 CjsRequire::Cast(obj)->Dump(os);
1116 break;
1117 case JSType::JS_CJS_EXPORTS:
1118 CjsExports::Cast(obj)->Dump(os);
1119 break;
1120 case JSType::METHOD:
1121 Method::Cast(obj)->Dump(os);
1122 break;
1123 case JSType::CLASS_LITERAL:
1124 ClassLiteral::Cast(obj)->Dump(os);
1125 break;
1126 default:
1127 LOG_ECMA(FATAL) << "this branch is unreachable";
1128 UNREACHABLE();
1129 break;
1130 }
1131
1132 if (needDumpHClass) {
1133 DumpHClass(jsHclass, os, false);
1134 }
1135 }
1136
DumpSpecialValue(std::ostream & os) const1137 void JSTaggedValue::DumpSpecialValue(std::ostream &os) const
1138 {
1139 ASSERT(IsSpecial());
1140 os << "[Special Value] : ";
1141 switch (GetRawData()) {
1142 case VALUE_HOLE:
1143 os << "Hole";
1144 break;
1145 case VALUE_NULL:
1146 os << "Null";
1147 break;
1148 case VALUE_FALSE:
1149 os << "False";
1150 break;
1151 case VALUE_TRUE:
1152 os << "True";
1153 break;
1154 case VALUE_UNDEFINED:
1155 os << "Undefined";
1156 break;
1157 case VALUE_EXCEPTION:
1158 os << "Exception";
1159 break;
1160 default:
1161 LOG_ECMA(FATAL) << "this branch is unreachable";
1162 UNREACHABLE();
1163 break;
1164 }
1165 }
1166
DumpHeapObjectType(std::ostream & os) const1167 void JSTaggedValue::DumpHeapObjectType(std::ostream &os) const
1168 {
1169 ASSERT(IsWeak() || IsHeapObject());
1170 bool isWeak = IsWeak();
1171 TaggedObject *obj = isWeak ? GetTaggedWeakRef() : GetTaggedObject();
1172 if (isWeak) {
1173 os << " [Weak Ref] ";
1174 }
1175
1176 JSType type = obj->GetClass()->GetObjectType();
1177 if (type >= JSType::STRING_FIRST && type <= JSType::STRING_LAST) {
1178 CString string = ConvertToString(EcmaString::Cast(obj));
1179 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[" + string + "]";
1180 } else if (type == JSType::METHOD) {
1181 std::ostringstream address;
1182 address << obj;
1183 CString addrStr = CString(address.str());
1184 Method *method = Method::Cast(obj);
1185
1186 os << std::left << std::setw(DUMP_TYPE_OFFSET)
1187 << "[" + JSHClass::DumpJSType(type) + "(" + addrStr + "-" + method->GetMethodName() + ")]";
1188 } else {
1189 std::ostringstream address;
1190 address << obj;
1191 CString addrStr = CString(address.str());
1192
1193 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[" + JSHClass::DumpJSType(type) + "(" + addrStr + ")]";
1194 }
1195 }
1196
DumpTaggedValue(std::ostream & os) const1197 void JSTaggedValue::DumpTaggedValue(std::ostream &os) const
1198 {
1199 if (IsInt()) {
1200 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[Int] : " << std::hex << "0x" << GetInt() << std::dec << " ("
1201 << GetInt() << ")";
1202 } else if (IsDouble()) {
1203 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[Double] : " << GetDouble();
1204 } else if (IsSpecial()) {
1205 DumpSpecialValue(os);
1206 } else {
1207 DumpHeapObjectType(os);
1208 }
1209 }
1210
Dump(std::ostream & os) const1211 void JSTaggedValue::Dump(std::ostream &os) const
1212 {
1213 DumpTaggedValue(os);
1214 os << "\n";
1215
1216 if (IsHeapObject()) {
1217 TaggedObject *obj = IsWeak() ? GetTaggedWeakRef() : GetTaggedObject();
1218 DumpObject(obj, os);
1219 }
1220 }
1221
D() const1222 void JSTaggedValue::D() const
1223 {
1224 Dump(std::cout);
1225 }
1226
DV(JSTaggedType val)1227 void JSTaggedValue::DV(JSTaggedType val)
1228 {
1229 JSTaggedValue(val).D();
1230 }
1231
DumpStack()1232 void JSThread::DumpStack()
1233 {
1234 FrameHandler handler(this);
1235 handler.DumpStack(std::cout);
1236 }
1237
Dump(std::ostream & os) const1238 void NumberDictionary::Dump(std::ostream &os) const
1239 {
1240 DISALLOW_GARBAGE_COLLECTION;
1241 int size = Size();
1242 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1243 JSTaggedValue key(GetKey(hashIndex));
1244 if (!key.IsUndefined() && !key.IsHole()) {
1245 JSTaggedValue val(GetValue(hashIndex));
1246 os << std::right << std::setw(DUMP_PROPERTY_OFFSET)
1247 << static_cast<uint32_t>(JSTaggedNumber(key).GetNumber()) << ": ";
1248 val.DumpTaggedValue(os);
1249 os << " ";
1250 DumpAttr(GetAttributes(hashIndex), false, os);
1251 os << "\n";
1252 }
1253 }
1254 }
1255
Dump(std::ostream & os) const1256 void NameDictionary::Dump(std::ostream &os) const
1257 {
1258 DISALLOW_GARBAGE_COLLECTION;
1259 int size = Size();
1260 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1261 JSTaggedValue key(GetKey(hashIndex));
1262 if (!key.IsUndefined() && !key.IsHole()) {
1263 JSTaggedValue val(GetValue(hashIndex));
1264 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1265 DumpPropertyKey(key, os);
1266 os << ": ";
1267 val.DumpTaggedValue(os);
1268 os << " ";
1269 DumpAttr(GetAttributes(hashIndex), false, os);
1270 os << "\n";
1271 }
1272 }
1273 }
1274
Dump(std::ostream & os) const1275 void GlobalDictionary::Dump(std::ostream &os) const
1276 {
1277 DISALLOW_GARBAGE_COLLECTION;
1278 int size = Size();
1279 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1280 JSTaggedValue key(GetKey(hashIndex));
1281 if (!key.IsUndefined() && !key.IsHole()) {
1282 JSTaggedValue val(GetValue(hashIndex));
1283 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1284 DumpPropertyKey(key, os);
1285 os << " : ";
1286 val.DumpTaggedValue(os);
1287 os << " ";
1288 DumpAttr(GetAttributes(hashIndex), false, os);
1289 os << "\n";
1290 }
1291 }
1292 }
1293
Dump(std::ostream & os) const1294 void LayoutInfo::Dump(std::ostream &os) const
1295 {
1296 DISALLOW_GARBAGE_COLLECTION;
1297 int num = NumberOfElements();
1298 for (int i = 0; i < num; i++) {
1299 JSTaggedValue key = GetKey(i);
1300 PropertyAttributes attr = GetAttr(i);
1301 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1302 os << "[" << i << "]: ";
1303 DumpPropertyKey(key, os);
1304 os << " : ";
1305 DumpAttr(attr, true, os);
1306 os << "\n";
1307 }
1308 }
1309
Dump(std::ostream & os) const1310 void TransitionsDictionary::Dump(std::ostream &os) const
1311 {
1312 DISALLOW_GARBAGE_COLLECTION;
1313 int size = Size();
1314 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1315 JSTaggedValue key(GetKey(hashIndex));
1316 if (!key.IsUndefined() && !key.IsHole()) {
1317 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1318 DumpPropertyKey(key, os);
1319 os << " : ";
1320 GetValue(hashIndex).DumpTaggedValue(os);
1321 os << " : ";
1322 GetAttributes(hashIndex).DumpTaggedValue(os);
1323 os << "\n";
1324 }
1325 }
1326 }
1327
Dump(std::ostream & os) const1328 void LinkedHashSet::Dump(std::ostream &os) const
1329 {
1330 DISALLOW_GARBAGE_COLLECTION;
1331 int capacity = NumberOfElements() + NumberOfDeletedElements();
1332 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
1333 JSTaggedValue key(GetKey(hashIndex));
1334 if (!key.IsUndefined() && !key.IsHole()) {
1335 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1336 key.DumpTaggedValue(os);
1337 os << "\n";
1338 }
1339 }
1340 }
1341
Dump(std::ostream & os) const1342 void LinkedHashMap::Dump(std::ostream &os) const
1343 {
1344 DISALLOW_GARBAGE_COLLECTION;
1345 int capacity = NumberOfElements() + NumberOfDeletedElements();
1346 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
1347 JSTaggedValue key(GetKey(hashIndex));
1348 if (!key.IsUndefined() && !key.IsHole()) {
1349 JSTaggedValue val(GetValue(hashIndex));
1350 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1351 key.DumpTaggedValue(os);
1352 os << ": ";
1353 val.DumpTaggedValue(os);
1354 os << "\n";
1355 }
1356 }
1357 }
1358
Dump(std::ostream & os) const1359 void TaggedDoubleList::Dump(std::ostream &os) const
1360 {
1361 DISALLOW_GARBAGE_COLLECTION;
1362 int capacity = NumberOfNodes();
1363 os << " - node num: " << std::dec << capacity << "\n";
1364 os << " - delete node num: " << std::dec << NumberOfDeletedNodes() << "\n";
1365 os << "head-next: ";
1366 // 5 : 5 first element next ptr
1367 GetElement(5).D();
1368 os << "head-pre: ";
1369 // 6 : 6 first element per ptr
1370 GetElement(6).D();
1371 os << "\n";
1372 int i = 0;
1373 int next = GetElement(5).GetInt();
1374 while (capacity > i) {
1375 os << " value: ";
1376 GetElement(next).DumpTaggedValue(os);
1377 os << " next: ";
1378 // 1 : 1 current element next ptr offset
1379 GetElement(next + 1).D();
1380 os << " pre: ";
1381 // 2 : 2 current element pre ptr offset
1382 GetElement(next + 2).D();
1383 os << "\n";
1384 next = GetElement(next + 1).GetInt();
1385 i++;
1386 }
1387 }
1388
Dump(std::ostream & os) const1389 void TaggedSingleList::Dump(std::ostream &os) const
1390 {
1391 DISALLOW_GARBAGE_COLLECTION;
1392 int capacity = NumberOfNodes();
1393 os << "head-next: ";
1394 // 5 : 5 first element next ptr
1395 GetElement(5).D();
1396 os << "\n";
1397 int i = 0;
1398 int next = GetElement(5).GetInt();
1399 while (capacity > i) {
1400 os << " value: ";
1401 GetElement(next).DumpTaggedValue(os);
1402 os << " next: ";
1403 // 1 : 1 current element next ptr offset
1404 GetElement(next + 1).D();
1405 os << "\n";
1406 next = GetElement(next + 1).GetInt();
1407 i++;
1408 }
1409 }
1410
Dump(std::ostream & os) const1411 void JSObject::Dump(std::ostream &os) const
1412 {
1413 DISALLOW_GARBAGE_COLLECTION;
1414 JSHClass *jshclass = GetJSHClass();
1415 os << " - hclass: " << std::hex << jshclass << "\n";
1416 os << " - prototype: ";
1417 jshclass->GetPrototype().DumpTaggedValue(os);
1418 os << "\n";
1419
1420 TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject());
1421 os << " - elements: " << std::hex << elements;
1422 if (elements->GetLength() == 0) {
1423 os << " NONE\n";
1424 } else if (!elements->IsDictionaryMode()) {
1425 DumpArrayClass(elements, os);
1426 } else {
1427 NumberDictionary *dict = NumberDictionary::Cast(elements);
1428 os << " <NumberDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
1429 dict->Dump(os);
1430 }
1431
1432 TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject());
1433 os << " - properties: " << std::hex << properties;
1434 if (IsJSGlobalObject()) {
1435 GlobalDictionary *dict = GlobalDictionary::Cast(properties);
1436 os << " <GlobalDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
1437 dict->Dump(os);
1438 return;
1439 }
1440
1441 if (!properties->IsDictionaryMode()) {
1442 JSTaggedValue attrs = jshclass->GetLayout();
1443 if (attrs.IsNull()) {
1444 return;
1445 }
1446
1447 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
1448 int propNumber = static_cast<int>(jshclass->NumberOfProps());
1449 os << " <LayoutInfo[" << std::dec << propNumber << "]>\n";
1450 for (int i = 0; i < propNumber; i++) {
1451 JSTaggedValue key = layoutInfo->GetKey(i);
1452 PropertyAttributes attr = layoutInfo->GetAttr(i);
1453 ASSERT(i == static_cast<int>(attr.GetOffset()));
1454 os << " " << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1455 DumpPropertyKey(key, os);
1456 os << ": (";
1457 JSTaggedValue val;
1458 if (attr.IsInlinedProps()) {
1459 val = GetPropertyInlinedPropsWithRep(i, attr);
1460 } else {
1461 val = properties->Get(i - static_cast<int>(jshclass->GetInlinedProperties()));
1462 }
1463 val.DumpTaggedValue(os);
1464 os << ") ";
1465 DumpAttr(attr, true, os);
1466 os << "\n";
1467 }
1468 } else {
1469 NameDictionary *dict = NameDictionary::Cast(properties);
1470 os << " <NameDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
1471 dict->Dump(os);
1472 }
1473 }
1474
Dump(std::ostream & os) const1475 void TaggedArray::Dump(std::ostream &os) const
1476 {
1477 DumpArrayClass(this, os);
1478 }
1479
Dump(std::ostream & os) const1480 void AccessorData::Dump(std::ostream &os) const
1481 {
1482 auto *hclass = GetClass();
1483 if (hclass->GetObjectType() == JSType::INTERNAL_ACCESSOR) {
1484 os << " - Getter: " << reinterpret_cast<void *>(GetGetter().GetTaggedObject()) << "\n";
1485 os << " - Setter: " << reinterpret_cast<void *>(GetSetter().GetTaggedObject()) << "\n";
1486 return;
1487 }
1488
1489 os << " - Getter: ";
1490 GetGetter().DumpTaggedValue(os);
1491 os << "\n";
1492
1493 os << " - Setter: ";
1494 GetSetter().DumpTaggedValue(os);
1495 os << "\n";
1496 }
1497
Dump(std::ostream & os) const1498 void Program::Dump(std::ostream &os) const
1499 {
1500 os << " - MainFunction: ";
1501 GetMainFunction().Dump(os);
1502 os << "\n";
1503 }
1504
Dump(std::ostream & os) const1505 void ConstantPool::Dump(std::ostream &os) const
1506 {
1507 DumpArrayClass(this, os);
1508 }
1509
Dump(std::ostream & os) const1510 void VTable::Dump(std::ostream &os) const
1511 {
1512 DISALLOW_GARBAGE_COLLECTION;
1513 uint32_t num = GetNumberOfTuples();
1514
1515 for (uint32_t i = 0; i < num; i++) {
1516 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1517 os << "[" << i << "]: [ name :";
1518 JSTaggedValue name = GetTupleItem(i, VTable::TupleItem::NAME);
1519 DumpPropertyKey(name, os);
1520 os << ", type :" << (IsAccessor(i) ? "Accessor" : "Function");
1521 JSTaggedValue owner = GetTupleItem(i, VTable::TupleItem::OWNER);
1522 os << ", owner :";
1523 owner.DumpTaggedValue(os);
1524 JSTaggedValue offset = GetTupleItem(i, VTable::TupleItem::OFFSET);
1525 os << ", offset :" << offset.GetInt();
1526 os << " ] ";
1527 os << "\n";
1528 }
1529 }
1530
Dump(std::ostream & os) const1531 void JSFunction::Dump(std::ostream &os) const
1532 {
1533 os << " - ProtoOrHClass: ";
1534 GetProtoOrHClass().Dump(os);
1535 os << "\n";
1536 os << " - LexicalEnv: ";
1537 GetLexicalEnv().Dump(os);
1538 os << "\n";
1539 os << " - HomeObject: ";
1540 GetHomeObject().Dump(os);
1541 os << "\n";
1542 os << " - FunctionExtraInfo: ";
1543 GetFunctionExtraInfo().Dump(os);
1544 os << "\n";
1545 os << " - Module: ";
1546 GetModule().Dump(os);
1547 os << "\n";
1548 os << " - Method: ";
1549 GetMethod().Dump(os);
1550 os << "\n";
1551 JSObject::Dump(os);
1552 }
1553
Dump(std::ostream & os) const1554 void JSHClass::Dump(std::ostream &os) const
1555 {
1556 DumpHClass(this, os, true);
1557 }
1558
Dump(std::ostream & os) const1559 void JSBoundFunction::Dump(std::ostream &os) const
1560 {
1561 os << " - BoundTarget: ";
1562 GetBoundTarget().DumpTaggedValue(os);
1563 os << "\n";
1564
1565 os << " - BoundThis: ";
1566 GetBoundThis().DumpTaggedValue(os);
1567 os << "\n";
1568
1569 os << " - BoundArguments: ";
1570 GetBoundArguments().DumpTaggedValue(os);
1571 os << "\n";
1572
1573 JSObject::Dump(os);
1574 }
1575
Dump(std::ostream & os) const1576 void JSPrimitiveRef::Dump(std::ostream &os) const
1577 {
1578 os << " - SubValue : ";
1579 GetValue().DumpTaggedValue(os);
1580 os << "\n";
1581 JSObject::Dump(os);
1582 }
1583
Dump(std::ostream & os) const1584 void BigInt::Dump(std::ostream &os) const
1585 {
1586 os << " - length : " << GetLength() << "\n";
1587 os << " - Sign : " << GetSign() << "\n";
1588 os << " - value : " << ToStdString(DECIMAL) << "\n";
1589 }
1590
Dump(std::ostream & os) const1591 void JSDate::Dump(std::ostream &os) const
1592 {
1593 os << " - time: " << GetTime().GetDouble() << "\n";
1594 os << " - localOffset: " << GetLocalOffset().GetDouble() << "\n";
1595 JSObject::Dump(os);
1596 }
1597
Dump(std::ostream & os) const1598 void JSMap::Dump(std::ostream &os) const
1599 {
1600 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
1601 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1602 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1603 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1604 JSObject::Dump(os);
1605
1606 os << " <NameDictionary[" << map->NumberOfElements() << "]>\n";
1607 map->Dump(os);
1608 }
1609
Dump(std::ostream & os) const1610 void JSAPITreeMap::Dump(std::ostream &os) const
1611 {
1612 TaggedTreeMap *map = TaggedTreeMap::Cast(GetTreeMap().GetTaggedObject());
1613 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1614 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1615 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1616 JSObject::Dump(os);
1617
1618 os << " <TaggedTree[" << map->NumberOfElements() << "]>\n";
1619 map->Dump(os);
1620 }
1621
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const1622 void JSAPITreeMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
1623 {
1624 TaggedTreeMap *map = TaggedTreeMap::Cast(GetTreeMap().GetTaggedObject());
1625 map->DumpForSnapshot(vec);
1626
1627 JSObject::DumpForSnapshot(vec);
1628 }
1629
Dump(std::ostream & os) const1630 void JSAPITreeMapIterator::Dump(std::ostream &os) const
1631 {
1632 TaggedTreeMap *map =
1633 TaggedTreeMap::Cast(JSAPITreeMap::Cast(GetIteratedMap().GetTaggedObject())->GetTreeMap().GetTaggedObject());
1634 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1635 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1636 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1637 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1638 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1639 JSObject::Dump(os);
1640
1641 os << " <TaggedTree[" << map->NumberOfElements() << "]>\n";
1642 map->Dump(os);
1643 }
1644
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const1645 void JSAPITreeMapIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
1646 {
1647 TaggedTreeMap *map =
1648 TaggedTreeMap::Cast(JSAPITreeMap::Cast(GetIteratedMap().GetTaggedObject())->GetTreeMap().GetTaggedObject());
1649 map->DumpForSnapshot(vec);
1650 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
1651 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
1652 JSObject::DumpForSnapshot(vec);
1653 }
1654
1655 template <typename T>
DumpTaggedTreeEntry(T tree,std::ostream & os,int index,bool isMap=false)1656 void DumpTaggedTreeEntry(T tree, std::ostream &os, int index, bool isMap = false)
1657 {
1658 DISALLOW_GARBAGE_COLLECTION;
1659 JSTaggedValue parent(tree->GetParent(index));
1660 JSTaggedValue val(tree->GetValue(index));
1661 JSTaggedValue color(static_cast<int>(tree->GetColor(index)));
1662 JSTaggedValue left = tree->GetLeftChild(index);
1663 JSTaggedValue right = tree->GetRightChild(index);
1664 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": ";
1665 os << "\n";
1666 if (isMap) {
1667 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [key]: {";
1668 JSTaggedValue key(tree->GetKey(index));
1669 key.DumpTaggedValue(os);
1670 os << std::right << "};";
1671 os << "\n";
1672 }
1673 os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [value]: {";
1674 val.DumpTaggedValue(os);
1675 os << std::right << "};";
1676 os << "\n";
1677 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [parent]: {";
1678 parent.DumpTaggedValue(os);
1679 os << std::right << "};";
1680 os << "\n";
1681 os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [color]: {";
1682 color.DumpTaggedValue(os);
1683 os << std::right << "};";
1684 os << "\n";
1685 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [left]: {";
1686 left.DumpTaggedValue(os);
1687 os << std::right << "}; ";
1688 os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [right]: {";
1689 right.DumpTaggedValue(os);
1690 os << std::right << "};";
1691 os << "\n";
1692 }
Dump(std::ostream & os) const1693 void TaggedTreeMap::Dump(std::ostream &os) const
1694 {
1695 DISALLOW_GARBAGE_COLLECTION;
1696 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Elements]: {";
1697 JSTaggedValue node = TaggedArray::Get(0);
1698 node.DumpTaggedValue(os);
1699 os << std::right << "}" << "\n";
1700 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Delete]: {";
1701 node = TaggedArray::Get(1);
1702 node.DumpTaggedValue(os);
1703 os << std::right << "}" << "\n";
1704 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Capacity]: {";
1705 node = TaggedArray::Get(2); // 2 means the three element
1706 node.DumpTaggedValue(os);
1707 os << std::right << "}" << "\n";
1708 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[RootNode]: {";
1709 node = TaggedArray::Get(3); // 3 means the three element
1710 node.DumpTaggedValue(os);
1711 os << std::right << "}" << "\n";
1712
1713 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
1714 for (uint32_t index = 0; index < capacity; index++) {
1715 if (GetKey(index).IsHole()) {
1716 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": ";
1717 GetKey(index).DumpTaggedValue(os);
1718 os << "\n";
1719 } else {
1720 DumpTaggedTreeEntry(const_cast<TaggedTreeMap *>(this), os, index, true);
1721 }
1722 }
1723 }
1724
Dump(std::ostream & os) const1725 void JSAPITreeSet::Dump(std::ostream &os) const
1726 {
1727 TaggedTreeSet *set = TaggedTreeSet::Cast(GetTreeSet().GetTaggedObject());
1728 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1729 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1730 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1731 JSObject::Dump(os);
1732
1733 os << " <TaggedTree[" << set->NumberOfElements() << "]>\n";
1734 set->Dump(os);
1735 }
1736
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const1737 void JSAPITreeSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
1738 {
1739 TaggedTreeSet *set = TaggedTreeSet::Cast(GetTreeSet().GetTaggedObject());
1740 set->DumpForSnapshot(vec);
1741
1742 JSObject::DumpForSnapshot(vec);
1743 }
1744
Dump(std::ostream & os) const1745 void JSAPITreeSetIterator::Dump(std::ostream &os) const
1746 {
1747 TaggedTreeSet *set =
1748 TaggedTreeSet::Cast(JSAPITreeSet::Cast(GetIteratedSet().GetTaggedObject())->GetTreeSet().GetTaggedObject());
1749 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1750 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1751 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1752 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1753 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1754 JSObject::Dump(os);
1755
1756 os << " <TaggedTree[" << set->NumberOfElements() << "]>\n";
1757 set->Dump(os);
1758 }
1759
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const1760 void JSAPITreeSetIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
1761 {
1762 TaggedTreeSet *set =
1763 TaggedTreeSet::Cast(JSAPITreeSet::Cast(GetIteratedSet().GetTaggedObject())->GetTreeSet().GetTaggedObject());
1764 set->DumpForSnapshot(vec);
1765 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
1766 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
1767 JSObject::DumpForSnapshot(vec);
1768 }
1769
Dump(std::ostream & os) const1770 void TaggedTreeSet::Dump(std::ostream &os) const
1771 {
1772 DISALLOW_GARBAGE_COLLECTION;
1773 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Elements]: {";
1774 JSTaggedValue node = TaggedArray::Get(0);
1775 node.DumpTaggedValue(os);
1776 os << std::right << "}" << "\n";
1777 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Delete]: {";
1778 node = TaggedArray::Get(1);
1779 node.DumpTaggedValue(os);
1780 os << std::right << "}" << "\n";
1781 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Capacity]: {";
1782 node = TaggedArray::Get(2); // 2 means the three element
1783 node.DumpTaggedValue(os);
1784 os << std::right << "}" << "\n";
1785 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[RootNode]: {";
1786 node = TaggedArray::Get(3); // 3 means the three element
1787 node.DumpTaggedValue(os);
1788 os << std::right << "}" << "\n";
1789
1790 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
1791 for (uint32_t index = 0; index < capacity; index++) {
1792 if (GetKey(index).IsHole()) {
1793 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": ";
1794 GetKey(index).DumpTaggedValue(os);
1795 os << "\n";
1796 } else {
1797 DumpTaggedTreeEntry(const_cast<TaggedTreeSet *>(this), os, index);
1798 }
1799 }
1800 }
1801
Dump(std::ostream & os) const1802 void JSAPIPlainArray::Dump(std::ostream &os) const
1803 {
1804 TaggedArray *keys = TaggedArray::Cast(GetKeys().GetTaggedObject());
1805 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
1806 uint32_t len = static_cast<uint32_t>(GetLength());
1807 for (uint32_t i = 0; i < len; i++) {
1808 os << " - keys: ";
1809 keys->Get(i).DumpTaggedValue(os);
1810 os << "\n";
1811 os << " - values: ";
1812 values->Get(i).DumpTaggedValue(os);
1813 os << "\n";
1814 }
1815 os << " - length: " << std::dec << len << "\n";
1816 JSObject::Dump(os);
1817 }
1818
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const1819 void JSAPIPlainArray::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
1820 {
1821 JSObject::DumpForSnapshot(vec);
1822 }
1823
Dump(std::ostream & os) const1824 void JSAPIPlainArrayIterator::Dump(std::ostream &os) const
1825 {
1826 JSAPIPlainArray *array = JSAPIPlainArray::Cast(GetIteratedPlainArray().GetTaggedObject());
1827 os << " - length: " << std::dec << array->GetSize() << "\n";
1828 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1829 JSObject::Dump(os);
1830 }
1831
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const1832 void JSAPIPlainArrayIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
1833 {
1834 JSAPIPlainArray *array = JSAPIPlainArray::Cast(GetIteratedPlainArray().GetTaggedObject());
1835 array->DumpForSnapshot(vec);
1836 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
1837 JSObject::DumpForSnapshot(vec);
1838 }
1839
Dump(std::ostream & os) const1840 void JSForInIterator::Dump(std::ostream &os) const
1841 {
1842 os << " - Object : ";
1843 GetObject().DumpTaggedValue(os);
1844 os << "\n";
1845 os << " - WasVisited : " << GetWasVisited();
1846 os << "\n";
1847 os << " - VisitedObjs : ";
1848 GetVisitedObjs().DumpTaggedValue(os);
1849 os << "\n";
1850 os << " - RemainingKeys : ";
1851 GetRemainingKeys().DumpTaggedValue(os);
1852 os << "\n";
1853 JSObject::Dump(os);
1854 }
1855
Dump(std::ostream & os) const1856 void JSMapIterator::Dump(std::ostream &os) const
1857 {
1858 LinkedHashMap *map = LinkedHashMap::Cast(GetIteratedMap().GetTaggedObject());
1859 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1860 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1861 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1862 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1863 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1864 JSObject::Dump(os);
1865
1866 os << " <NameDictionary[" << map->NumberOfElements() << "]>\n";
1867 map->Dump(os);
1868 }
1869
Dump(std::ostream & os) const1870 void JSSet::Dump(std::ostream &os) const
1871 {
1872 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
1873 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1874 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1875 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1876 JSObject::Dump(os);
1877
1878 os << " <NameDictionary[" << set->NumberOfElements() << "]>\n";
1879 set->Dump(os);
1880 }
1881
Dump(std::ostream & os) const1882 void JSWeakMap::Dump(std::ostream &os) const
1883 {
1884 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
1885 os << " - length: " << std::dec << GetSize() << "\n";
1886 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1887 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1888 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1889 JSObject::Dump(os);
1890
1891 os << " <NameDictionary[" << map->NumberOfElements() << "]>\n";
1892 map->Dump(os);
1893 }
1894
Dump(std::ostream & os) const1895 void JSWeakSet::Dump(std::ostream &os) const
1896 {
1897 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
1898 os << " - size: " << std::dec << GetSize() << "\n";
1899 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1900 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1901 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1902 JSObject::Dump(os);
1903
1904 os << " <NameDictionary[" << set->NumberOfElements() << "]>\n";
1905 set->Dump(os);
1906 }
1907
Dump(std::ostream & os) const1908 void JSWeakRef::Dump(std::ostream &os) const
1909 {
1910 os << " - WeakObject : ";
1911 GetWeakObject().DumpTaggedValue(os);
1912 os << "\n";
1913 JSObject::Dump(os);
1914 }
1915
Dump(std::ostream & os) const1916 void JSFinalizationRegistry::Dump(std::ostream &os) const
1917 {
1918 os << " - CleanupCallback : ";
1919 GetCleanupCallback().DumpTaggedValue(os);
1920 os << "\n";
1921 os << " - NoUnregister : ";
1922 GetNoUnregister().D();
1923 os << "\n";
1924 os << " - MaybeUnregister : ";
1925 LinkedHashMap *map = LinkedHashMap::Cast(GetMaybeUnregister().GetTaggedObject());
1926 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1927 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1928 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1929 JSObject::Dump(os);
1930 }
1931
Dump(std::ostream & os) const1932 void CellRecord::Dump(std::ostream &os) const
1933 {
1934 os << " - WeakRefTarget : ";
1935 GetFromWeakRefTarget().DumpTaggedValue(os);
1936 os << "\n";
1937 os << " - HeldValue : ";
1938 GetHeldValue().DumpTaggedValue(os);
1939 os << "\n";
1940 }
1941
Dump(std::ostream & os) const1942 void JSSetIterator::Dump(std::ostream &os) const
1943 {
1944 LinkedHashSet *set = LinkedHashSet::Cast(GetIteratedSet().GetTaggedObject());
1945 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1946 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1947 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1948 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1949 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1950 JSObject::Dump(os);
1951
1952 os << " <NameDictionary[" << set->NumberOfElements() << "]>\n";
1953 set->Dump(os);
1954 }
1955
Dump(std::ostream & os) const1956 void JSRegExpIterator::Dump(std::ostream &os) const
1957 {
1958 os << " - IteratingRegExp: ";
1959 GetIteratingRegExp().D();
1960 os << "\n";
1961 os << " - IteratedString: ";
1962 GetIteratedString().D();
1963 os << "\n";
1964 os << " - Global: " << std::dec << GetGlobal() << "\n";
1965 os << " - Unicode: " << std::dec << GetUnicode() << "\n";
1966 os << " - Done: " << std::dec << GetDone() << "\n";
1967 JSObject::Dump(os);
1968 }
1969
Dump(std::ostream & os) const1970 void JSArray::Dump(std::ostream &os) const
1971 {
1972 os << " - length: " << std::dec << GetArrayLength() << "\n";
1973 JSObject::Dump(os);
1974 }
1975
Dump(std::ostream & os) const1976 void JSArrayIterator::Dump(std::ostream &os) const
1977 {
1978 JSArray *array = JSArray::Cast(GetIteratedArray().GetTaggedObject());
1979 os << " - length: " << std::dec << array->GetArrayLength() << "\n";
1980 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1981 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1982 JSObject::Dump(os);
1983 }
1984
Dump(std::ostream & os) const1985 void JSAPIArrayList::Dump(std::ostream &os) const
1986 {
1987 os << " - length: " << std::dec << GetSize() << "\n";
1988 JSObject::Dump(os);
1989 }
1990
Dump(std::ostream & os) const1991 void JSAPIArrayListIterator::Dump(std::ostream &os) const
1992 {
1993 JSAPIArrayList *arrayList = JSAPIArrayList::Cast(GetIteratedArrayList().GetTaggedObject());
1994 os << " - length: " << std::dec << arrayList->GetSize() << "\n";
1995 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1996 JSObject::Dump(os);
1997 }
1998
Dump(std::ostream & os) const1999 void JSAPIDeque::Dump(std::ostream &os) const
2000 {
2001 os << " - first: " << std::dec << GetFirst() << "\n";
2002 os << " - last: " << std::dec << GetLast() << "\n";
2003 JSObject::Dump(os);
2004 }
2005
Dump(std::ostream & os) const2006 void JSAPIDequeIterator::Dump(std::ostream &os) const
2007 {
2008 JSAPIDeque *deque = JSAPIDeque::Cast(GetIteratedDeque().GetTaggedObject());
2009 os << " - length: " << std::dec << deque->GetSize() << "\n";
2010 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2011 JSObject::Dump(os);
2012 }
2013
Dump(std::ostream & os) const2014 void JSAPILightWeightMap::Dump(std::ostream &os) const
2015 {
2016 uint32_t capacity = GetSize();
2017 os << " - length: " << std::dec << capacity << "\n";
2018 uint32_t i = 0;
2019 TaggedArray *hashArray = TaggedArray::Cast(GetHashes().GetTaggedObject());
2020 TaggedArray *keyArray = TaggedArray::Cast(GetKeys().GetTaggedObject());
2021 TaggedArray *valueArray = TaggedArray::Cast(GetValues().GetTaggedObject());
2022 while (capacity > i) {
2023 os << " hash: ";
2024 hashArray->Get(i).DumpTaggedValue(os);
2025 os << " key: ";
2026 keyArray->Get(i).DumpTaggedValue(os);
2027 os << " value: ";
2028 valueArray->Get(i).DumpTaggedValue(os);
2029 os << "\n";
2030 i++;
2031 }
2032 JSObject::Dump(os);
2033 }
2034
Dump(std::ostream & os) const2035 void JSAPILightWeightMapIterator::Dump(std::ostream &os) const
2036 {
2037 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2038 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2039 JSObject::Dump(os);
2040 }
2041
Dump(std::ostream & os) const2042 void JSAPIHashMap::Dump(std::ostream &os) const
2043 {
2044 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable().GetTaggedObject());
2045 os << " - elements: " << std::dec << GetSize() << "\n";
2046 os << " - table capacity: " << std::dec << static_cast<int>(hashArray->GetLength()) << "\n";
2047 JSObject::Dump(os);
2048 }
2049
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2050 void JSAPIHashMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2051 {
2052 JSObject::DumpForSnapshot(vec);
2053 }
2054
Dump(std::ostream & os) const2055 void JSAPIHashSet::Dump(std::ostream &os) const
2056 {
2057 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable().GetTaggedObject());
2058 os << " - elements: " << std::dec << GetSize() << "\n";
2059 os << " - table capacity: " << std::dec << static_cast<int>(hashArray->GetLength()) << "\n";
2060 JSObject::Dump(os);
2061 }
2062
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2063 void JSAPIHashSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2064 {
2065 JSObject::DumpForSnapshot(vec);
2066 }
2067
Dump(std::ostream & os) const2068 void JSAPIHashMapIterator::Dump(std::ostream &os) const
2069 {
2070 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2071 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2072 JSObject::Dump(os);
2073 }
2074
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2075 void JSAPIHashMapIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2076 {
2077 JSObject::DumpForSnapshot(vec);
2078 }
2079
Dump(std::ostream & os) const2080 void JSAPIHashSetIterator::Dump(std::ostream &os) const
2081 {
2082 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2083 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2084 JSObject::Dump(os);
2085 }
2086
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2087 void JSAPIHashSetIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2088 {
2089 JSObject::DumpForSnapshot(vec);
2090 }
2091
Dump(std::ostream & os) const2092 void JSAPILightWeightSet::Dump(std::ostream &os) const
2093 {
2094 TaggedArray *keys = TaggedArray::Cast(GetHashes().GetTaggedObject());
2095 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
2096 uint32_t len = GetLength();
2097 for (uint32_t i = 0; i < len; i++) {
2098 os << " - keys: ";
2099 keys->Get(i).DumpTaggedValue(os);
2100 os << "\n";
2101 os << " - values: ";
2102 values->Get(i).DumpTaggedValue(os);
2103 os << "\n";
2104 }
2105 os << " - length: " << std::dec << len << "\n";
2106 JSObject::Dump(os);
2107 }
2108
Dump(std::ostream & os) const2109 void JSAPILightWeightSetIterator::Dump(std::ostream &os) const
2110 {
2111 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2112 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2113 JSObject::Dump(os);
2114 }
2115
Dump(std::ostream & os) const2116 void JSAPIList::Dump(std::ostream &os) const
2117 {
2118 TaggedSingleList *list = TaggedSingleList::Cast(GetSingleList().GetTaggedObject());
2119 os << " - length: " << std::dec << list->GetCapacityFromTaggedArray() << "\n";
2120 os << " - node num: " << std::dec << list->NumberOfNodes() << "\n";
2121 os << " - delete node num: " << std::dec << list->NumberOfDeletedNodes() << "\n";
2122 JSObject::Dump(os);
2123 list->Dump(os);
2124 }
2125
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2126 void JSAPIList::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2127 {
2128 TaggedSingleList *map = TaggedSingleList::Cast(GetSingleList().GetTaggedObject());
2129 map->DumpForSnapshot(vec);
2130
2131 JSObject::DumpForSnapshot(vec);
2132 }
2133
Dump(std::ostream & os) const2134 void JSAPIListIterator::Dump(std::ostream &os) const
2135 {
2136 TaggedSingleList *list = TaggedSingleList::Cast(GetIteratedList().GetTaggedObject());
2137 os << " - length: " << std::dec << list->GetCapacityFromTaggedArray() << "\n";
2138 os << " - node num: " << std::dec << list->NumberOfNodes() << "\n";
2139 os << " - delete node num: " << std::dec << list->NumberOfDeletedNodes() << "\n";
2140 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2141 JSObject::Dump(os);
2142 list->Dump(os);
2143 }
2144
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2145 void JSAPIListIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2146 {
2147 TaggedSingleList *list = TaggedSingleList::Cast(GetIteratedList().GetTaggedObject());
2148 list->DumpForSnapshot(vec);
2149 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
2150 JSObject::DumpForSnapshot(vec);
2151 }
2152
Dump(std::ostream & os) const2153 void JSAPILinkedList::Dump(std::ostream &os) const
2154 {
2155 TaggedDoubleList *linkedList = TaggedDoubleList::Cast(GetDoubleList().GetTaggedObject());
2156 os << " - length: " << std::dec << linkedList->GetCapacityFromTaggedArray() << "\n";
2157 os << " - node num: " << std::dec << linkedList->NumberOfNodes() << "\n";
2158 os << " - delete node num: " << std::dec << linkedList->NumberOfDeletedNodes() << "\n";
2159 JSObject::Dump(os);
2160 linkedList->Dump(os);
2161 }
2162
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2163 void JSAPILinkedList::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2164 {
2165 TaggedDoubleList *map = TaggedDoubleList::Cast(GetDoubleList().GetTaggedObject());
2166 map->DumpForSnapshot(vec);
2167
2168 JSObject::DumpForSnapshot(vec);
2169 }
2170
Dump(std::ostream & os) const2171 void JSAPILinkedListIterator::Dump(std::ostream &os) const
2172 {
2173 TaggedDoubleList *linkedList = TaggedDoubleList::Cast(GetIteratedLinkedList().GetTaggedObject());
2174 os << " - length: " << std::dec << linkedList->GetCapacityFromTaggedArray() << "\n";
2175 os << " - node num: " << std::dec << linkedList->NumberOfNodes() << "\n";
2176 os << " - delete node num: " << std::dec << linkedList->NumberOfDeletedNodes() << "\n";
2177 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2178 JSObject::Dump(os);
2179 linkedList->Dump(os);
2180 }
2181
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const2182 void JSAPILinkedListIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
2183 {
2184 TaggedDoubleList *linkedList = TaggedDoubleList::Cast(GetIteratedLinkedList().GetTaggedObject());
2185 linkedList->DumpForSnapshot(vec);
2186 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
2187 JSObject::DumpForSnapshot(vec);
2188 }
2189
Dump(std::ostream & os) const2190 void JSAPIQueue::Dump(std::ostream &os) const
2191 {
2192 os << " - length: " << std::dec << GetSize() << "\n";
2193 os << " - front: " << std::dec << GetFront() << "\n";
2194 os << " - tail: " << std::dec << GetTail() << "\n";
2195 JSObject::Dump(os);
2196 }
2197
Dump(std::ostream & os) const2198 void JSAPIQueueIterator::Dump(std::ostream &os) const
2199 {
2200 JSAPIQueue *queue = JSAPIQueue::Cast(GetIteratedQueue().GetTaggedObject());
2201 os << " - length: " << std::dec << queue->GetSize() << "\n";
2202 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2203 JSObject::Dump(os);
2204 }
2205
Dump(std::ostream & os) const2206 void JSAPIStack::Dump(std::ostream &os) const
2207 {
2208 os << " - top: " << std::dec << GetTop() << "\n";
2209 JSObject::Dump(os);
2210 }
2211
Dump(std::ostream & os) const2212 void JSAPIStackIterator::Dump(std::ostream &os) const
2213 {
2214 JSAPIStack *stack = JSAPIStack::Cast(GetIteratedStack().GetTaggedObject());
2215 os << " - length: " << std::dec << stack->GetSize() << "\n";
2216 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2217 JSObject::Dump(os);
2218 }
2219
Dump(std::ostream & os) const2220 void JSAPIVector::Dump(std::ostream &os) const
2221 {
2222 os << " - length: " << std::dec << GetSize() << "\n";
2223 JSObject::Dump(os);
2224 }
2225
Dump(std::ostream & os) const2226 void JSAPIVectorIterator::Dump(std::ostream &os) const
2227 {
2228 JSAPIVector *vector = JSAPIVector::Cast(GetIteratedVector().GetTaggedObject());
2229 os << " - length: " << std::dec << vector->GetSize() << "\n";
2230 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2231 JSObject::Dump(os);
2232 }
2233
Dump(std::ostream & os) const2234 void JSStringIterator::Dump(std::ostream &os) const
2235 {
2236 EcmaString *str = EcmaString::Cast(GetIteratedString().GetTaggedObject());
2237 os << " - IteratedString: " << EcmaStringAccessor(str).ToCString() << "\n";
2238 os << " - StringIteratorNextIndex: " << std::dec << GetStringIteratorNextIndex() << "\n";
2239 JSObject::Dump(os);
2240 }
Dump(std::ostream & os) const2241 void JSTypedArray::Dump(std::ostream &os) const
2242 {
2243 os << " - viewed-array-buffer: ";
2244 GetViewedArrayBufferOrByteArray().Dump(os);
2245 os << " - typed-array-name: ";
2246 GetTypedArrayName().Dump(os);
2247 os << " - byte-length: " << GetByteLength();
2248 os << " - byte-offset: " << GetByteOffset();
2249 os << " - array-length: " << GetArrayLength();
2250 JSObject::Dump(os);
2251 }
2252
Dump(std::ostream & os) const2253 void ByteArray::Dump(std::ostream &os) const
2254 {
2255 os << " - array-length: " << GetArrayLength();
2256 os << " - byte-length: " << GetByteLength();
2257 }
2258
Dump(std::ostream & os) const2259 void JSRegExp::Dump(std::ostream &os) const
2260 {
2261 os << "\n";
2262 os << " - ByteCodeBuffer: ";
2263 GetByteCodeBuffer().D();
2264 os << "\n";
2265 os << " - OriginalSource: ";
2266 GetOriginalSource().D();
2267 os << "\n";
2268 os << " - OriginalFlags: ";
2269 GetOriginalFlags().D();
2270 os << "\n";
2271 os << " - GroupName: ";
2272 GetGroupName().D();
2273 os << "\n";
2274 os << " - Length: " << GetLength();
2275 os << "\n";
2276 JSObject::Dump(os);
2277 }
2278
Dump(std::ostream & os) const2279 void JSProxy::Dump(std::ostream &os) const
2280 {
2281 os << " - Target: ";
2282 os << "\n";
2283 JSObject::Cast(GetTarget().GetTaggedObject())->Dump(os);
2284 os << " - Handler: ";
2285 os << "\n";
2286 JSObject::Cast(GetHandler().GetTaggedObject())->Dump(os);
2287 os << "\n";
2288 }
2289
Dump(std::ostream & os) const2290 void JSSymbol::Dump(std::ostream &os) const
2291 {
2292 os << " - hash-field: " << GetHashField();
2293 os << "\n - flags: " << GetFlags();
2294 os << "\n - description: ";
2295 JSTaggedValue description = GetDescription();
2296 description.Dump(os);
2297 }
2298
Dump(std::ostream & os) const2299 void LexicalEnv::Dump(std::ostream &os) const
2300 {
2301 DumpArrayClass(this, os);
2302 }
2303
Dump(std::ostream & os) const2304 void COWTaggedArray::Dump(std::ostream &os) const
2305 {
2306 DumpArrayClass(this, os);
2307 }
2308
2309 // NOLINTNEXTLINE(readability-function-size)
Dump(std::ostream & os) const2310 void GlobalEnv::Dump(std::ostream &os) const
2311 {
2312 auto globalConst = GetJSThread()->GlobalConstants();
2313 os << " - ObjectFunction: ";
2314 GetObjectFunction().GetTaggedValue().Dump(os);
2315 os << " - FunctionFunction: ";
2316 GetFunctionFunction().GetTaggedValue().Dump(os);
2317 os << " - NumberFunction: ";
2318 GetNumberFunction().GetTaggedValue().Dump(os);
2319 os << " - BigIntFunction: ";
2320 GetBigIntFunction().GetTaggedValue().Dump(os);
2321 os << " - DateFunction: ";
2322 GetDateFunction().GetTaggedValue().Dump(os);
2323 os << " - BooleanFunction: ";
2324 GetBooleanFunction().GetTaggedValue().Dump(os);
2325 os << " - ErrorFunction: ";
2326 GetErrorFunction().GetTaggedValue().Dump(os);
2327 os << " - ArrayFunction: ";
2328 GetArrayFunction().GetTaggedValue().Dump(os);
2329 os << " - TypedArrayFunction: ";
2330 GetTypedArrayFunction().GetTaggedValue().Dump(os);
2331 os << " - Int8ArrayFunction: ";
2332 GetInt8ArrayFunction().GetTaggedValue().Dump(os);
2333 os << " - Uint8ArrayFunction: ";
2334 GetUint8ArrayFunction().GetTaggedValue().Dump(os);
2335 os << " - Uint8ClampedArrayFunction: ";
2336 GetUint8ClampedArrayFunction().GetTaggedValue().Dump(os);
2337 os << " - Int16ArrayFunction: ";
2338 GetInt16ArrayFunction().GetTaggedValue().Dump(os);
2339 os << " - ArrayBufferFunction: ";
2340 GetArrayBufferFunction().GetTaggedValue().Dump(os);
2341 os << " - SharedArrayBufferFunction: ";
2342 GetSharedArrayBufferFunction().GetTaggedValue().Dump(os);
2343 os << " - SymbolFunction: ";
2344 GetSymbolFunction().GetTaggedValue().Dump(os);
2345 os << " - RangeErrorFunction: ";
2346 GetRangeErrorFunction().GetTaggedValue().Dump(os);
2347 os << " - ReferenceErrorFunction: ";
2348 GetReferenceErrorFunction().GetTaggedValue().Dump(os);
2349 os << " - TypeErrorFunction: ";
2350 GetTypeErrorFunction().GetTaggedValue().Dump(os);
2351 os << " - AggregateErrorFunction: ";
2352 GetAggregateErrorFunction().GetTaggedValue().Dump(os);
2353 os << " - URIErrorFunction: ";
2354 GetURIErrorFunction().GetTaggedValue().Dump(os);
2355 os << " - SyntaxErrorFunction: ";
2356 GetSyntaxErrorFunction().GetTaggedValue().Dump(os);
2357 os << " - EvalErrorFunction: ";
2358 GetEvalErrorFunction().GetTaggedValue().Dump(os);
2359 os << " - OOMErrorFunction: ";
2360 GetOOMErrorFunction().GetTaggedValue().Dump(os);
2361 os << " - RegExpFunction: ";
2362 GetRegExpFunction().GetTaggedValue().Dump(os);
2363 os << " - BuiltinsSetFunction: ";
2364 GetBuiltinsSetFunction().GetTaggedValue().Dump(os);
2365 os << " - BuiltinsMapFunction: ";
2366 GetBuiltinsMapFunction().GetTaggedValue().Dump(os);
2367 os << " - BuiltinsWeakSetFunction: ";
2368 GetBuiltinsWeakSetFunction().GetTaggedValue().Dump(os);
2369 os << " - BuiltinsWeakMapFunction: ";
2370 GetBuiltinsWeakMapFunction().GetTaggedValue().Dump(os);
2371 os << " - BuiltinsWeakRefFunction: ";
2372 GetBuiltinsWeakRefFunction().GetTaggedValue().Dump(os);
2373 os << " - BuiltinsFinalizationRegistryFunction: ";
2374 GetBuiltinsFinalizationRegistryFunction().GetTaggedValue().Dump(os);
2375 os << " - MathFunction: ";
2376 GetMathFunction().GetTaggedValue().Dump(os);
2377 os << " - AtomicsFunction: ";
2378 GetAtomicsFunction().GetTaggedValue().Dump(os);
2379 os << " - JsonFunction: ";
2380 GetJsonFunction().GetTaggedValue().Dump(os);
2381 os << " - StringFunction: ";
2382 GetStringFunction().GetTaggedValue().Dump(os);
2383 os << " - ProxyFunction: ";
2384 GetProxyFunction().GetTaggedValue().Dump(os);
2385 os << " - ReflectFunction: ";
2386 GetReflectFunction().GetTaggedValue().Dump(os);
2387 os << " - AsyncFunction: ";
2388 GetAsyncFunction().GetTaggedValue().Dump(os);
2389 os << " - AsyncFunctionPrototype: ";
2390 GetAsyncFunctionPrototype().GetTaggedValue().Dump(os);
2391 os << " - JSGlobalObject: ";
2392 GetJSGlobalObject().GetTaggedValue().Dump(os);
2393 os << " - GlobalPatch: ";
2394 GetGlobalPatch().GetTaggedValue().Dump(os);
2395 os << " - EmptyArray: ";
2396 globalConst->GetEmptyArray().Dump(os);
2397 os << " - EmptyString ";
2398 globalConst->GetEmptyString().Dump(os);
2399 os << " - EmptyTaggedQueue: ";
2400 globalConst->GetEmptyTaggedQueue().Dump(os);
2401 os << " - PrototypeString: ";
2402 globalConst->GetPrototypeString().Dump(os);
2403 os << " - HasInstanceSymbol: ";
2404 GetHasInstanceSymbol().GetTaggedValue().Dump(os);
2405 os << " - IsConcatSpreadableSymbol: ";
2406 GetIsConcatSpreadableSymbol().GetTaggedValue().Dump(os);
2407 os << " - ToStringTagSymbol: ";
2408 GetToStringTagSymbol().GetTaggedValue().Dump(os);
2409 os << " - IteratorSymbol: ";
2410 GetIteratorSymbol().GetTaggedValue().Dump(os);
2411 os << " - AsyncIteratorSymbol: ";
2412 GetAsyncIteratorSymbol().GetTaggedValue().Dump(os);
2413 os << " - MatchSymbol: ";
2414 GetMatchSymbol().GetTaggedValue().Dump(os);
2415 os << " - MatchAllSymbol: ";
2416 GetMatchAllSymbol().GetTaggedValue().Dump(os);
2417 os << " - ReplaceSymbol: ";
2418 GetReplaceSymbol().GetTaggedValue().Dump(os);
2419 os << " - SearchSymbol: ";
2420 GetSearchSymbol().GetTaggedValue().Dump(os);
2421 os << " - SpeciesSymbol: ";
2422 GetSpeciesSymbol().GetTaggedValue().Dump(os);
2423 os << " - SplitSymbol: ";
2424 GetSplitSymbol().GetTaggedValue().Dump(os);
2425 os << " - ToPrimitiveSymbol: ";
2426 GetToPrimitiveSymbol().GetTaggedValue().Dump(os);
2427 os << " - UnscopablesSymbol: ";
2428 GetUnscopablesSymbol().GetTaggedValue().Dump(os);
2429 os << " - HoleySymbol: ";
2430 GetHoleySymbol().GetTaggedValue().Dump(os);
2431 os << " - AttachSymbol: ";
2432 GetAttachSymbol().GetTaggedValue().Dump(os);
2433 os << " - DetachSymbol: ";
2434 GetDetachSymbol().GetTaggedValue().Dump(os);
2435 os << " - ConstructorString: ";
2436 globalConst->GetConstructorString().Dump(os);
2437 os << " - IteratorPrototype: ";
2438 GetIteratorPrototype().GetTaggedValue().Dump(os);
2439 os << " - ForinIteratorPrototype: ";
2440 GetForinIteratorPrototype().GetTaggedValue().Dump(os);
2441 os << " - StringIterator: ";
2442 GetStringIterator().GetTaggedValue().Dump(os);
2443 os << " - MapIteratorPrototype: ";
2444 GetMapIteratorPrototype().GetTaggedValue().Dump(os);
2445 os << " - SetIteratorPrototype: ";
2446 GetSetIteratorPrototype().GetTaggedValue().Dump(os);
2447 os << " - RegExpIteratorPrototype: ";
2448 GetRegExpIteratorPrototype().GetTaggedValue().Dump(os);
2449 os << " - ArrayIteratorPrototype: ";
2450 GetArrayIteratorPrototype().GetTaggedValue().Dump(os);
2451 os << " - StringIteratorPrototype: ";
2452 GetStringIteratorPrototype().GetTaggedValue().Dump(os);
2453 os << " - LengthString: ";
2454 globalConst->GetLengthString().Dump(os);
2455 os << " - ValueString: ";
2456 globalConst->GetValueString().Dump(os);
2457 os << " - WritableString: ";
2458 globalConst->GetWritableString().Dump(os);
2459 os << " - GetString: ";
2460 globalConst->GetGetString().Dump(os);
2461 os << " - SetString: ";
2462 globalConst->GetSetString().Dump(os);
2463 os << " - EnumerableString: ";
2464 globalConst->GetEnumerableString().Dump(os);
2465 os << " - ConfigurableString: ";
2466 globalConst->GetConfigurableString().Dump(os);
2467 os << " - NameString: ";
2468 globalConst->GetNameString().Dump(os);
2469 os << " - ValueOfString: ";
2470 globalConst->GetValueOfString().Dump(os);
2471 os << " - ToStringString: ";
2472 globalConst->GetToStringString().Dump(os);
2473 os << " - ToLocaleStringString: ";
2474 globalConst->GetToLocaleStringString().Dump(os);
2475 os << " - UndefinedString: ";
2476 globalConst->GetUndefinedString().Dump(os);
2477 os << " - NullString: ";
2478 globalConst->GetNullString().Dump(os);
2479 os << " - TrueString: ";
2480 globalConst->GetTrueString().Dump(os);
2481 os << " - FalseString: ";
2482 globalConst->GetFalseString().Dump(os);
2483 os << " - RegisterSymbols: ";
2484 GetRegisterSymbols().GetTaggedValue().Dump(os);
2485 os << " - ThrowTypeError: ";
2486 GetThrowTypeError().GetTaggedValue().Dump(os);
2487 os << " - GetPrototypeOfString: ";
2488 globalConst->GetGetPrototypeOfString().Dump(os);
2489 os << " - SetPrototypeOfString: ";
2490 globalConst->GetSetPrototypeOfString().Dump(os);
2491 os << " - IsExtensibleString: ";
2492 globalConst->GetIsExtensibleString().Dump(os);
2493 os << " - PreventExtensionsString: ";
2494 globalConst->GetPreventExtensionsString().Dump(os);
2495 os << " - GetOwnPropertyDescriptorString: ";
2496 globalConst->GetGetOwnPropertyDescriptorString().Dump(os);
2497 os << " - DefinePropertyString: ";
2498 globalConst->GetDefinePropertyString().Dump(os);
2499 os << " - HasString: ";
2500 globalConst->GetHasString().Dump(os);
2501 os << " - DeletePropertyString: ";
2502 globalConst->GetDeletePropertyString().Dump(os);
2503 os << " - EnumerateString: ";
2504 globalConst->GetEnumerateString().Dump(os);
2505 os << " - OwnKeysString: ";
2506 globalConst->GetOwnKeysString().Dump(os);
2507 os << " - ApplyString: ";
2508 globalConst->GetApplyString().Dump(os);
2509 os << " - ProxyString: ";
2510 globalConst->GetProxyString().Dump(os);
2511 os << " - RevokeString: ";
2512 globalConst->GetRevokeString().Dump(os);
2513 os << " - ProxyConstructString: ";
2514 globalConst->GetProxyConstructString().Dump(os);
2515 os << " - ProxyCallString: ";
2516 globalConst->GetProxyCallString().Dump(os);
2517 os << " - DoneString: ";
2518 globalConst->GetDoneString().Dump(os);
2519 os << " - NegativeZeroString: ";
2520 globalConst->GetNegativeZeroString().Dump(os);
2521 os << " - NextString: ";
2522 globalConst->GetNextString().Dump(os);
2523 os << " - PromiseThenString: ";
2524 globalConst->GetPromiseThenString().Dump(os);
2525 os << " - PromiseFunction: ";
2526 GetPromiseFunction().GetTaggedValue().Dump(os);
2527 os << " - PromiseReactionJob: ";
2528 GetPromiseReactionJob().GetTaggedValue().Dump(os);
2529 os << " - PromiseResolveThenableJob: ";
2530 GetPromiseResolveThenableJob().GetTaggedValue().Dump(os);
2531 os << " - DynamicImportJob: ";
2532 GetDynamicImportJob().GetTaggedValue().Dump(os);
2533 os << " - ScriptJobString: ";
2534 globalConst->GetScriptJobString().Dump(os);
2535 os << " - PromiseString: ";
2536 globalConst->GetPromiseString().Dump(os);
2537 os << " - IdentityString: ";
2538 globalConst->GetIdentityString().Dump(os);
2539 os << " - AsyncFunctionString: ";
2540 globalConst->GetAsyncFunctionString().Dump(os);
2541 os << " - ThrowerString: ";
2542 globalConst->GetThrowerString().Dump(os);
2543 os << " - Undefined: ";
2544 globalConst->GetUndefined().Dump(os);
2545 }
2546
Dump(std::ostream & os) const2547 void JSDataView::Dump(std::ostream &os) const
2548 {
2549 os << " - data-view: ";
2550 GetDataView().Dump(os);
2551 os << " - buffer: ";
2552 GetViewedArrayBuffer().Dump(os);
2553 os << "- byte-length: " << GetByteLength();
2554 os << "\n - byte-offset: " << GetByteOffset();
2555 }
2556
Dump(std::ostream & os) const2557 void JSArrayBuffer::Dump(std::ostream &os) const
2558 {
2559 os << " - byte-length: " << GetArrayBufferByteLength();
2560 os << " - buffer-data: ";
2561 GetArrayBufferData().Dump(os);
2562 os << " - Shared: " << GetShared();
2563 }
2564
Dump(std::ostream & os) const2565 void PromiseReaction::Dump(std::ostream &os) const
2566 {
2567 os << " - promise-capability: ";
2568 GetPromiseCapability().Dump(os);
2569 os << " - type: " << static_cast<int>(GetType());
2570 os << " - handler: ";
2571 GetHandler().Dump(os);
2572 }
2573
Dump(std::ostream & os) const2574 void PromiseCapability::Dump(std::ostream &os) const
2575 {
2576 os << " - promise: ";
2577 GetPromise().Dump(os);
2578 os << " - resolve: ";
2579 GetResolve().Dump(os);
2580 os << " - reject: ";
2581 GetReject().Dump(os);
2582 }
2583
Dump(std::ostream & os) const2584 void PromiseIteratorRecord::Dump(std::ostream &os) const
2585 {
2586 os << " - iterator: ";
2587 GetIterator().Dump(os);
2588 os << " - done: " << GetDone();
2589 }
2590
Dump(std::ostream & os) const2591 void PromiseRecord::Dump(std::ostream &os) const
2592 {
2593 os << " - value: ";
2594 GetValue().Dump(os);
2595 }
2596
Dump(std::ostream & os) const2597 void ResolvingFunctionsRecord::Dump(std::ostream &os) const
2598 {
2599 os << " - resolve-function: ";
2600 GetResolveFunction().Dump(os);
2601 os << " - reject-function: ";
2602 GetRejectFunction().Dump(os);
2603 }
2604
Dump(std::ostream & os) const2605 void AsyncGeneratorRequest::Dump(std::ostream &os) const
2606 {
2607 os << " - completion: ";
2608 GetCompletion().Dump(os);
2609 os << " - capability: ";
2610 GetCapability().Dump(os);
2611 }
2612
Dump(std::ostream & os) const2613 void AsyncIteratorRecord::Dump(std::ostream &os) const
2614 {
2615 os << " - completion: ";
2616 GetIterator().Dump(os);
2617 os << " - nextmethod: ";
2618 GetNextMethod().Dump(os);
2619 os << " - done: " << GetDone();
2620 }
2621
Dump(std::ostream & os) const2622 void JSAsyncFromSyncIterator::Dump(std::ostream &os) const
2623 {
2624 os << " - sync-iterator-record: ";
2625 GetSyncIteratorRecord().Dump(os);
2626 JSObject::Dump(os);
2627 }
2628
Dump(std::ostream & os) const2629 void JSAsyncFromSyncIterUnwarpFunction::Dump(std::ostream &os) const
2630 {
2631 os << " - done: " ;
2632 GetDone().Dump(os);
2633 JSObject::Dump(os);
2634 }
2635
Dump(std::ostream & os) const2636 void JSPromise::Dump(std::ostream &os) const
2637 {
2638 os << " - promise-state: " << static_cast<int>(GetPromiseState());
2639 os << "\n - promise-result: ";
2640 GetPromiseResult().Dump(os);
2641 os << " - promise-fulfill-reactions: ";
2642 GetPromiseFulfillReactions().Dump(os);
2643 os << " - promise-reject-reactions: ";
2644 GetPromiseRejectReactions().Dump(os);
2645 os << " - promise-is-handled: " << GetPromiseIsHandled();
2646 JSObject::Dump(os);
2647 }
2648
Dump(std::ostream & os) const2649 void JSPromiseReactionsFunction::Dump(std::ostream &os) const
2650 {
2651 os << " - promise: ";
2652 GetPromise().Dump(os);
2653 os << " - already-resolved: ";
2654 GetAlreadyResolved().Dump(os);
2655 JSObject::Dump(os);
2656 }
2657
Dump(std::ostream & os) const2658 void JSPromiseExecutorFunction::Dump(std::ostream &os) const
2659 {
2660 os << " - capability: ";
2661 GetCapability().Dump(os);
2662 JSObject::Dump(os);
2663 }
2664
Dump(std::ostream & os) const2665 void JSPromiseAllResolveElementFunction::Dump(std::ostream &os) const
2666 {
2667 os << " - index: ";
2668 GetIndex().Dump(os);
2669 os << " - values: ";
2670 GetValues().Dump(os);
2671 os << " - capability: ";
2672 GetCapabilities().Dump(os);
2673 os << " - remaining-elements: ";
2674 GetRemainingElements().Dump(os);
2675 os << " - already-called: ";
2676 GetAlreadyCalled().Dump(os);
2677 JSObject::Dump(os);
2678 }
2679
Dump(std::ostream & os) const2680 void JSPromiseAnyRejectElementFunction::Dump(std::ostream &os) const
2681 {
2682 os << " - index: ";
2683 JSTaggedValue(GetIndex()).Dump(os);
2684 os << " - errors: ";
2685 GetErrors().Dump(os);
2686 os << " - capability: ";
2687 GetCapability().Dump(os);
2688 os << " - remaining-elements: ";
2689 GetRemainingElements().Dump(os);
2690 os << " - already-called: ";
2691 GetAlreadyCalled().Dump(os);
2692 JSObject::Dump(os);
2693 }
2694
Dump(std::ostream & os) const2695 void JSPromiseAllSettledElementFunction::Dump(std::ostream &os) const
2696 {
2697 os << " - already-called: ";
2698 GetAlreadyCalled().Dump(os);
2699 os << " - index: ";
2700 JSTaggedValue(GetIndex()).Dump(os);
2701 os << " - values: ";
2702 GetValues().Dump(os);
2703 os << " - capability: ";
2704 GetCapability().Dump(os);
2705 os << " - remaining-elements: ";
2706 GetRemainingElements().Dump(os);
2707 JSObject::Dump(os);
2708 }
2709
Dump(std::ostream & os) const2710 void JSPromiseFinallyFunction::Dump(std::ostream &os) const
2711 {
2712 os << " - constructor: ";
2713 GetConstructor().Dump(os);
2714 os << " - onFinally: ";
2715 GetOnFinally().Dump(os);
2716 JSObject::Dump(os);
2717 }
2718
Dump(std::ostream & os) const2719 void JSPromiseValueThunkOrThrowerFunction::Dump(std::ostream &os) const
2720 {
2721 os << " - result: ";
2722 GetResult().Dump(os);
2723 JSObject::Dump(os);
2724 }
2725
Dump(std::ostream & os) const2726 void JSAsyncGeneratorResNextRetProRstFtn::Dump(std::ostream &os) const
2727 {
2728 os << " - AsyncGeneratorObject";
2729 GetAsyncGeneratorObject().Dump(os);
2730 JSObject::Dump(os);
2731 }
2732
Dump(std::ostream & os) const2733 void MicroJobQueue::Dump(std::ostream &os) const
2734 {
2735 os << " - promise-job-queue: ";
2736 GetPromiseJobQueue().Dump(os);
2737 os << " - script-job-queue: ";
2738 GetScriptJobQueue().Dump(os);
2739 }
2740
Dump(std::ostream & os) const2741 void PendingJob::Dump(std::ostream &os) const
2742 {
2743 os << " - job: ";
2744 GetJob().Dump(os);
2745 os << "\n";
2746 os << " - arguments: ";
2747 GetArguments().Dump(os);
2748 #if defined(ENABLE_HITRACE)
2749 os << "\n";
2750 os << " - chainId: " << GetChainId();
2751 os << "\n";
2752 os << " - spanId: " << GetSpanId();
2753 os << "\n";
2754 os << " - parentSpanId: " << GetParentSpanId();
2755 os << "\n";
2756 os << " - flags: " << GetFlags();
2757 os << "\n";
2758 #endif
2759 }
2760
Dump(std::ostream & os) const2761 void CompletionRecord::Dump(std::ostream &os) const
2762 {
2763 os << " - type: " << static_cast<int>(GetType());
2764 os << " - value: ";
2765 GetValue().Dump(os);
2766 }
2767
Dump(std::ostream & os) const2768 void JSProxyRevocFunction::Dump(std::ostream &os) const
2769 {
2770 os << " - RevocableProxy: ";
2771 os << "\n";
2772 GetRevocableProxy().Dump(os);
2773 os << "\n";
2774 }
2775
Dump(std::ostream & os) const2776 void JSAsyncFunction::Dump(std::ostream &os) const
2777 {
2778 JSFunction::Dump(os);
2779 }
2780
Dump(std::ostream & os) const2781 void JSAsyncAwaitStatusFunction::Dump(std::ostream &os) const
2782 {
2783 os << " - AsyncContext: ";
2784 os << "\n";
2785 GetAsyncContext().Dump(os);
2786 os << "\n";
2787 }
2788
Dump(std::ostream & os) const2789 void JSGeneratorFunction::Dump(std::ostream &os) const
2790 {
2791 JSFunction::Dump(os);
2792 }
2793
Dump(std::ostream & os) const2794 void JSAsyncGeneratorFunction::Dump(std::ostream &os) const
2795 {
2796 JSFunction::Dump(os);
2797 }
2798
Dump(std::ostream & os) const2799 void JSIntlBoundFunction::Dump(std::ostream &os) const
2800 {
2801 os << " - NumberFormat: ";
2802 GetNumberFormat().Dump(os);
2803 os << "\n";
2804 os << " - DateTimeFormat: ";
2805 GetDateTimeFormat().Dump(os);
2806 os << "\n";
2807 os << " - Collator: ";
2808 GetCollator().Dump(os);
2809 os << "\n";
2810 JSObject::Dump(os);
2811 }
2812
Dump(std::ostream & os) const2813 void PropertyBox::Dump(std::ostream &os) const
2814 {
2815 os << " - Value: ";
2816 GetValue().Dump(os);
2817 os << "\n";
2818 }
2819
Dump(std::ostream & os) const2820 void PrototypeHandler::Dump(std::ostream &os) const
2821 {
2822 os << " - HandlerInfo: ";
2823 GetHandlerInfo().Dump(os);
2824 os << "\n";
2825 os << " - ProtoCell: ";
2826 GetHandlerInfo().Dump(os);
2827 os << "\n";
2828 os << " - Holder: ";
2829 GetHandlerInfo().Dump(os);
2830 os << "\n";
2831 }
2832
Dump(std::ostream & os) const2833 void TransitionHandler::Dump(std::ostream &os) const
2834 {
2835 os << " - HandlerInfo: ";
2836 GetHandlerInfo().Dump(os);
2837 os << "\n";
2838 os << " - TransitionHClass: ";
2839 GetTransitionHClass().Dump(os);
2840 os << "\n";
2841 }
2842
Dump(std::ostream & os) const2843 void TransWithProtoHandler::Dump(std::ostream &os) const
2844 {
2845 os << " - HandlerInfo: ";
2846 GetHandlerInfo().Dump(os);
2847 os << "\n";
2848 os << " - TransitionHClass: ";
2849 GetTransitionHClass().Dump(os);
2850 os << "\n";
2851 os << " - Holder: ";
2852 GetHandlerInfo().Dump(os);
2853 os << "\n";
2854 }
2855
Dump(std::ostream & os) const2856 void StoreTSHandler::Dump(std::ostream &os) const
2857 {
2858 os << " - HandlerInfo: ";
2859 GetHandlerInfo().Dump(os);
2860 os << "\n";
2861 os << " - ProtoCell: ";
2862 GetHandlerInfo().Dump(os);
2863 os << "\n";
2864 os << " - Holder: ";
2865 GetHandlerInfo().Dump(os);
2866 os << "\n";
2867 }
2868
Dump(std::ostream & os) const2869 void JSRealm::Dump(std::ostream &os) const
2870 {
2871 os << " - Value: ";
2872 GetValue().Dump(os);
2873 os << "\n";
2874 os << " - GlobalEnv: ";
2875 GetGlobalEnv().Dump(os);
2876 os << "\n";
2877 JSObject::Dump(os);
2878 }
2879 #ifdef ARK_SUPPORT_INTL
Dump(std::ostream & os) const2880 void JSIntl::Dump(std::ostream &os) const
2881 {
2882 os << " - FallbackSymbol: ";
2883 GetFallbackSymbol().Dump(os);
2884 os << "\n";
2885 JSObject::Dump(os);
2886 }
2887
Dump(std::ostream & os) const2888 void JSLocale::Dump(std::ostream &os) const
2889 {
2890 os << " - IcuField: ";
2891 GetIcuField().Dump(os);
2892 os << "\n";
2893 JSObject::Dump(os);
2894 }
2895
Dump(std::ostream & os) const2896 void JSDateTimeFormat::Dump(std::ostream &os) const
2897 {
2898 os << " - Locale: ";
2899 GetLocale().Dump(os);
2900 os << "\n";
2901 os << " - Calendar: ";
2902 GetCalendar().Dump(os);
2903 os << "\n";
2904 os << " - NumberingSystem: ";
2905 GetNumberingSystem().Dump(os);
2906 os << "\n";
2907 os << " - TimeZone: ";
2908 GetTimeZone().Dump(os);
2909 os << "\n";
2910 os << " - HourCycle: " << static_cast<int>(GetHourCycle());
2911 os << "\n";
2912 os << " - LocaleIcu: ";
2913 GetLocaleIcu().Dump(os);
2914 os << "\n";
2915 os << " - SimpleDateTimeFormatIcu: ";
2916 GetSimpleDateTimeFormatIcu().Dump(os);
2917 os << "\n";
2918 os << " - Iso8601: ";
2919 GetIso8601().Dump(os);
2920 os << "\n";
2921 os << " - DateStyle: " << static_cast<int>(GetDateStyle());
2922 os << "\n";
2923 os << " - TimeStyle: " << static_cast<int>(GetTimeStyle());
2924 os << "\n";
2925 os << " - BoundFormat: ";
2926 GetBoundFormat().Dump(os);
2927 os << "\n";
2928 JSObject::Dump(os);
2929 }
2930
Dump(std::ostream & os) const2931 void JSRelativeTimeFormat::Dump(std::ostream &os) const
2932 {
2933 os << " - Locale: ";
2934 GetLocale().Dump(os);
2935 os << "\n";
2936 os << " - NumberingSystem: ";
2937 GetNumberingSystem().Dump(os);
2938 os << "\n";
2939 os << " - Style: " << static_cast<int>(GetStyle());
2940 os << "\n";
2941 os << " - Numeric: " << static_cast<int>(GetNumeric());
2942 os << "\n";
2943 os << " - IcuField: ";
2944 GetIcuField().Dump(os);
2945 os << "\n";
2946 JSObject::Dump(os);
2947 }
2948
Dump(std::ostream & os) const2949 void JSNumberFormat::Dump(std::ostream &os) const
2950 {
2951 os << " - Locale: ";
2952 GetLocale().Dump(os);
2953 os << "\n" << " - NumberingSystem: ";
2954 GetNumberingSystem().Dump(os);
2955 os << "\n" << " - Style: " << static_cast<int>(GetStyle());
2956 os << "\n" << " - Currency: ";
2957 GetCurrency().Dump(os);
2958 os << "\n" << " - CurrencyDisplay: " << static_cast<int>(GetCurrencyDisplay());
2959 os << "\n" << " - CurrencySign: " << static_cast<int>(GetCurrencySign());
2960 os << "\n" << " - Unit: ";
2961 GetUnit().Dump(os);
2962 os << "\n" << " - UnitDisplay: " << static_cast<int>(GetUnitDisplay());
2963 os << "\n" << " - MinimumIntegerDigits: ";
2964 GetMinimumIntegerDigits().Dump(os);
2965 os << "\n" << " - MinimumFractionDigits: ";
2966 GetMinimumFractionDigits().Dump(os);
2967 os << "\n" << " - MaximumFractionDigits: ";
2968 GetMaximumFractionDigits().Dump(os);
2969 os << "\n" << " - MinimumSignificantDigits: ";
2970 GetMinimumSignificantDigits().Dump(os);
2971 os << "\n" << " - MaximumSignificantDigits: ";
2972 GetMaximumSignificantDigits().Dump(os);
2973 os << "\n" << " - UseGrouping: ";
2974 GetUseGrouping().Dump(os);
2975 os << "\n" << " - RoundingType: " << static_cast<int>(GetRoundingType());
2976 os << "\n" << " - Notation: " << static_cast<int>(GetNotation());
2977 os << "\n" << " - CompactDisplay: " << static_cast<int>(GetCompactDisplay());
2978 os << "\n" << " - SignDisplay: " << static_cast<int>(GetSignDisplay());
2979 os << "\n" << " - BoundFormat: ";
2980 GetBoundFormat().Dump(os);
2981 os << "\n" << " - IcuField: ";
2982 GetIcuField().Dump(os);
2983 os << "\n";
2984 JSObject::Dump(os);
2985 }
2986
Dump(std::ostream & os) const2987 void JSCollator::Dump(std::ostream &os) const
2988 {
2989 os << " - IcuField: ";
2990 GetIcuField().Dump(os);
2991 os << "\n - Locale: ";
2992 GetLocale().Dump(os);
2993 os << "\n - Usage: " << static_cast<int>(GetUsage());
2994 os << "\n - Sensitivity: " << static_cast<int>(GetSensitivity());
2995 os << "\n - IgnorePunctuation: " << GetIgnorePunctuation();
2996 os << "\n - Collation: ";
2997 GetCollation().Dump(os);
2998 os << "\n - Numeric: " << GetNumeric();
2999 os << "\n - CaseFirst: " << static_cast<int>(GetCaseFirst());
3000 os << "\n - BoundCompare: ";
3001 GetBoundCompare().Dump(os);
3002 os << "\n";
3003 JSObject::Dump(os);
3004 }
3005
Dump(std::ostream & os) const3006 void JSPluralRules::Dump(std::ostream &os) const
3007 {
3008 os << " - Locale: ";
3009 GetLocale().Dump(os);
3010 os << "\n";
3011 os << " - Type: " << static_cast<int>(GetType());
3012 os << "\n";
3013 os << " - MinimumIntegerDigits: ";
3014 GetMinimumIntegerDigits().Dump(os);
3015 os << "\n";
3016 os << " - MinimumFractionDigits: ";
3017 GetMinimumFractionDigits().Dump(os);
3018 os << "\n";
3019 os << " - MaximumFractionDigits: ";
3020 GetMaximumFractionDigits().Dump(os);
3021 os << "\n";
3022 os << " - MinimumSignificantDigits: ";
3023 GetMinimumSignificantDigits().Dump(os);
3024 os << "\n";
3025 os << " - MaximumSignificantDigits: ";
3026 GetMaximumSignificantDigits().Dump(os);
3027 os << "\n";
3028 os << " - RoundingType: " << static_cast<int>(GetRoundingType());
3029 os << "\n";
3030 os << " - IcuPR: ";
3031 GetIcuPR().Dump(os);
3032 os << "\n";
3033 os << " - IcuNF: ";
3034 GetIcuNF().Dump(os);
3035 os << "\n";
3036 JSObject::Dump(os);
3037 }
3038
Dump(std::ostream & os) const3039 void JSDisplayNames::Dump(std::ostream &os) const
3040 {
3041 os << " - Locale: ";
3042 GetLocale().Dump(os);
3043 os << "\n";
3044 os << " - Type: "<< static_cast<int>(GetType());
3045 os << "\n";
3046 os << " - Style: "<< static_cast<int>(GetStyle());
3047 os << "\n";
3048 os << " - Fallback: "<< static_cast<int>(GetFallback());
3049 os << "\n";
3050 os << " - IcuLDN: ";
3051 GetIcuLDN().Dump(os);
3052 os << "\n";
3053 JSObject::Dump(os);
3054 }
3055
Dump(std::ostream & os) const3056 void JSListFormat::Dump(std::ostream &os) const
3057 {
3058 os << " - Locale: ";
3059 GetLocale().Dump(os);
3060 os << "\n";
3061 os << " - Type: "<< static_cast<int>(GetType());
3062 os << "\n";
3063 os << " - Style: "<< static_cast<int>(GetStyle());
3064 os << "\n";
3065 os << " - IcuLF: ";
3066 GetIcuLF().Dump(os);
3067 os << "\n";
3068 JSObject::Dump(os);
3069 }
3070 #endif
Dump(std::ostream & os) const3071 void JSGeneratorObject::Dump(std::ostream &os) const
3072 {
3073 os << " - GeneratorContext: ";
3074 GetGeneratorContext().Dump(os);
3075 os << "\n";
3076 os << " - ResumeResult: ";
3077 GetResumeResult().Dump(os);
3078 os << "\n";
3079 os << " - GeneratorState: " << static_cast<uint8_t>(GetGeneratorState());
3080 os << "\n";
3081 os << " - ResumeMode: " << static_cast<uint8_t>(GetResumeMode());
3082 os << "\n";
3083 JSObject::Dump(os);
3084 }
3085
Dump(std::ostream & os) const3086 void JSAsyncGeneratorObject::Dump(std::ostream &os) const
3087 {
3088 os << " - GeneratorContext: ";
3089 GetGeneratorContext().Dump(os);
3090 os << "\n";
3091 os << " - AsyncGeneratorQueue: ";
3092 GetAsyncGeneratorQueue().Dump(os);
3093 os << "\n";
3094 os << " - GeneratorBrand: ";
3095 GetGeneratorBrand().Dump(os);
3096 os << "\n";
3097 os << " - ResumeResult: ";
3098 GetResumeResult().Dump(os);
3099 os << "\n";
3100 os << " - AsyncGeneratorState: " << static_cast<uint8_t>(GetAsyncGeneratorState());
3101 os << "\n";
3102 os << " - ResumeMode: " << static_cast<uint8_t>(GetResumeMode());
3103 os << "\n";
3104 JSObject::Dump(os);
3105 }
3106
Dump(std::ostream & os) const3107 void JSAsyncFuncObject::Dump(std::ostream &os) const
3108 {
3109 os << " - Promise: ";
3110 GetPromise().Dump(os);
3111 os << "\n";
3112 }
3113
Dump(std::ostream & os) const3114 void GeneratorContext::Dump(std::ostream &os) const
3115 {
3116 os << " - RegsArray: ";
3117 GetRegsArray().Dump(os);
3118 os << "\n";
3119 os << " - Method: ";
3120 GetMethod().Dump(os);
3121 os << "\n";
3122 os << " - This: ";
3123 GetThis().Dump(os);
3124 os << "\n";
3125 os << " - Acc: ";
3126 GetAcc().Dump(os);
3127 os << "\n";
3128 os << " - GeneratorObject: ";
3129 GetGeneratorObject().Dump(os);
3130 os << "\n";
3131 os << " - LexicalEnv: ";
3132 GetLexicalEnv().Dump(os);
3133 os << "\n";
3134 os << " - NRegs: " << GetNRegs();
3135 os << "\n";
3136 os << " - BCOffset: " << GetBCOffset();
3137 os << "\n";
3138 }
3139
Dump(std::ostream & os) const3140 void ProtoChangeMarker::Dump(std::ostream &os) const
3141 {
3142 os << " - HasChanged: " << GetHasChanged() << "\n";
3143 }
3144
Dump(std::ostream & os) const3145 void ProtoChangeDetails::Dump(std::ostream &os) const
3146 {
3147 os << " - ChangeListener: ";
3148 GetChangeListener().Dump(os);
3149 os << " \t- RegisterIndex: " << GetRegisterIndex();
3150 os << "\n";
3151 }
3152
Dump(std::ostream & os) const3153 void MachineCode::Dump(std::ostream &os) const
3154 {
3155 os << " - InstructionSizeInBytes: " << GetInstructionSizeInBytes();
3156 os << "\n";
3157 }
3158
Dump(std::ostream & os) const3159 void ClassInfoExtractor::Dump(std::ostream &os) const
3160 {
3161 os << " - NonStaticKeys: ";
3162 GetNonStaticKeys().Dump(os);
3163 os << "\n";
3164 os << " - NonStaticProperties: ";
3165 GetNonStaticProperties().Dump(os);
3166 os << "\n";
3167 os << " - NonStaticElements: ";
3168 GetNonStaticElements().Dump(os);
3169 os << "\n";
3170 os << " - StaticKeys: ";
3171 GetStaticKeys().Dump(os);
3172 os << "\n";
3173 os << " - StaticProperties: ";
3174 GetStaticProperties().Dump(os);
3175 os << "\n";
3176 os << " - StaticElements: ";
3177 GetStaticElements().Dump(os);
3178 os << "\n";
3179 }
3180
Dump(std::ostream & os) const3181 void TSObjectType::Dump(std::ostream &os) const
3182 {
3183 os << " - TSObjectType globalTSTypeRef: ";
3184 GlobalTSTypeRef gt = GetGT();
3185 uint64_t globalTSTypeRef = gt.GetType();
3186 os << globalTSTypeRef;
3187 os << "\n";
3188 os << " - TSObjectType moduleId: ";
3189 uint32_t moduleId = gt.GetModuleId();
3190 os << moduleId;
3191 os << "\n";
3192 os << " - TSObjectType localTypeId: ";
3193 uint32_t localTypeId = gt.GetLocalId();
3194 os << localTypeId;
3195 os << "\n";
3196 os << " - ObjLayoutInfo: ";
3197 DumpArrayClass(TaggedArray::Cast(GetObjLayoutInfo().GetTaggedObject()), os);
3198
3199 os << " - Index signature: ";
3200 if (GetIndexSigns().IsUndefined()) {
3201 os << " no index signature type " << "\n";
3202 } else {
3203 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), os);
3204 }
3205 }
3206
Dump(std::ostream & os) const3207 void TSClassType::Dump(std::ostream &os) const
3208 {
3209 os << " - Dump TSClassType - " << "\n";
3210 os << " - TSClassType globalTSTypeRef: ";
3211 GlobalTSTypeRef gt = GetGT();
3212 uint64_t globalTSTypeRef = gt.GetType();
3213 os << globalTSTypeRef;
3214 os << "\n";
3215 os << " - TSClassType moduleId: ";
3216 uint32_t moduleId = gt.GetModuleId();
3217 os << moduleId;
3218 os << "\n";
3219 os << " - TSClassType localTypeId: ";
3220 uint32_t localTypeId = gt.GetLocalId();
3221 os << localTypeId;
3222 os << "\n";
3223 os << " - ExtensionTypeGT: ";
3224 GlobalTSTypeRef extensionGT = GetExtensionGT();
3225 if (extensionGT.IsDefault()) {
3226 os << " (base class type) ";
3227 } else {
3228 os << extensionGT.GetType();
3229 }
3230 os << "\n";
3231
3232 CString hasLinked = GetHasLinked() ? "true" : "false";
3233 os << " - HasLinked: " << hasLinked << "\n";
3234
3235 os << " - InstanceType: " << "\n";
3236 if (GetInstanceType().IsTSObjectType()) {
3237 TSObjectType *instanceType = TSObjectType::Cast(GetInstanceType().GetTaggedObject());
3238 instanceType->Dump(os);
3239 os << "\n";
3240 }
3241
3242 os << " - ConstructorType: " << "\n";
3243 if (GetConstructorType().IsTSObjectType()) {
3244 TSObjectType *constructorType = TSObjectType::Cast(GetConstructorType().GetTaggedObject());
3245 constructorType->Dump(os);
3246 os << "\n";
3247 }
3248
3249 os << " - PrototypeType: " << "\n";
3250 if (GetPrototypeType().IsTSObjectType()) {
3251 TSObjectType *prototypeType = TSObjectType::Cast(GetPrototypeType().GetTaggedObject());
3252 prototypeType->Dump(os);
3253 os << "\n";
3254 }
3255
3256 os << " - Index signature: ";
3257 if (GetIndexSigns().IsUndefined()) {
3258 os << " no index signature type " << "\n";
3259 } else {
3260 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), os);
3261 }
3262 os << "\n";
3263 }
3264
Dump(std::ostream & os) const3265 void TSInterfaceType::Dump(std::ostream &os) const
3266 {
3267 os << " - Dump Interface Type - " << "\n";
3268 os << " - TSInterfaceType globalTSTypeRef: ";
3269 GlobalTSTypeRef gt = GetGT();
3270 uint64_t globalTSTypeRef = gt.GetType();
3271 os << globalTSTypeRef;
3272 os << "\n";
3273 os << " - TSInterfaceType moduleId: ";
3274 uint32_t moduleId = gt.GetModuleId();
3275 os << moduleId;
3276 os << "\n";
3277 os << " - TSInterfaceType localTypeId: ";
3278 uint32_t localTypeId = gt.GetLocalId();
3279 os << localTypeId;
3280 os << "\n";
3281 os << " - Extends TypeId: " << "\n";
3282 if (TaggedArray::Cast(GetExtends().GetTaggedObject())->GetLength() == 0) {
3283 os << " (base interface type) "<< "\n";
3284 }
3285 DumpArrayClass(TaggedArray::Cast(GetExtends().GetTaggedObject()), os);
3286
3287 os << " - Fields: " << "\n";
3288 if (GetFields().IsTSObjectType()) {
3289 TSObjectType *fieldsType = TSObjectType::Cast(GetFields().GetTaggedObject());
3290 fieldsType->Dump(os);
3291 os << "\n";
3292 }
3293
3294 os << " - Index signature: ";
3295 if (GetIndexSigns().IsUndefined()) {
3296 os << " no index signature type " << "\n";
3297 } else {
3298 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), os);
3299 }
3300 os << "\n";
3301 }
3302
Dump(std::ostream & os) const3303 void TSClassInstanceType::Dump(std::ostream &os) const
3304 {
3305 os << " - Dump ClassInstance Type - " << "\n";
3306 os << " - TSClassInstanceType globalTSTypeRef: ";
3307 GlobalTSTypeRef gt = GetGT();
3308 uint64_t globalTSTypeRef = gt.GetType();
3309 os << globalTSTypeRef;
3310 os << "\n";
3311 os << " - TSClassInstanceType moduleId: ";
3312 uint32_t moduleId = gt.GetModuleId();
3313 os << moduleId;
3314 os << "\n";
3315 os << " - TSClassInstanceType localTypeId: ";
3316 uint32_t localTypeId = gt.GetLocalId();
3317 os << localTypeId;
3318 os << "\n";
3319
3320 os << " - createClassType GT: ";
3321 GlobalTSTypeRef createClassTypeGT = GetClassGT();
3322 os << createClassTypeGT.GetType();
3323 os << "\n";
3324 }
3325
Dump(std::ostream & os) const3326 void TSUnionType::Dump(std::ostream &os) const
3327 {
3328 os << " - Dump UnionType Type - " << "\n";
3329 os << " - TSUnionType globalTSTypeRef: ";
3330 GlobalTSTypeRef gt = GetGT();
3331 uint64_t globalTSTypeRef = gt.GetType();
3332 os << globalTSTypeRef;
3333 os << "\n";
3334 os << " - TSUnionType moduleId: ";
3335 uint32_t moduleId = gt.GetModuleId();
3336 os << moduleId;
3337 os << "\n";
3338 os << " - TSUnionType localTypeId: ";
3339 uint32_t localTypeId = gt.GetLocalId();
3340 os << localTypeId;
3341 os << "\n";
3342 os << " - TSUnionType TypeId: " << "\n";
3343 DumpArrayClass(TaggedArray::Cast(GetComponents().GetTaggedObject()), os);
3344 }
3345
Dump(std::ostream & os) const3346 void TSFunctionType::Dump(std::ostream &os) const
3347 {
3348 os << " - Dump TSFunctionType - " << "\n";
3349 os << " - TSFunctionType globalTSTypeRef: ";
3350 GlobalTSTypeRef gt = GetGT();
3351 uint64_t globalTSTypeRef = gt.GetType();
3352 os << globalTSTypeRef;
3353 os << "\n";
3354 os << " - TSFunctionType moduleId: ";
3355 uint32_t moduleId = gt.GetModuleId();
3356 os << moduleId;
3357 os << "\n";
3358 os << " - TSFunctionType localTypeId: ";
3359 uint32_t localTypeId = gt.GetLocalId();
3360 os << localTypeId;
3361 os << "\n";
3362 os << " - TSFunctionType Name: ";
3363 JSTaggedValue name = GetName();
3364 if (name.IsString()) {
3365 os << ConvertToString(EcmaString::Cast(name.GetTaggedObject()));
3366 }
3367 os << "\n";
3368 os << " - TSFunctionType ParameterTypeIds: " << "\n";
3369 DumpArrayClass(TaggedArray::Cast(GetParameterTypes().GetTaggedObject()), os);
3370 os << " - TSFunctionType ReturnType: " << GetReturnGT().GetType() << "\n";
3371 os << " - TSFunctionType ThisType: " << GetThisGT().GetType() << "\n";
3372 TSFunctionType::Visibility visibility = GetVisibility();
3373 switch (visibility) {
3374 case TSFunctionType::Visibility::PUBLIC:
3375 os << " - Visibility: public";
3376 break;
3377 case TSFunctionType::Visibility::PRIVATE:
3378 os << " - Visibility: private";
3379 break;
3380 case TSFunctionType::Visibility::PROTECTED:
3381 os << " - Visibility: protected";
3382 break;
3383 }
3384 os << " | IsStatic: " << std::boolalpha << GetStatic();
3385 os << " | IsAsync: " << std::boolalpha << GetAsync();
3386 os << " | IsGenerator: " << std::boolalpha << GetGenerator();
3387 os << " | IsGetterSetter: " << std::boolalpha << GetIsGetterSetter();
3388 os << "\n";
3389 }
3390
Dump(std::ostream & os) const3391 void TSArrayType::Dump(std::ostream &os) const
3392 {
3393 os << " - Dump TSArrayType - " << "\n";
3394 os << " - TSArrayType globalTSTypeRef: ";
3395 GlobalTSTypeRef gt = GetGT();
3396 os << gt.GetType();
3397 os << "\n";
3398 os << " - TSArrayType ElementGT: ";
3399 os << GetElementGT().GetType();
3400 os << "\n";
3401 }
3402
Dump(std::ostream & os) const3403 void TSIteratorInstanceType::Dump(std::ostream &os) const
3404 {
3405 os << " - Dump IteratorInstance Type - " << "\n";
3406 os << " - TSIteratorInstanceType globalTSTypeRef: ";
3407 GlobalTSTypeRef gt = GetGT();
3408 uint64_t globalTSTypeRef = gt.GetType();
3409 os << globalTSTypeRef;
3410 os << "\n";
3411 os << " - TSIteratorInstanceType moduleId: ";
3412 uint32_t moduleId = gt.GetModuleId();
3413 os << moduleId;
3414 os << "\n";
3415 os << " - TSIteratorInstanceType localTypeId: ";
3416 uint32_t localTypeId = gt.GetLocalId();
3417 os << localTypeId;
3418 os << "\n";
3419
3420 os << " - TSIteratorInstanceType KindGT: ";
3421 os << GetKindGT().GetType();
3422 os << "\n";
3423
3424 os << " - TSIteratorInstanceType ElementGT: ";
3425 os << GetElementGT().GetType();
3426 os << "\n";
3427 }
3428
Dump(std::ostream & os) const3429 void TSNamespaceType::Dump(std::ostream &os) const
3430 {
3431 os << " - Dump Namespace Type - " << "\n";
3432 os << " - TSNamespaceType globalTSTypeRef: ";
3433 GlobalTSTypeRef gt = GetGT();
3434 uint64_t globalTSTypeRef = gt.GetType();
3435 os << globalTSTypeRef;
3436 os << "\n";
3437 os << " - TSNamespaceType moduleId: ";
3438 uint32_t moduleId = gt.GetModuleId();
3439 os << moduleId;
3440 os << "\n";
3441 os << " - TSNamespaceType localTypeId: ";
3442 uint32_t localTypeId = gt.GetLocalId();
3443 os << localTypeId;
3444 os << "\n";
3445 os << " - Properties: ";
3446 DumpArrayClass(TaggedArray::Cast(GetPropertyType().GetTaggedObject()), os);
3447 }
3448
Dump(std::ostream & os) const3449 void SourceTextModule::Dump(std::ostream &os) const
3450 {
3451 os << " - Environment: ";
3452 GetEnvironment().Dump(os);
3453 os << "\n";
3454 os << " - Namespace: ";
3455 GetNamespace().Dump(os);
3456 os << "\n";
3457 os << " - EcmaModuleFilename: ";
3458 GetEcmaModuleFilename().Dump(os);
3459 os << "\n";
3460 os << " - EcmaModuleRecordName: ";
3461 GetEcmaModuleRecordName().Dump(os);
3462 os << "\n";
3463 os << " - RequestedModules: ";
3464 GetRequestedModules().Dump(os);
3465 os << "\n";
3466 os << " - ImportEntries: ";
3467 GetImportEntries().Dump(os);
3468 os << "\n";
3469 os << " - LocalExportEntries: ";
3470 GetLocalExportEntries().Dump(os);
3471 os << "\n";
3472 os << " - IndirectExportEntries: ";
3473 GetIndirectExportEntries().Dump(os);
3474 os << "\n";
3475 os << " - StarExportEntries: ";
3476 GetStarExportEntries().Dump(os);
3477 os << "\n";
3478 os << " - Status: ";
3479 os << static_cast<int32_t>(GetStatus());
3480 os << "\n";
3481 os << " - EvaluationError: ";
3482 os << GetEvaluationError();
3483 os << "\n";
3484 os << " - DFSIndex: ";
3485 os << GetDFSIndex();
3486 os << "\n";
3487 os << " - DFSAncestorIndex: ";
3488 os << GetDFSAncestorIndex();
3489 os << "\n";
3490 os << " - NameDictionary: ";
3491 GetNameDictionary().Dump(os);
3492 os << "\n";
3493 }
3494
Dump(std::ostream & os) const3495 void ImportEntry::Dump(std::ostream &os) const
3496 {
3497 os << " - ModuleRequest: ";
3498 GetModuleRequest().Dump(os);
3499 os << "\n";
3500 os << " - ImportName: ";
3501 GetImportName().Dump(os);
3502 os << "\n";
3503 os << " - LocalName: ";
3504 GetLocalName().Dump(os);
3505 os << "\n";
3506 }
3507
Dump(std::ostream & os) const3508 void LocalExportEntry::Dump(std::ostream &os) const
3509 {
3510 os << " - ExportName: ";
3511 GetExportName().Dump(os);
3512 os << "\n";
3513 os << " - LocalName: ";
3514 GetLocalName().Dump(os);
3515 os << "\n";
3516 os << " - LocalIndex: " << GetLocalIndex();
3517 os << "\n";
3518 }
3519
Dump(std::ostream & os) const3520 void IndirectExportEntry::Dump(std::ostream &os) const
3521 {
3522 os << " - ExportName: ";
3523 GetExportName().Dump(os);
3524 os << "\n";
3525 os << " - ModuleRequest: ";
3526 GetModuleRequest().Dump(os);
3527 os << "\n";
3528 os << " - ImportName: ";
3529 GetImportName().Dump(os);
3530 os << "\n";
3531 }
3532
Dump(std::ostream & os) const3533 void StarExportEntry::Dump(std::ostream &os) const
3534 {
3535 os << " - ModuleRequest: ";
3536 GetModuleRequest().Dump(os);
3537 os << "\n";
3538 }
3539
Dump(std::ostream & os) const3540 void ResolvedBinding::Dump(std::ostream &os) const
3541 {
3542 os << " - Module: ";
3543 GetModule().Dump(os);
3544 os << "\n";
3545 os << " - BindingName: ";
3546 GetBindingName().Dump(os);
3547 os << "\n";
3548 }
3549
Dump(std::ostream & os) const3550 void ResolvedIndexBinding::Dump(std::ostream &os) const
3551 {
3552 os << " - Module: ";
3553 GetModule().Dump(os);
3554 os << "\n";
3555 os << " - Index: ";
3556 GetIndex();
3557 os << "\n";
3558 }
3559
Dump(std::ostream & os) const3560 void ModuleNamespace::Dump(std::ostream &os) const
3561 {
3562 os << " - Exports: ";
3563 GetExports().Dump(os);
3564 os << "\n";
3565 }
3566
Dump(std::ostream & os) const3567 void CjsModule::Dump(std::ostream &os) const
3568 {
3569 os << " - current module path: ";
3570 GetPath().Dump(os);
3571 os << "\n";
3572 os << " - current module filename: ";
3573 GetFilename().Dump(os);
3574 os << "\n";
3575 }
3576
Dump(std::ostream & os) const3577 void CjsRequire::Dump(std::ostream &os) const
3578 {
3579 os << " --- CjsRequire is JSFunction: ";
3580 os << "\n";
3581 }
3582
Dump(std::ostream & os) const3583 void CjsExports::Dump(std::ostream &os) const
3584 {
3585 DISALLOW_GARBAGE_COLLECTION;
3586 JSHClass *jshclass = GetJSHClass();
3587 os << " - hclass: " << std::hex << jshclass << "\n";
3588 os << " - prototype: ";
3589 jshclass->GetPrototype().DumpTaggedValue(os);
3590 os << "\n";
3591
3592 TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject());
3593 os << " - properties: " << std::hex << properties;
3594
3595 if (!properties->IsDictionaryMode()) {
3596 JSTaggedValue attrs = jshclass->GetLayout();
3597 if (attrs.IsNull()) {
3598 return;
3599 }
3600
3601 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
3602 int propNumber = static_cast<int>(jshclass->NumberOfProps());
3603 os << " <LayoutInfo[" << std::dec << propNumber << "]>\n";
3604 for (int i = 0; i < propNumber; i++) {
3605 JSTaggedValue key = layoutInfo->GetKey(i);
3606 PropertyAttributes attr = layoutInfo->GetAttr(i);
3607 ASSERT(i == static_cast<int>(attr.GetOffset()));
3608 os << " " << std::right << std::setw(DUMP_PROPERTY_OFFSET);
3609 DumpPropertyKey(key, os);
3610 os << ": (";
3611 JSTaggedValue val;
3612 if (attr.IsInlinedProps()) {
3613 val = GetPropertyInlinedPropsWithRep(i, attr);
3614 } else {
3615 val = properties->Get(i - static_cast<int>(jshclass->GetInlinedProperties()));
3616 }
3617 val.DumpTaggedValue(os);
3618 os << ") ";
3619 DumpAttr(attr, true, os);
3620 os << "\n";
3621 }
3622 } else {
3623 NameDictionary *dict = NameDictionary::Cast(properties);
3624 os << " <NameDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
3625 dict->Dump(os);
3626 }
3627 }
3628
Dump(std::ostream & os) const3629 void JSFunctionBase::Dump(std::ostream &os) const
3630 {
3631 os << " - Method: ";
3632 GetMethod().Dump(os);
3633 os << "\n";
3634 }
3635
Dump(std::ostream & os) const3636 void Method::Dump(std::ostream &os) const
3637 {
3638 os << " - MethodName: ";
3639 os << GetMethodName();
3640 os << "\n";
3641 os << " - ConstantPool: ";
3642 GetConstantPool().Dump(os);
3643 os << "\n";
3644 os << " - ProfileTypeInfo: ";
3645 GetProfileTypeInfo().Dump(os);
3646 os << "\n";
3647 os << " - FunctionKind: " << static_cast<int>(GetFunctionKind());
3648 os << "\n";
3649 os << " - CodeEntryOrLiteral: " << std::hex << GetCodeEntryOrLiteral() << "\n";
3650 os << "\n";
3651 }
3652
Dump(std::ostream & os) const3653 void ClassLiteral::Dump(std::ostream &os) const
3654 {
3655 os << " - ClassLiteral: ";
3656 os << "\n";
3657 os << " - IsAOTUsed: " << std::boolalpha << GetIsAOTUsed();
3658 os << "\n";
3659 os << " - Array: ";
3660 GetArray().Dump(os);
3661 os << "\n";
3662 }
3663
3664 // ########################################################################################
3665 // Dump for Snapshot
3666 // ########################################################################################
DumpArrayClass(const TaggedArray * arr,std::vector<std::pair<CString,JSTaggedValue>> & vec)3667 static void DumpArrayClass(const TaggedArray *arr,
3668 std::vector<std::pair<CString, JSTaggedValue>> &vec)
3669 {
3670 DISALLOW_GARBAGE_COLLECTION;
3671 uint32_t len = arr->GetLength();
3672 vec.reserve(vec.size() + len);
3673 for (uint32_t i = 0; i < len; i++) {
3674 JSTaggedValue val(arr->Get(i));
3675 CString str = ToCString(i);
3676 vec.emplace_back(str, val);
3677 }
3678 }
3679
DumpConstantPoolClass(const ConstantPool * arr,std::vector<std::pair<CString,JSTaggedValue>> & vec)3680 static void DumpConstantPoolClass(const ConstantPool *arr,
3681 std::vector<std::pair<CString, JSTaggedValue>> &vec)
3682 {
3683 DISALLOW_GARBAGE_COLLECTION;
3684 uint32_t len = arr->GetCacheLength();
3685 vec.reserve(vec.size() + len);
3686 for (uint32_t i = 0; i < len; i++) {
3687 JSTaggedValue val(arr->GetObjectFromCache(i));
3688 CString str = ToCString(i);
3689 vec.emplace_back(str, val);
3690 }
3691 }
3692
DumpStringClass(const EcmaString * str,std::vector<std::pair<CString,JSTaggedValue>> & vec)3693 static void DumpStringClass(const EcmaString *str,
3694 std::vector<std::pair<CString, JSTaggedValue>> &vec)
3695 {
3696 vec.emplace_back("string", JSTaggedValue(str));
3697 }
3698
DumpClass(TaggedObject * obj,std::vector<std::pair<CString,JSTaggedValue>> & vec)3699 static void DumpClass(TaggedObject *obj, std::vector<std::pair<CString, JSTaggedValue>> &vec)
3700 {
3701 JSHClass *jshclass = obj->GetClass();
3702 vec.emplace_back("__proto__", jshclass->GetPrototype());
3703 }
3704
DumpObject(TaggedObject * obj,std::vector<std::pair<CString,JSTaggedValue>> & vec,bool isVmMode)3705 static void DumpObject(TaggedObject *obj, std::vector<std::pair<CString, JSTaggedValue>> &vec, bool isVmMode)
3706 {
3707 DISALLOW_GARBAGE_COLLECTION;
3708 auto jsHclass = obj->GetClass();
3709 JSType type = jsHclass->GetObjectType();
3710
3711 switch (type) {
3712 case JSType::HCLASS:
3713 DumpClass(obj, vec);
3714 return;
3715 case JSType::TAGGED_ARRAY:
3716 case JSType::TAGGED_DICTIONARY:
3717 case JSType::LEXICAL_ENV:
3718 case JSType::COW_TAGGED_ARRAY:
3719 DumpArrayClass(TaggedArray::Cast(obj), vec);
3720 return;
3721 case JSType::CONSTANT_POOL:
3722 DumpConstantPoolClass(ConstantPool::Cast(obj), vec);
3723 return;
3724 case JSType::LINE_STRING:
3725 case JSType::CONSTANT_STRING:
3726 case JSType::TREE_STRING:
3727 DumpStringClass(EcmaString::Cast(obj), vec);
3728 return;
3729 case JSType::JS_NATIVE_POINTER:
3730 return;
3731 case JSType::JS_OBJECT:
3732 case JSType::JS_ERROR:
3733 case JSType::JS_EVAL_ERROR:
3734 case JSType::JS_RANGE_ERROR:
3735 case JSType::JS_TYPE_ERROR:
3736 case JSType::JS_AGGREGATE_ERROR:
3737 case JSType::JS_REFERENCE_ERROR:
3738 case JSType::JS_URI_ERROR:
3739 case JSType::JS_SYNTAX_ERROR:
3740 case JSType::JS_OOM_ERROR:
3741 case JSType::JS_ARGUMENTS:
3742 case JSType::JS_GLOBAL_OBJECT:
3743 JSObject::Cast(obj)->DumpForSnapshot(vec);
3744 return;
3745 case JSType::JS_FUNCTION_BASE:
3746 case JSType::JS_FUNCTION:
3747 JSFunction::Cast(obj)->DumpForSnapshot(vec);
3748 return;
3749 case JSType::JS_BOUND_FUNCTION:
3750 JSBoundFunction::Cast(obj)->DumpForSnapshot(vec);
3751 return;
3752 case JSType::JS_SET:
3753 JSSet::Cast(obj)->DumpForSnapshot(vec);
3754 return;
3755 case JSType::JS_MAP:
3756 JSMap::Cast(obj)->DumpForSnapshot(vec);
3757 return;
3758 case JSType::JS_WEAK_SET:
3759 JSWeakSet::Cast(obj)->DumpForSnapshot(vec);
3760 return;
3761 case JSType::JS_WEAK_MAP:
3762 JSWeakMap::Cast(obj)->DumpForSnapshot(vec);
3763 return;
3764 case JSType::JS_WEAK_REF:
3765 JSWeakRef::Cast(obj)->DumpForSnapshot(vec);
3766 return;
3767 case JSType::JS_FINALIZATION_REGISTRY:
3768 JSFinalizationRegistry::Cast(obj)->DumpForSnapshot(vec);
3769 return;
3770 case JSType::CELL_RECORD:
3771 CellRecord::Cast(obj)->DumpForSnapshot(vec);
3772 return;
3773 case JSType::JS_REG_EXP:
3774 JSRegExp::Cast(obj)->DumpForSnapshot(vec);
3775 return;
3776 case JSType::JS_DATE:
3777 JSDate::Cast(obj)->DumpForSnapshot(vec);
3778 return;
3779 case JSType::JS_ARRAY:
3780 JSArray::Cast(obj)->DumpForSnapshot(vec);
3781 return;
3782 case JSType::JS_TYPED_ARRAY:
3783 case JSType::JS_INT8_ARRAY:
3784 case JSType::JS_UINT8_ARRAY:
3785 case JSType::JS_UINT8_CLAMPED_ARRAY:
3786 case JSType::JS_INT16_ARRAY:
3787 case JSType::JS_UINT16_ARRAY:
3788 case JSType::JS_INT32_ARRAY:
3789 case JSType::JS_UINT32_ARRAY:
3790 case JSType::JS_FLOAT32_ARRAY:
3791 case JSType::JS_FLOAT64_ARRAY:
3792 case JSType::JS_BIGINT64_ARRAY:
3793 case JSType::JS_BIGUINT64_ARRAY:
3794 JSTypedArray::Cast(obj)->DumpForSnapshot(vec);
3795 return;
3796 case JSType::BIGINT:
3797 BigInt::Cast(obj)->DumpForSnapshot(vec);
3798 return;
3799 case JSType::BYTE_ARRAY:
3800 ByteArray::Cast(obj)->DumpForSnapshot(vec);
3801 return;
3802 case JSType::JS_PROXY:
3803 JSProxy::Cast(obj)->DumpForSnapshot(vec);
3804 return;
3805 case JSType::JS_PRIMITIVE_REF:
3806 JSPrimitiveRef::Cast(obj)->DumpForSnapshot(vec);
3807 return;
3808 case JSType::SYMBOL:
3809 JSSymbol::Cast(obj)->DumpForSnapshot(vec);
3810 return;
3811 case JSType::ACCESSOR_DATA:
3812 case JSType::INTERNAL_ACCESSOR:
3813 AccessorData::Cast(obj)->DumpForSnapshot(vec);
3814 return;
3815 case JSType::JS_DATA_VIEW:
3816 JSDataView::Cast(obj)->DumpForSnapshot(vec);
3817 return;
3818 case JSType::PROMISE_REACTIONS:
3819 PromiseReaction::Cast(obj)->DumpForSnapshot(vec);
3820 return;
3821 case JSType::PROMISE_CAPABILITY:
3822 PromiseCapability::Cast(obj)->DumpForSnapshot(vec);
3823 return;
3824 case JSType::PROMISE_ITERATOR_RECORD:
3825 PromiseIteratorRecord::Cast(obj)->DumpForSnapshot(vec);
3826 return;
3827 case JSType::PROMISE_RECORD:
3828 PromiseRecord::Cast(obj)->DumpForSnapshot(vec);
3829 return;
3830 case JSType::RESOLVING_FUNCTIONS_RECORD:
3831 ResolvingFunctionsRecord::Cast(obj)->DumpForSnapshot(vec);
3832 return;
3833 case JSType::JS_PROMISE:
3834 JSPromise::Cast(obj)->DumpForSnapshot(vec);
3835 return;
3836 case JSType::JS_PROMISE_REACTIONS_FUNCTION:
3837 JSPromiseReactionsFunction::Cast(obj)->DumpForSnapshot(vec);
3838 return;
3839 case JSType::JS_PROMISE_EXECUTOR_FUNCTION:
3840 JSPromiseExecutorFunction::Cast(obj)->DumpForSnapshot(vec);
3841 return;
3842 case JSType::ASYNC_GENERATOR_REQUEST:
3843 AsyncGeneratorRequest::Cast(obj)->DumpForSnapshot(vec);
3844 return;
3845 case JSType::ASYNC_ITERATOR_RECORD:
3846 AsyncIteratorRecord::Cast(obj)->DumpForSnapshot(vec);
3847 return;
3848 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR:
3849 JSAsyncFromSyncIterator::Cast(obj)->DumpForSnapshot(vec);
3850 return;
3851 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION:
3852 JSAsyncFromSyncIterUnwarpFunction::Cast(obj)->DumpForSnapshot(vec);
3853 return;
3854 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION:
3855 JSPromiseAllResolveElementFunction::Cast(obj)->DumpForSnapshot(vec);
3856 return;
3857 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION:
3858 JSPromiseAnyRejectElementFunction::Cast(obj)->DumpForSnapshot(vec);
3859 return;
3860 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION:
3861 JSPromiseAllSettledElementFunction::Cast(obj)->DumpForSnapshot(vec);
3862 return;
3863 case JSType::JS_PROMISE_FINALLY_FUNCTION:
3864 JSPromiseFinallyFunction::Cast(obj)->DumpForSnapshot(vec);
3865 return;
3866 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION:
3867 JSPromiseValueThunkOrThrowerFunction::Cast(obj)->DumpForSnapshot(vec);
3868 return;
3869 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN:
3870 JSAsyncGeneratorResNextRetProRstFtn::Cast(obj)->DumpForSnapshot(vec);
3871 return;
3872 case JSType::MICRO_JOB_QUEUE:
3873 MicroJobQueue::Cast(obj)->DumpForSnapshot(vec);
3874 return;
3875 case JSType::PENDING_JOB:
3876 PendingJob::Cast(obj)->DumpForSnapshot(vec);
3877 return;
3878 case JSType::COMPLETION_RECORD:
3879 CompletionRecord::Cast(obj)->DumpForSnapshot(vec);
3880 return;
3881 case JSType::JS_ITERATOR:
3882 case JSType::JS_ASYNCITERATOR:
3883 case JSType::JS_FORIN_ITERATOR:
3884 case JSType::JS_MAP_ITERATOR:
3885 case JSType::JS_SET_ITERATOR:
3886 case JSType::JS_ARRAY_ITERATOR:
3887 case JSType::JS_STRING_ITERATOR:
3888 case JSType::JS_REG_EXP_ITERATOR:
3889 case JSType::JS_ARRAY_BUFFER:
3890 JSArrayBuffer::Cast(obj)->DumpForSnapshot(vec);
3891 return;
3892 case JSType::JS_SHARED_ARRAY_BUFFER:
3893 JSArrayBuffer::Cast(obj)->DumpForSnapshot(vec);
3894 return;
3895 case JSType::JS_PROXY_REVOC_FUNCTION:
3896 JSProxyRevocFunction::Cast(obj)->DumpForSnapshot(vec);
3897 return;
3898 case JSType::JS_ASYNC_FUNCTION:
3899 JSAsyncFunction::Cast(obj)->DumpForSnapshot(vec);
3900 return;
3901 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION:
3902 JSAsyncAwaitStatusFunction::Cast(obj)->DumpForSnapshot(vec);
3903 return;
3904 case JSType::JS_GENERATOR_FUNCTION:
3905 JSGeneratorFunction::Cast(obj)->DumpForSnapshot(vec);
3906 return;
3907 case JSType::JS_ASYNC_GENERATOR_FUNCTION:
3908 JSAsyncGeneratorFunction::Cast(obj)->DumpForSnapshot(vec);
3909 return;
3910 case JSType::JS_INTL_BOUND_FUNCTION:
3911 JSIntlBoundFunction::Cast(obj)->DumpForSnapshot(vec);
3912 return;
3913 case JSType::JS_REALM:
3914 JSRealm::Cast(obj)->DumpForSnapshot(vec);
3915 return;
3916 #ifdef ARK_SUPPORT_INTL
3917 case JSType::JS_INTL:
3918 JSIntl::Cast(obj)->DumpForSnapshot(vec);
3919 return;
3920 case JSType::JS_LOCALE:
3921 JSLocale::Cast(obj)->DumpForSnapshot(vec);
3922 return;
3923 case JSType::JS_DATE_TIME_FORMAT:
3924 JSDateTimeFormat::Cast(obj)->DumpForSnapshot(vec);
3925 return;
3926 case JSType::JS_RELATIVE_TIME_FORMAT:
3927 JSRelativeTimeFormat::Cast(obj)->DumpForSnapshot(vec);
3928 return;
3929 case JSType::JS_NUMBER_FORMAT:
3930 JSNumberFormat::Cast(obj)->DumpForSnapshot(vec);
3931 return;
3932 case JSType::JS_COLLATOR:
3933 JSCollator::Cast(obj)->DumpForSnapshot(vec);
3934 return;
3935 case JSType::JS_PLURAL_RULES:
3936 JSPluralRules::Cast(obj)->DumpForSnapshot(vec);
3937 return;
3938 case JSType::JS_DISPLAYNAMES:
3939 JSDisplayNames::Cast(obj)->DumpForSnapshot(vec);
3940 return;
3941 case JSType::JS_LIST_FORMAT:
3942 JSListFormat::Cast(obj)->DumpForSnapshot(vec);
3943 return;
3944 #else
3945 case JSType::JS_INTL:
3946 case JSType::JS_LOCALE:
3947 case JSType::JS_DATE_TIME_FORMAT:
3948 case JSType::JS_RELATIVE_TIME_FORMAT:
3949 case JSType::JS_NUMBER_FORMAT:
3950 case JSType::JS_COLLATOR:
3951 case JSType::JS_PLURAL_RULES:
3952 case JSType::JS_DISPLAYNAMES:
3953 case JSType::JS_LIST_FORMAT:
3954 return;
3955 #endif
3956 case JSType::JS_CJS_MODULE:
3957 CjsModule::Cast(obj)->DumpForSnapshot(vec);
3958 return;
3959 case JSType::JS_CJS_EXPORTS:
3960 CjsExports::Cast(obj)->DumpForSnapshot(vec);
3961 return;
3962 case JSType::JS_CJS_REQUIRE:
3963 CjsRequire::Cast(obj)->DumpForSnapshot(vec);
3964 return;
3965 case JSType::JS_GENERATOR_OBJECT:
3966 JSGeneratorObject::Cast(obj)->DumpForSnapshot(vec);
3967 return;
3968 case JSType::JS_ASYNC_GENERATOR_OBJECT:
3969 JSAsyncGeneratorObject::Cast(obj)->DumpForSnapshot(vec);
3970 return;
3971 case JSType::JS_ASYNC_FUNC_OBJECT:
3972 JSAsyncFuncObject::Cast(obj)->DumpForSnapshot(vec);
3973 return;
3974 case JSType::JS_GENERATOR_CONTEXT:
3975 GeneratorContext::Cast(obj)->DumpForSnapshot(vec);
3976 return;
3977 case JSType::JS_API_ARRAY_LIST:
3978 JSAPIArrayList::Cast(obj)->DumpForSnapshot(vec);
3979 return;
3980 case JSType::JS_API_ARRAYLIST_ITERATOR:
3981 JSAPIArrayListIterator::Cast(obj)->DumpForSnapshot(vec);
3982 return;
3983 case JSType::LINKED_NODE:
3984 case JSType::RB_TREENODE:
3985 return;
3986 case JSType::JS_API_HASH_MAP:
3987 JSAPIHashMap::Cast(obj)->DumpForSnapshot(vec);
3988 return;
3989 case JSType::JS_API_HASH_SET:
3990 JSAPIHashSet::Cast(obj)->DumpForSnapshot(vec);
3991 return;
3992 case JSType::JS_API_HASHMAP_ITERATOR:
3993 JSAPIHashMapIterator::Cast(obj)->DumpForSnapshot(vec);
3994 return;
3995 case JSType::JS_API_HASHSET_ITERATOR:
3996 JSAPIHashSetIterator::Cast(obj)->DumpForSnapshot(vec);
3997 return;
3998 case JSType::JS_API_LIGHT_WEIGHT_MAP:
3999 JSAPILightWeightMap::Cast(obj)->DumpForSnapshot(vec);
4000 return;
4001 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR:
4002 JSAPILightWeightMapIterator::Cast(obj)->DumpForSnapshot(vec);
4003 return;
4004 case JSType::JS_API_LIGHT_WEIGHT_SET:
4005 JSAPILightWeightSet::Cast(obj)->DumpForSnapshot(vec);
4006 return;
4007 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR:
4008 JSAPILightWeightSetIterator::Cast(obj)->DumpForSnapshot(vec);
4009 return;
4010 case JSType::JS_API_TREE_MAP:
4011 JSAPITreeMap::Cast(obj)->DumpForSnapshot(vec);
4012 return;
4013 case JSType::JS_API_TREE_SET:
4014 JSAPITreeSet::Cast(obj)->DumpForSnapshot(vec);
4015 return;
4016 case JSType::JS_API_TREEMAP_ITERATOR:
4017 JSAPITreeMapIterator::Cast(obj)->DumpForSnapshot(vec);
4018 return;
4019 case JSType::JS_API_TREESET_ITERATOR:
4020 JSAPITreeSetIterator::Cast(obj)->DumpForSnapshot(vec);
4021 return;
4022 case JSType::JS_API_VECTOR:
4023 JSAPIVector::Cast(obj)->DumpForSnapshot(vec);
4024 return;
4025 case JSType::JS_API_VECTOR_ITERATOR:
4026 JSAPIVectorIterator::Cast(obj)->DumpForSnapshot(vec);
4027 return;
4028 case JSType::JS_API_QUEUE:
4029 JSAPIQueue::Cast(obj)->DumpForSnapshot(vec);
4030 return;
4031 case JSType::JS_API_QUEUE_ITERATOR:
4032 JSAPIQueueIterator::Cast(obj)->DumpForSnapshot(vec);
4033 return;
4034 case JSType::JS_API_DEQUE:
4035 JSAPIDeque::Cast(obj)->DumpForSnapshot(vec);
4036 return;
4037 case JSType::JS_API_DEQUE_ITERATOR:
4038 JSAPIDequeIterator::Cast(obj)->DumpForSnapshot(vec);
4039 return;
4040 case JSType::JS_API_STACK:
4041 JSAPIStack::Cast(obj)->DumpForSnapshot(vec);
4042 return;
4043 case JSType::JS_API_STACK_ITERATOR:
4044 JSAPIStackIterator::Cast(obj)->DumpForSnapshot(vec);
4045 return;
4046 case JSType::JS_API_LIST:
4047 JSAPIList::Cast(obj)->DumpForSnapshot(vec);
4048 return;
4049 case JSType::JS_API_LINKED_LIST:
4050 JSAPILinkedList::Cast(obj)->DumpForSnapshot(vec);
4051 return;
4052 case JSType::JS_API_LIST_ITERATOR:
4053 JSAPIListIterator::Cast(obj)->DumpForSnapshot(vec);
4054 return;
4055 case JSType::JS_API_LINKED_LIST_ITERATOR:
4056 JSAPILinkedListIterator::Cast(obj)->DumpForSnapshot(vec);
4057 return;
4058 case JSType::SOURCE_TEXT_MODULE_RECORD:
4059 SourceTextModule::Cast(obj)->DumpForSnapshot(vec);
4060 return;
4061 case JSType::IMPORTENTRY_RECORD:
4062 ImportEntry::Cast(obj)->DumpForSnapshot(vec);
4063 return;
4064 case JSType::LOCAL_EXPORTENTRY_RECORD:
4065 LocalExportEntry::Cast(obj)->DumpForSnapshot(vec);
4066 return;
4067 case JSType::INDIRECT_EXPORTENTRY_RECORD:
4068 IndirectExportEntry::Cast(obj)->DumpForSnapshot(vec);
4069 return;
4070 case JSType::STAR_EXPORTENTRY_RECORD:
4071 StarExportEntry::Cast(obj)->DumpForSnapshot(vec);
4072 return;
4073 case JSType::RESOLVEDBINDING_RECORD:
4074 ResolvedBinding::Cast(obj)->DumpForSnapshot(vec);
4075 return;
4076 case JSType::RESOLVEDINDEXBINDING_RECORD:
4077 ResolvedIndexBinding::Cast(obj)->DumpForSnapshot(vec);
4078 return;
4079 case JSType::JS_MODULE_NAMESPACE:
4080 ModuleNamespace::Cast(obj)->DumpForSnapshot(vec);
4081 return;
4082 case JSType::JS_API_PLAIN_ARRAY:
4083 JSAPIPlainArray::Cast(obj)->DumpForSnapshot(vec);
4084 return;
4085 case JSType::JS_API_PLAIN_ARRAY_ITERATOR:
4086 JSAPIPlainArrayIterator::Cast(obj)->DumpForSnapshot(vec);
4087 return;
4088 default:
4089 break;
4090 }
4091 if (isVmMode) {
4092 switch (type) {
4093 case JSType::PROPERTY_BOX:
4094 PropertyBox::Cast(obj)->DumpForSnapshot(vec);
4095 return;
4096 case JSType::TEMPLATE_MAP:
4097 DumpArrayClass(TaggedArray::Cast(obj), vec);
4098 return;
4099 case JSType::GLOBAL_ENV:
4100 GlobalEnv::Cast(obj)->DumpForSnapshot(vec);
4101 return;
4102 case JSType::PROTO_CHANGE_MARKER:
4103 ProtoChangeMarker::Cast(obj)->DumpForSnapshot(vec);
4104 return;
4105 case JSType::PROTOTYPE_INFO:
4106 ProtoChangeDetails::Cast(obj)->DumpForSnapshot(vec);
4107 return;
4108 case JSType::PROGRAM:
4109 Program::Cast(obj)->DumpForSnapshot(vec);
4110 return;
4111 case JSType::MACHINE_CODE_OBJECT:
4112 MachineCode::Cast(obj)->DumpForSnapshot(vec);
4113 return;
4114 case JSType::TRANSITION_HANDLER:
4115 TransitionHandler::Cast(obj)->DumpForSnapshot(vec);
4116 return;
4117 case JSType::TRANS_WITH_PROTO_HANDLER:
4118 TransWithProtoHandler::Cast(obj)->DumpForSnapshot(vec);
4119 return;
4120 case JSType::STORE_TS_HANDLER:
4121 StoreTSHandler::Cast(obj)->DumpForSnapshot(vec);
4122 return;
4123 case JSType::PROTOTYPE_HANDLER:
4124 PrototypeHandler::Cast(obj)->DumpForSnapshot(vec);
4125 return;
4126 case JSType::CLASS_INFO_EXTRACTOR:
4127 ClassInfoExtractor::Cast(obj)->DumpForSnapshot(vec);
4128 return;
4129 case JSType::TS_OBJECT_TYPE:
4130 TSObjectType::Cast(obj)->DumpForSnapshot(vec);
4131 return;
4132 case JSType::TS_CLASS_TYPE:
4133 TSClassType::Cast(obj)->DumpForSnapshot(vec);
4134 return;
4135 case JSType::TS_INTERFACE_TYPE:
4136 TSInterfaceType::Cast(obj)->DumpForSnapshot(vec);
4137 return;
4138 case JSType::TS_CLASS_INSTANCE_TYPE:
4139 TSClassInstanceType::Cast(obj)->DumpForSnapshot(vec);
4140 return;
4141 case JSType::TS_UNION_TYPE:
4142 TSUnionType::Cast(obj)->DumpForSnapshot(vec);
4143 return;
4144 case JSType::TS_FUNCTION_TYPE:
4145 TSFunctionType::Cast(obj)->DumpForSnapshot(vec);
4146 return;
4147 case JSType::TS_ARRAY_TYPE:
4148 TSArrayType::Cast(obj)->DumpForSnapshot(vec);
4149 return;
4150 case JSType::TS_ITERATOR_INSTANCE_TYPE:
4151 TSIteratorInstanceType::Cast(obj)->DumpForSnapshot(vec);
4152 return;
4153 case JSType::TS_NAMESPACE_TYPE:
4154 TSNamespaceType::Cast(obj)->DumpForSnapshot(vec);
4155 return;
4156 case JSType::METHOD:
4157 Method::Cast(obj)->DumpForSnapshot(vec);
4158 return;
4159 case JSType::CLASS_LITERAL:
4160 ClassLiteral::Cast(obj)->DumpForSnapshot(vec);
4161 return;
4162 default:
4163 LOG_ECMA(FATAL) << "this branch is unreachable";
4164 UNREACHABLE();
4165 break;
4166 }
4167 }
4168 }
4169
EcmaStringToStd(CString & res,EcmaString * str)4170 static inline void EcmaStringToStd(CString &res, EcmaString *str)
4171 {
4172 if (EcmaStringAccessor(str).GetLength() == 0) {
4173 CString emptyStr = "EmptyString";
4174 res.append(emptyStr);
4175 }
4176
4177 CString string = ConvertToString(str);
4178 res.append(string);
4179 }
4180
KeyToStd(CString & res,JSTaggedValue key)4181 static void KeyToStd(CString &res, JSTaggedValue key)
4182 {
4183 if (key.IsInt()) {
4184 res = std::to_string(key.GetInt());
4185 } else if (key.IsDouble()) {
4186 res = std::to_string(key.GetDouble());
4187 } else if (key.IsBoolean()) {
4188 res = key.IsTrue() ? "true" : "false";
4189 } else if (key.IsHeapObject()) {
4190 if (key.IsWeak()) {
4191 key.RemoveWeakTag();
4192 }
4193 if (key.IsString()) {
4194 EcmaStringToStd(res, EcmaString::Cast(key.GetTaggedObject()));
4195 } else if (key.IsSymbol()) {
4196 JSSymbol *sym = JSSymbol::Cast(key.GetTaggedObject());
4197 JSTaggedValue desc = sym->GetDescription();
4198 if (desc.IsString()) {
4199 EcmaStringToStd(res, EcmaString::Cast(desc.GetTaggedObject()));
4200 }
4201 }
4202 }
4203 }
4204
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec,bool isVmMode) const4205 void JSTaggedValue::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec, bool isVmMode) const
4206 {
4207 if (IsHeapObject()) {
4208 return DumpObject(GetTaggedObject(), vec, isVmMode);
4209 }
4210 LOG_ECMA(FATAL) << "this branch is unreachable";
4211 UNREACHABLE();
4212 }
4213
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4214 void NumberDictionary::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4215 {
4216 DISALLOW_GARBAGE_COLLECTION;
4217 int size = Size();
4218 vec.reserve(vec.size() + size);
4219 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
4220 JSTaggedValue key(GetKey(hashIndex));
4221 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4222 JSTaggedValue val(GetValue(hashIndex));
4223 CString str = ToCString(static_cast<uint32_t>(JSTaggedNumber(key).GetNumber()));
4224 vec.emplace_back(str, val);
4225 }
4226 }
4227 }
4228
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4229 void NameDictionary::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4230 {
4231 DISALLOW_GARBAGE_COLLECTION;
4232 int size = Size();
4233 vec.reserve(vec.size() + size);
4234 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
4235 JSTaggedValue key(GetKey(hashIndex));
4236 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4237 JSTaggedValue val(GetValue(hashIndex));
4238 CString str;
4239 KeyToStd(str, key);
4240 vec.emplace_back(str, val);
4241 }
4242 }
4243 }
4244
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4245 void GlobalDictionary::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4246 {
4247 DISALLOW_GARBAGE_COLLECTION;
4248 int size = Size();
4249 vec.reserve(vec.size() + size);
4250 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
4251 JSTaggedValue key(GetKey(hashIndex));
4252 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4253 CString str;
4254 KeyToStd(str, key);
4255 JSTaggedValue val = GetValue(hashIndex);
4256 vec.emplace_back(str, val);
4257 }
4258 }
4259 }
4260
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4261 void LinkedHashSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4262 {
4263 DISALLOW_GARBAGE_COLLECTION;
4264 int capacity = NumberOfElements() + NumberOfDeletedElements();
4265 vec.reserve(vec.size() + capacity);
4266 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
4267 JSTaggedValue key(GetKey(hashIndex));
4268 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4269 CString str;
4270 KeyToStd(str, key);
4271 vec.emplace_back(str, JSTaggedValue::Hole());
4272 }
4273 }
4274 }
4275
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4276 void LinkedHashMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4277 {
4278 DISALLOW_GARBAGE_COLLECTION;
4279 int capacity = NumberOfElements() + NumberOfDeletedElements();
4280 vec.reserve(vec.size() + capacity);
4281 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
4282 JSTaggedValue key(GetKey(hashIndex));
4283 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4284 JSTaggedValue val = GetValue(hashIndex);
4285 CString str;
4286 KeyToStd(str, key);
4287 vec.emplace_back(str, val);
4288 }
4289 }
4290 }
4291
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4292 void TaggedTreeMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4293 {
4294 DISALLOW_GARBAGE_COLLECTION;
4295 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
4296 vec.reserve(vec.size() + capacity);
4297 for (uint32_t index = 0; index < capacity; index++) {
4298 JSTaggedValue key(GetKey(index));
4299 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4300 JSTaggedValue val = GetValue(index);
4301 CString str;
4302 KeyToStd(str, key);
4303 vec.emplace_back(str, val);
4304 }
4305 }
4306 }
4307
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4308 void TaggedTreeSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4309 {
4310 DISALLOW_GARBAGE_COLLECTION;
4311 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
4312 vec.reserve(vec.size() + capacity);
4313 for (uint32_t index = 0; index < capacity; index++) {
4314 JSTaggedValue key(GetKey(index));
4315 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4316 CString str;
4317 KeyToStd(str, key);
4318 vec.emplace_back(str, JSTaggedValue::Hole());
4319 }
4320 }
4321 }
4322
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4323 void TaggedDoubleList::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4324 {
4325 DISALLOW_GARBAGE_COLLECTION;
4326 int capacity = NumberOfNodes();
4327 vec.reserve(vec.size() + capacity);
4328 for (int index = 0; index < capacity; index++) {
4329 JSTaggedValue val = GetElement(index);
4330 CString str;
4331 KeyToStd(str, JSTaggedValue(index));
4332 vec.emplace_back(str, val);
4333 }
4334 }
4335
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4336 void TaggedSingleList::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4337 {
4338 DISALLOW_GARBAGE_COLLECTION;
4339 int capacity = NumberOfNodes();
4340 vec.reserve(vec.size() + capacity);
4341 for (int index = 0; index < capacity; index++) {
4342 JSTaggedValue val = GetElement(index);
4343 CString str;
4344 KeyToStd(str, JSTaggedValue(index));
4345 vec.emplace_back(str, val);
4346 }
4347 }
4348
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4349 void JSObject::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4350 {
4351 DISALLOW_GARBAGE_COLLECTION;
4352 JSHClass *jshclass = GetJSHClass();
4353 vec.emplace_back("__proto__", jshclass->GetPrototype());
4354
4355 TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject());
4356 if (elements->GetLength() == 0) {
4357 } else if (!elements->IsDictionaryMode()) {
4358 DumpArrayClass(elements, vec);
4359 } else {
4360 NumberDictionary *dict = NumberDictionary::Cast(elements);
4361 dict->DumpForSnapshot(vec);
4362 }
4363
4364 TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject());
4365 if (IsJSGlobalObject()) {
4366 GlobalDictionary *dict = GlobalDictionary::Cast(properties);
4367 dict->DumpForSnapshot(vec);
4368 return;
4369 }
4370
4371 if (!properties->IsDictionaryMode()) {
4372 JSTaggedValue attrs = jshclass->GetLayout();
4373 if (attrs.IsNull()) {
4374 return;
4375 }
4376
4377 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
4378 int propNumber = static_cast<int>(jshclass->NumberOfProps());
4379 vec.reserve(vec.size() + propNumber);
4380 for (int i = 0; i < propNumber; i++) {
4381 JSTaggedValue key = layoutInfo->GetKey(i);
4382 PropertyAttributes attr = layoutInfo->GetAttr(i);
4383 ASSERT(i == static_cast<int>(attr.GetOffset()));
4384 JSTaggedValue val;
4385 if (attr.IsInlinedProps()) {
4386 val = GetPropertyInlinedPropsWithRep(i, attr);
4387 } else {
4388 val = properties->Get(i - static_cast<int>(jshclass->GetInlinedProperties()));
4389 }
4390
4391 CString str;
4392 KeyToStd(str, key);
4393 vec.emplace_back(str, val);
4394 }
4395 } else {
4396 NameDictionary *dict = NameDictionary::Cast(properties);
4397 dict->DumpForSnapshot(vec);
4398 }
4399 }
4400
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4401 void JSHClass::DumpForSnapshot([[maybe_unused]] std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4402 {
4403 }
4404
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4405 void JSFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4406 {
4407 vec.emplace_back("ProtoOrHClass", GetProtoOrHClass());
4408 vec.emplace_back("LexicalEnv", GetLexicalEnv());
4409 vec.emplace_back("HomeObject", GetHomeObject());
4410 vec.emplace_back("FunctionKind", JSTaggedValue(static_cast<int>(GetFunctionKind())));
4411 vec.emplace_back("FunctionExtraInfo", GetFunctionExtraInfo());
4412 JSObject::DumpForSnapshot(vec);
4413 }
4414
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4415 void Method::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4416 {
4417 vec.emplace_back("ConstantPool", GetConstantPool());
4418 vec.emplace_back("ProfileTypeInfo", GetProfileTypeInfo());
4419 }
4420
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4421 void Program::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4422 {
4423 vec.emplace_back("MainFunction", GetMainFunction());
4424 }
4425
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4426 void ConstantPool::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4427 {
4428 DumpArrayClass(this, vec);
4429 }
4430
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4431 void VTable::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4432 {
4433 DumpArrayClass(this, vec);
4434 }
4435
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4436 void COWTaggedArray::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4437 {
4438 DumpArrayClass(this, vec);
4439 }
4440
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4441 void JSBoundFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4442 {
4443 JSObject::DumpForSnapshot(vec);
4444
4445 vec.emplace_back("BoundTarget", GetBoundTarget());
4446 vec.emplace_back("BoundThis", GetBoundThis());
4447 vec.emplace_back("BoundArguments", GetBoundArguments());
4448 }
4449
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4450 void JSPrimitiveRef::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4451 {
4452 vec.emplace_back("subValue", GetValue());
4453 JSObject::DumpForSnapshot(vec);
4454 }
4455
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4456 void BigInt::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4457 {
4458 vec.emplace_back("Length", JSTaggedValue(GetLength()));
4459 vec.emplace_back("Sign", JSTaggedValue(GetSign()));
4460 }
4461
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4462 void JSDate::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4463 {
4464 vec.emplace_back("time", GetTime());
4465 vec.emplace_back("localOffset", GetLocalOffset());
4466
4467 JSObject::DumpForSnapshot(vec);
4468 }
4469
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4470 void JSMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4471 {
4472 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
4473 map->DumpForSnapshot(vec);
4474
4475 JSObject::DumpForSnapshot(vec);
4476 }
4477
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4478 void JSForInIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4479 {
4480 vec.emplace_back("Object", GetObject());
4481 vec.emplace_back("WasVisited", JSTaggedValue(GetWasVisited()));
4482 vec.emplace_back("VisitedObjs", GetVisitedObjs());
4483 vec.emplace_back("RemainingKeys", GetRemainingKeys());
4484 JSObject::DumpForSnapshot(vec);
4485 }
4486
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4487 void JSMapIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4488 {
4489 LinkedHashMap *map = LinkedHashMap::Cast(GetIteratedMap().GetTaggedObject());
4490 map->DumpForSnapshot(vec);
4491 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4492 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
4493 JSObject::DumpForSnapshot(vec);
4494 }
4495
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4496 void JSSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4497 {
4498 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
4499 set->DumpForSnapshot(vec);
4500
4501 JSObject::DumpForSnapshot(vec);
4502 }
4503
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4504 void JSWeakMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4505 {
4506 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
4507 map->DumpForSnapshot(vec);
4508
4509 JSObject::DumpForSnapshot(vec);
4510 }
4511
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4512 void JSWeakSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4513 {
4514 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
4515 set->DumpForSnapshot(vec);
4516
4517 JSObject::DumpForSnapshot(vec);
4518 }
4519
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4520 void JSWeakRef::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4521 {
4522 vec.emplace_back("WeakObject", GetWeakObject());
4523 JSObject::DumpForSnapshot(vec);
4524 }
4525
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4526 void JSFinalizationRegistry::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4527 {
4528 vec.emplace_back("CleanupCallback", GetCleanupCallback());
4529 LinkedHashMap *map = LinkedHashMap::Cast(GetMaybeUnregister().GetTaggedObject());
4530 map->DumpForSnapshot(vec);
4531 vec.emplace_back("MaybeUnregister", GetMaybeUnregister());
4532 JSObject::DumpForSnapshot(vec);
4533 }
4534
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4535 void CellRecord::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4536 {
4537 vec.emplace_back("WeakRefTarget", GetWeakRefTarget());
4538 vec.emplace_back("HeldValue", GetHeldValue());
4539 }
4540
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4541 void JSSetIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4542 {
4543 LinkedHashSet *set = LinkedHashSet::Cast(GetIteratedSet().GetTaggedObject());
4544 set->DumpForSnapshot(vec);
4545 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4546 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
4547 JSObject::DumpForSnapshot(vec);
4548 }
4549
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4550 void JSArray::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4551 {
4552 JSObject::DumpForSnapshot(vec);
4553 }
4554
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4555 void JSAPIArrayList::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4556 {
4557 JSObject::DumpForSnapshot(vec);
4558 }
4559
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4560 void JSAPIArrayListIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4561 {
4562 JSAPIArrayList *arraylist = JSAPIArrayList::Cast(GetIteratedArrayList().GetTaggedObject());
4563 arraylist->DumpForSnapshot(vec);
4564 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4565 JSObject::DumpForSnapshot(vec);
4566 }
4567
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4568 void JSAPILightWeightMap::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4569 {
4570 JSObject::DumpForSnapshot(vec);
4571 }
4572
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4573 void JSAPILightWeightMapIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4574 {
4575 JSAPILightWeightMap *map =
4576 JSAPILightWeightMap::Cast(GetIteratedLightWeightMap().GetTaggedObject());
4577 map->DumpForSnapshot(vec);
4578 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4579 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
4580 JSObject::DumpForSnapshot(vec);
4581 }
4582
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4583 void JSAPIQueue::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4584 {
4585 JSObject::DumpForSnapshot(vec);
4586 }
4587
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4588 void JSAPIQueueIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4589 {
4590 JSAPIQueue *queue = JSAPIQueue::Cast(GetIteratedQueue().GetTaggedObject());
4591 queue->DumpForSnapshot(vec);
4592 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4593 JSObject::DumpForSnapshot(vec);
4594 }
4595
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4596 void JSAPIDeque::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4597 {
4598 JSObject::DumpForSnapshot(vec);
4599 }
4600
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4601 void JSAPIDequeIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4602 {
4603 JSAPIDeque *deque = JSAPIDeque::Cast(GetIteratedDeque().GetTaggedObject());
4604 deque->DumpForSnapshot(vec);
4605 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4606 JSObject::DumpForSnapshot(vec);
4607 }
4608
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4609 void JSAPILightWeightSet::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4610 {
4611 JSObject::DumpForSnapshot(vec);
4612 }
4613
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4614 void JSAPILightWeightSetIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4615 {
4616 JSAPILightWeightSet *set =
4617 JSAPILightWeightSet::Cast(GetIteratedLightWeightSet().GetTaggedObject());
4618 set->DumpForSnapshot(vec);
4619 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4620 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
4621 JSObject::DumpForSnapshot(vec);
4622 }
4623
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4624 void JSAPIStack::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4625 {
4626 JSObject::DumpForSnapshot(vec);
4627 }
4628
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4629 void JSAPIStackIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4630 {
4631 JSAPIStack *stack = JSAPIStack::Cast(GetIteratedStack().GetTaggedObject());
4632 stack->DumpForSnapshot(vec);
4633 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4634 JSObject::DumpForSnapshot(vec);
4635 }
4636
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4637 void JSArrayIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4638 {
4639 JSArray *array = JSArray::Cast(GetIteratedArray().GetTaggedObject());
4640 array->DumpForSnapshot(vec);
4641 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4642 vec.emplace_back("IterationKind", JSTaggedValue(static_cast<int>(GetIterationKind())));
4643 JSObject::DumpForSnapshot(vec);
4644 }
4645
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4646 void JSAPIVector::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4647 {
4648 JSObject::DumpForSnapshot(vec);
4649 }
4650
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4651 void JSAPIVectorIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4652 {
4653 JSAPIVector *vector = JSAPIVector::Cast(GetIteratedVector().GetTaggedObject());
4654 vector->DumpForSnapshot(vec);
4655 vec.emplace_back("NextIndex", JSTaggedValue(GetNextIndex()));
4656 JSObject::DumpForSnapshot(vec);
4657 }
4658
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4659 void JSStringIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4660 {
4661 vec.emplace_back("IteratedString", GetIteratedString());
4662 vec.emplace_back("StringIteratorNextIndex", JSTaggedValue(GetStringIteratorNextIndex()));
4663 JSObject::DumpForSnapshot(vec);
4664 }
4665
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4666 void JSTypedArray::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4667 {
4668 // please update the NUM_OF_ITEMS if you change the items below
4669 constexpr int16_t NUM_OF_ITEMS = 5;
4670 vec.reserve(vec.size() + NUM_OF_ITEMS);
4671 vec.emplace_back("viewed-array-buffer", GetViewedArrayBufferOrByteArray());
4672 vec.emplace_back("typed-array-name", GetTypedArrayName());
4673 vec.emplace_back("byte-length", JSTaggedValue(GetByteLength()));
4674 vec.emplace_back("byte-offset", JSTaggedValue(GetByteOffset()));
4675 vec.emplace_back("array-length", JSTaggedValue(GetArrayLength()));
4676 }
4677
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4678 void ByteArray::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4679 {
4680 vec.emplace_back("array-length", JSTaggedValue(GetArrayLength()));
4681 vec.emplace_back("byte-length", JSTaggedValue(GetByteLength()));
4682 }
4683
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4684 void JSRegExp::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4685 {
4686 vec.emplace_back("originalSource", GetOriginalSource());
4687 vec.emplace_back("originalFlags", GetOriginalFlags());
4688 vec.emplace_back("groupName", GetGroupName());
4689 JSObject::DumpForSnapshot(vec);
4690 }
4691
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4692 void JSRegExpIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4693 {
4694 vec.emplace_back("IteratingRegExp", GetIteratingRegExp());
4695 vec.emplace_back("IteratedString", GetIteratedString());
4696 vec.emplace_back("Global", JSTaggedValue(GetGlobal()));
4697 vec.emplace_back("Unicode", JSTaggedValue(GetUnicode()));
4698 vec.emplace_back("Done", JSTaggedValue(GetDone()));
4699 JSObject::DumpForSnapshot(vec);
4700 }
4701
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4702 void JSProxy::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4703 {
4704 vec.emplace_back("target", GetTarget());
4705 vec.emplace_back("handler", GetHandler());
4706 }
4707
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4708 void JSSymbol::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4709 {
4710 vec.emplace_back("hash-field", JSTaggedValue(GetHashField()));
4711 vec.emplace_back("flags", JSTaggedValue(GetFlags()));
4712 vec.emplace_back("description", GetDescription());
4713 }
4714
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4715 void AccessorData::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4716 {
4717 vec.emplace_back("getter", GetGetter());
4718 vec.emplace_back("setter", GetSetter());
4719 }
4720
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4721 void LexicalEnv::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4722 {
4723 DumpArrayClass(this, vec);
4724 }
4725
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4726 void GlobalEnv::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4727 {
4728 auto globalConst = GetJSThread()->GlobalConstants();
4729 // please update the NUM_OF_ITEMS if you change the items below
4730 constexpr int16_t NUM_OF_ITEMS = 137;
4731 vec.reserve(vec.size() + NUM_OF_ITEMS);
4732 vec.emplace_back("ObjectFunction", GetObjectFunction().GetTaggedValue());
4733 vec.emplace_back("FunctionFunction", GetFunctionFunction().GetTaggedValue());
4734 vec.emplace_back("NumberFunction", GetNumberFunction().GetTaggedValue());
4735 vec.emplace_back("BigIntFunction", GetBigIntFunction().GetTaggedValue());
4736 vec.emplace_back("DateFunction", GetDateFunction().GetTaggedValue());
4737 vec.emplace_back("BooleanFunction", GetBooleanFunction().GetTaggedValue());
4738 vec.emplace_back("ErrorFunction", GetErrorFunction().GetTaggedValue());
4739 vec.emplace_back("ArrayFunction", GetArrayFunction().GetTaggedValue());
4740 vec.emplace_back("TypedArrayFunction", GetTypedArrayFunction().GetTaggedValue());
4741 vec.emplace_back("Int8ArrayFunction", GetInt8ArrayFunction().GetTaggedValue());
4742 vec.emplace_back("Uint8ArrayFunction", GetUint8ArrayFunction().GetTaggedValue());
4743 vec.emplace_back("Uint8ClampedArrayFunction", GetUint8ClampedArrayFunction().GetTaggedValue());
4744 vec.emplace_back("Int16ArrayFunction", GetInt16ArrayFunction().GetTaggedValue());
4745 vec.emplace_back("Uint16ArrayFunction", GetUint16ArrayFunction().GetTaggedValue());
4746 vec.emplace_back("Int32ArrayFunction", GetInt32ArrayFunction().GetTaggedValue());
4747 vec.emplace_back("Uint32ArrayFunction", GetUint32ArrayFunction().GetTaggedValue());
4748 vec.emplace_back("Float32ArrayFunction", GetFloat32ArrayFunction().GetTaggedValue());
4749 vec.emplace_back("Float64ArrayFunction", GetFloat64ArrayFunction().GetTaggedValue());
4750 vec.emplace_back("ArrayBufferFunction", GetArrayBufferFunction().GetTaggedValue());
4751 vec.emplace_back("SharedArrayBufferFunction", GetSharedArrayBufferFunction().GetTaggedValue());
4752 vec.emplace_back("SymbolFunction", GetSymbolFunction().GetTaggedValue());
4753 vec.emplace_back("RangeErrorFunction", GetRangeErrorFunction().GetTaggedValue());
4754 vec.emplace_back("ReferenceErrorFunction", GetReferenceErrorFunction().GetTaggedValue());
4755 vec.emplace_back("TypeErrorFunction", GetTypeErrorFunction().GetTaggedValue());
4756 vec.emplace_back("AggregateErrorFunction", GetAggregateErrorFunction().GetTaggedValue());
4757 vec.emplace_back("URIErrorFunction", GetURIErrorFunction().GetTaggedValue());
4758 vec.emplace_back("SyntaxErrorFunction", GetSyntaxErrorFunction().GetTaggedValue());
4759 vec.emplace_back("EvalErrorFunction", GetEvalErrorFunction().GetTaggedValue());
4760 vec.emplace_back("OOMErrorFunction", GetOOMErrorFunction().GetTaggedValue());
4761 vec.emplace_back("RegExpFunction", GetRegExpFunction().GetTaggedValue());
4762 vec.emplace_back("BuiltinsSetFunction", GetBuiltinsSetFunction().GetTaggedValue());
4763 vec.emplace_back("BuiltinsMapFunction", GetBuiltinsMapFunction().GetTaggedValue());
4764 vec.emplace_back("BuiltinsWeakSetFunction", GetBuiltinsWeakSetFunction().GetTaggedValue());
4765 vec.emplace_back("BuiltinsWeakMapFunction", GetBuiltinsWeakMapFunction().GetTaggedValue());
4766 vec.emplace_back("BuiltinsWeakRefFunction", GetBuiltinsWeakRefFunction().GetTaggedValue());
4767 vec.emplace_back("BuiltinsFinalizationRegistryFunction",
4768 GetBuiltinsFinalizationRegistryFunction().GetTaggedValue());
4769 vec.emplace_back("MathFunction", GetMathFunction().GetTaggedValue());
4770 vec.emplace_back("AtomicsFunction", GetAtomicsFunction().GetTaggedValue());
4771 vec.emplace_back("JsonFunction", GetJsonFunction().GetTaggedValue());
4772 vec.emplace_back("StringFunction", GetStringFunction().GetTaggedValue());
4773 vec.emplace_back("ProxyFunction", GetProxyFunction().GetTaggedValue());
4774 vec.emplace_back("ReflectFunction", GetReflectFunction().GetTaggedValue());
4775 vec.emplace_back("AsyncFunction", GetAsyncFunction().GetTaggedValue());
4776 vec.emplace_back("AsyncFunctionPrototype", GetAsyncFunctionPrototype().GetTaggedValue());
4777 vec.emplace_back("JSGlobalObject", GetJSGlobalObject().GetTaggedValue());
4778 vec.emplace_back("EmptyArray", globalConst->GetEmptyArray());
4779 vec.emplace_back("EmptyString", globalConst->GetEmptyString());
4780 vec.emplace_back("EmptyTaggedQueue", globalConst->GetEmptyTaggedQueue());
4781 vec.emplace_back("PrototypeString", globalConst->GetPrototypeString());
4782 vec.emplace_back("HasInstanceSymbol", GetHasInstanceSymbol().GetTaggedValue());
4783 vec.emplace_back("IsConcatSpreadableSymbol", GetIsConcatSpreadableSymbol().GetTaggedValue());
4784 vec.emplace_back("ToStringTagSymbol", GetToStringTagSymbol().GetTaggedValue());
4785 vec.emplace_back("IteratorSymbol", GetIteratorSymbol().GetTaggedValue());
4786 vec.emplace_back("AsyncIteratorSymbol", GetAsyncIteratorSymbol().GetTaggedValue());
4787 vec.emplace_back("MatchSymbol", GetMatchSymbol().GetTaggedValue());
4788 vec.emplace_back("MatchAllSymbol", GetMatchAllSymbol().GetTaggedValue());
4789 vec.emplace_back("ReplaceSymbol", GetReplaceSymbol().GetTaggedValue());
4790 vec.emplace_back("SearchSymbol", GetSearchSymbol().GetTaggedValue());
4791 vec.emplace_back("SpeciesSymbol", GetSpeciesSymbol().GetTaggedValue());
4792 vec.emplace_back("SplitSymbol", GetSplitSymbol().GetTaggedValue());
4793 vec.emplace_back("ToPrimitiveSymbol", GetToPrimitiveSymbol().GetTaggedValue());
4794 vec.emplace_back("UnscopablesSymbol", GetUnscopablesSymbol().GetTaggedValue());
4795 vec.emplace_back("HoleySymbol", GetHoleySymbol().GetTaggedValue());
4796 vec.emplace_back("AttachSymbol", GetAttachSymbol().GetTaggedValue());
4797 vec.emplace_back("DetachSymbol", GetDetachSymbol().GetTaggedValue());
4798 vec.emplace_back("ConstructorString", globalConst->GetConstructorString());
4799 vec.emplace_back("IteratorPrototype", GetIteratorPrototype().GetTaggedValue());
4800 vec.emplace_back("ForinIteratorPrototype", GetForinIteratorPrototype().GetTaggedValue());
4801 vec.emplace_back("StringIterator", GetStringIterator().GetTaggedValue());
4802 vec.emplace_back("MapIteratorPrototype", GetMapIteratorPrototype().GetTaggedValue());
4803 vec.emplace_back("SetIteratorPrototype", GetSetIteratorPrototype().GetTaggedValue());
4804 vec.emplace_back("RegExpIteratorPrototype", GetRegExpIteratorPrototype().GetTaggedValue());
4805 vec.emplace_back("ArrayIteratorPrototype", GetArrayIteratorPrototype().GetTaggedValue());
4806 vec.emplace_back("StringIteratorPrototype", GetStringIteratorPrototype().GetTaggedValue());
4807 vec.emplace_back("LengthString", globalConst->GetLengthString());
4808 vec.emplace_back("ValueString", globalConst->GetValueString());
4809 vec.emplace_back("WritableString", globalConst->GetWritableString());
4810 vec.emplace_back("GetString", globalConst->GetGetString());
4811 vec.emplace_back("SetString", globalConst->GetSetString());
4812 vec.emplace_back("EnumerableString", globalConst->GetEnumerableString());
4813 vec.emplace_back("ConfigurableString", globalConst->GetConfigurableString());
4814 vec.emplace_back("NameString", globalConst->GetNameString());
4815 vec.emplace_back("ValueOfString", globalConst->GetValueOfString());
4816 vec.emplace_back("ToStringString", globalConst->GetToStringString());
4817 vec.emplace_back("ToLocaleStringString", globalConst->GetToLocaleStringString());
4818 vec.emplace_back("UndefinedString", globalConst->GetUndefinedString());
4819 vec.emplace_back("NullString", globalConst->GetNullString());
4820 vec.emplace_back("TrueString", globalConst->GetTrueString());
4821 vec.emplace_back("FalseString", globalConst->GetFalseString());
4822 vec.emplace_back("RegisterSymbols", GetRegisterSymbols().GetTaggedValue());
4823 vec.emplace_back("ThrowTypeError", GetThrowTypeError().GetTaggedValue());
4824 vec.emplace_back("GetPrototypeOfString", globalConst->GetGetPrototypeOfString());
4825 vec.emplace_back("SetPrototypeOfString", globalConst->GetSetPrototypeOfString());
4826 vec.emplace_back("IsExtensibleString", globalConst->GetIsExtensibleString());
4827 vec.emplace_back("PreventExtensionsString", globalConst->GetPreventExtensionsString());
4828 vec.emplace_back("GetOwnPropertyDescriptorString", globalConst->GetGetOwnPropertyDescriptorString());
4829 vec.emplace_back("DefinePropertyString", globalConst->GetDefinePropertyString());
4830 vec.emplace_back("HasString", globalConst->GetHasString());
4831 vec.emplace_back("DeletePropertyString", globalConst->GetDeletePropertyString());
4832 vec.emplace_back("EnumerateString", globalConst->GetEnumerateString());
4833 vec.emplace_back("OwnKeysString", globalConst->GetOwnKeysString());
4834 vec.emplace_back("ApplyString", globalConst->GetApplyString());
4835 vec.emplace_back("ProxyString", globalConst->GetProxyString());
4836 vec.emplace_back("RevokeString", globalConst->GetRevokeString());
4837 vec.emplace_back("ProxyConstructString", globalConst->GetProxyConstructString());
4838 vec.emplace_back("ProxyCallString", globalConst->GetProxyCallString());
4839 vec.emplace_back("DoneString", globalConst->GetDoneString());
4840 vec.emplace_back("NegativeZeroString", globalConst->GetNegativeZeroString());
4841 vec.emplace_back("NextString", globalConst->GetNextString());
4842 vec.emplace_back("PromiseThenString", globalConst->GetPromiseThenString());
4843 vec.emplace_back("PromiseFunction", GetPromiseFunction().GetTaggedValue());
4844 vec.emplace_back("PromiseReactionJob", GetPromiseReactionJob().GetTaggedValue());
4845 vec.emplace_back("PromiseResolveThenableJob", GetPromiseResolveThenableJob().GetTaggedValue());
4846 vec.emplace_back("DynamicImportJob", GetDynamicImportJob().GetTaggedValue());
4847 vec.emplace_back("ScriptJobString", globalConst->GetScriptJobString());
4848 vec.emplace_back("PromiseString", globalConst->GetPromiseString());
4849 vec.emplace_back("IdentityString", globalConst->GetIdentityString());
4850 vec.emplace_back("AsyncFunctionString", globalConst->GetAsyncFunctionString());
4851 vec.emplace_back("ThrowerString", globalConst->GetThrowerString());
4852 vec.emplace_back("Undefined", globalConst->GetUndefined());
4853 vec.emplace_back("ArrayListFunction", globalConst->GetArrayListFunction());
4854 vec.emplace_back("ArrayListIteratorPrototype", globalConst->GetArrayListIteratorPrototype());
4855 vec.emplace_back("HashMapIteratorPrototype", globalConst->GetHashMapIteratorPrototype());
4856 vec.emplace_back("HashSetIteratorPrototype", globalConst->GetHashSetIteratorPrototype());
4857 vec.emplace_back("LightWeightMapIteratorPrototype", globalConst->GetLightWeightMapIteratorPrototype());
4858 vec.emplace_back("LightWeightSetIteratorPrototype", globalConst->GetLightWeightSetIteratorPrototype());
4859 vec.emplace_back("TreeMapIteratorPrototype", globalConst->GetTreeMapIteratorPrototype());
4860 vec.emplace_back("TreeSetIteratorPrototype", globalConst->GetTreeSetIteratorPrototype());
4861 vec.emplace_back("VectorFunction", globalConst->GetVectorFunction());
4862 vec.emplace_back("VectorIteratorPrototype", globalConst->GetVectorIteratorPrototype());
4863 vec.emplace_back("QueueIteratorPrototype", globalConst->GetQueueIteratorPrototype());
4864 vec.emplace_back("PlainArrayIteratorPrototype", globalConst->GetPlainArrayIteratorPrototype());
4865 vec.emplace_back("DequeIteratorPrototype", globalConst->GetDequeIteratorPrototype());
4866 vec.emplace_back("StackIteratorPrototype", globalConst->GetStackIteratorPrototype());
4867 vec.emplace_back("LinkedListIteratorPrototype", globalConst->GetLinkedListIteratorPrototype());
4868 vec.emplace_back("ListIteratorPrototype", globalConst->GetListIteratorPrototype());
4869 vec.emplace_back("GlobalPatch", GetGlobalPatch().GetTaggedValue());
4870 }
4871
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4872 void JSDataView::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4873 {
4874 vec.emplace_back("data-view", GetDataView());
4875 vec.emplace_back("buffer", GetViewedArrayBuffer());
4876 vec.emplace_back("byte-length", JSTaggedValue(GetByteLength()));
4877 vec.emplace_back("byte-offset", JSTaggedValue(GetByteOffset()));
4878 }
4879
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4880 void JSArrayBuffer::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4881 {
4882 vec.emplace_back("buffer-data", GetArrayBufferData());
4883 vec.emplace_back("byte-length", JSTaggedValue(GetArrayBufferByteLength()));
4884 vec.emplace_back("shared", JSTaggedValue(GetShared()));
4885 }
4886
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4887 void PromiseReaction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4888 {
4889 vec.emplace_back("promise-capability", GetPromiseCapability());
4890 vec.emplace_back("handler", GetHandler());
4891 vec.emplace_back("type", JSTaggedValue(static_cast<int>(GetType())));
4892 }
4893
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4894 void PromiseCapability::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4895 {
4896 vec.emplace_back("promise", GetPromise());
4897 vec.emplace_back("resolve", GetResolve());
4898 vec.emplace_back("reject", GetReject());
4899 }
4900
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4901 void PromiseIteratorRecord::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4902 {
4903 vec.emplace_back("iterator", GetIterator());
4904 vec.emplace_back("done", JSTaggedValue(GetDone()));
4905 }
4906
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4907 void PromiseRecord::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4908 {
4909 vec.emplace_back("value", GetValue());
4910 }
4911
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4912 void ResolvingFunctionsRecord::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4913 {
4914 vec.emplace_back("resolve-function", GetResolveFunction());
4915 vec.emplace_back("reject-function", GetRejectFunction());
4916 }
4917
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4918 void AsyncGeneratorRequest::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4919 {
4920 vec.emplace_back("completion", GetCompletion());
4921 vec.emplace_back("capability", GetCapability());
4922 }
4923
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4924 void AsyncIteratorRecord::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4925 {
4926 vec.emplace_back("iterator", GetIterator());
4927 vec.emplace_back("nextmethod", GetNextMethod());
4928 vec.emplace_back("done", JSTaggedValue(GetDone()));
4929 }
4930
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4931 void JSAsyncFromSyncIterator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4932 {
4933 vec.emplace_back("synciteratorrecord", GetSyncIteratorRecord());
4934 }
4935
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4936 void JSAsyncFromSyncIterUnwarpFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4937 {
4938 vec.emplace_back("done", JSTaggedValue(GetDone()));
4939 }
4940
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4941 void JSPromise::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4942 {
4943 vec.emplace_back("promise-state", JSTaggedValue(static_cast<int>(GetPromiseState())));
4944 vec.emplace_back("promise-result", GetPromiseResult());
4945 vec.emplace_back("promise-fulfill-reactions", GetPromiseFulfillReactions());
4946 vec.emplace_back("promise-reject-reactions", GetPromiseRejectReactions());
4947 vec.emplace_back("promise-is-handled", JSTaggedValue(GetPromiseIsHandled()));
4948 JSObject::DumpForSnapshot(vec);
4949 }
4950
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4951 void JSPromiseReactionsFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4952 {
4953 vec.emplace_back("promise", GetPromise());
4954 vec.emplace_back("already-resolved", GetAlreadyResolved());
4955 JSObject::DumpForSnapshot(vec);
4956 }
4957
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4958 void JSAsyncGeneratorResNextRetProRstFtn::DumpForSnapshot(std::vector<std::pair<CString,
4959 JSTaggedValue>> &vec) const
4960 {
4961 vec.emplace_back("async-generator-object", GetAsyncGeneratorObject());
4962 JSObject::DumpForSnapshot(vec);
4963 }
4964
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4965 void JSPromiseExecutorFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4966 {
4967 vec.emplace_back("capability", GetCapability());
4968 JSObject::DumpForSnapshot(vec);
4969 }
4970
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4971 void JSPromiseAllResolveElementFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4972 {
4973 vec.emplace_back("index", GetIndex());
4974 vec.emplace_back("values", GetValues());
4975 vec.emplace_back("capabilities", GetCapabilities());
4976 vec.emplace_back("remaining-elements", GetRemainingElements());
4977 vec.emplace_back("already-called", GetAlreadyCalled());
4978 JSObject::DumpForSnapshot(vec);
4979 }
4980
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4981 void JSPromiseAnyRejectElementFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4982 {
4983 vec.emplace_back("index", JSTaggedValue(GetIndex()));
4984 vec.emplace_back("errors", GetErrors());
4985 vec.emplace_back("capability", GetCapability());
4986 vec.emplace_back("remaining-elements", GetRemainingElements());
4987 vec.emplace_back("already-called", GetAlreadyCalled());
4988 JSObject::DumpForSnapshot(vec);
4989 }
4990
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const4991 void JSPromiseAllSettledElementFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
4992 {
4993 vec.emplace_back("already-called", GetAlreadyCalled());
4994 vec.emplace_back("index", JSTaggedValue(GetIndex()));
4995 vec.emplace_back("values", GetValues());
4996 vec.emplace_back("capability", GetCapability());
4997 vec.emplace_back("remaining-elements", GetRemainingElements());
4998 JSObject::DumpForSnapshot(vec);
4999 }
5000
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5001 void JSPromiseFinallyFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5002 {
5003 vec.emplace_back("constructor", GetConstructor());
5004 vec.emplace_back("onFinally", GetOnFinally());
5005 JSObject::DumpForSnapshot(vec);
5006 }
5007
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5008 void JSPromiseValueThunkOrThrowerFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5009 {
5010 vec.emplace_back("result", GetResult());
5011 JSObject::DumpForSnapshot(vec);
5012 }
5013
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5014 void MicroJobQueue::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5015 {
5016 vec.emplace_back("promise-job-queue", GetPromiseJobQueue());
5017 vec.emplace_back("script-job-queue", GetScriptJobQueue());
5018 }
5019
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5020 void PendingJob::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5021 {
5022 vec.emplace_back("job", GetJob());
5023 vec.emplace_back("arguments", GetArguments());
5024 }
5025
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5026 void CompletionRecord::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5027 {
5028 vec.emplace_back("value", GetValue());
5029 vec.emplace_back("type", JSTaggedValue(static_cast<int>(GetType())));
5030 }
5031
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5032 void JSProxyRevocFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5033 {
5034 vec.emplace_back("RevocableProxy", GetRevocableProxy());
5035 }
5036
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5037 void JSAsyncFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5038 {
5039 JSFunction::DumpForSnapshot(vec);
5040 }
5041
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5042 void JSAsyncAwaitStatusFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5043 {
5044 vec.emplace_back("AsyncContext", GetAsyncContext());
5045 }
5046
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5047 void JSGeneratorFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5048 {
5049 JSFunction::DumpForSnapshot(vec);
5050 }
5051
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5052 void JSAsyncGeneratorFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5053 {
5054 JSFunction::DumpForSnapshot(vec);
5055 }
5056
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5057 void JSIntlBoundFunction::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5058 {
5059 vec.emplace_back("NumberFormat", GetNumberFormat());
5060 vec.emplace_back("DateTimeFormat", GetDateTimeFormat());
5061 vec.emplace_back("Collator", GetCollator());
5062 JSObject::DumpForSnapshot(vec);
5063 }
5064
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5065 void PropertyBox::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5066 {
5067 vec.emplace_back("Value", GetValue());
5068 }
5069
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5070 void PrototypeHandler::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5071 {
5072 vec.emplace_back("HandlerInfo", GetHandlerInfo());
5073 vec.emplace_back("ProtoCell", GetProtoCell());
5074 vec.emplace_back("Holder", GetHolder());
5075 }
5076
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5077 void TransitionHandler::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5078 {
5079 vec.emplace_back("HandlerInfo", GetHandlerInfo());
5080 vec.emplace_back("TransitionHClass", GetTransitionHClass());
5081 }
5082
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5083 void TransWithProtoHandler::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5084 {
5085 vec.emplace_back("HandlerInfo", GetHandlerInfo());
5086 vec.emplace_back("TransitionHClass", GetTransitionHClass());
5087 vec.emplace_back("ProtoCell", GetProtoCell());
5088 }
5089
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5090 void StoreTSHandler::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5091 {
5092 vec.emplace_back("HandlerInfo", GetHandlerInfo());
5093 vec.emplace_back("ProtoCell", GetProtoCell());
5094 vec.emplace_back("Holder", GetHolder());
5095 }
5096
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5097 void JSRealm::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5098 {
5099 vec.emplace_back("Value", GetValue());
5100 vec.emplace_back("GLobalEnv", GetGlobalEnv());
5101 JSObject::DumpForSnapshot(vec);
5102 }
5103 #ifdef ARK_SUPPORT_INTL
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5104 void JSIntl::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5105 {
5106 vec.emplace_back("FallbackSymbol", GetFallbackSymbol());
5107 JSObject::DumpForSnapshot(vec);
5108 }
5109
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5110 void JSLocale::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5111 {
5112 vec.emplace_back("IcuField", GetIcuField());
5113 JSObject::DumpForSnapshot(vec);
5114 }
5115
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5116 void JSDateTimeFormat::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5117 {
5118 // please update the NUM_OF_ITEMS if you change the items below
5119 constexpr int16_t NUM_OF_ITEMS = 11;
5120 vec.reserve(vec.size() + NUM_OF_ITEMS);
5121 vec.emplace_back("Locale", GetLocale());
5122 vec.emplace_back("Calendar", GetCalendar());
5123 vec.emplace_back("NumberingSystem", GetNumberingSystem());
5124 vec.emplace_back("TimeZone", GetTimeZone());
5125 vec.emplace_back("HourCycle", JSTaggedValue(static_cast<int>(GetHourCycle())));
5126 vec.emplace_back("LocaleIcu", GetLocaleIcu());
5127 vec.emplace_back("SimpleDateTimeFormatIcu", GetSimpleDateTimeFormatIcu());
5128 vec.emplace_back("Iso8601", GetIso8601());
5129 vec.emplace_back("DateStyle", JSTaggedValue(static_cast<int>(GetDateStyle())));
5130 vec.emplace_back("TimeStyle", JSTaggedValue(static_cast<int>(GetTimeStyle())));
5131 vec.emplace_back("BoundFormat", GetBoundFormat());
5132 JSObject::DumpForSnapshot(vec);
5133 }
5134
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5135 void JSRelativeTimeFormat::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5136 {
5137 vec.emplace_back("Locale", GetLocale());
5138 vec.emplace_back("NumberingSystem", GetNumberingSystem());
5139 vec.emplace_back("Style", JSTaggedValue(static_cast<int>(GetStyle())));
5140 vec.emplace_back("Numeric", JSTaggedValue(static_cast<int>(GetNumeric())));
5141 vec.emplace_back("IcuField", GetIcuField());
5142 JSObject::DumpForSnapshot(vec);
5143 }
5144
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5145 void JSNumberFormat::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5146 {
5147 // please update the NUM_OF_ITEMS if you change the items below
5148 constexpr int16_t NUM_OF_ITEMS = 20;
5149 vec.reserve(vec.size() + NUM_OF_ITEMS);
5150 vec.emplace_back("Locale", GetLocale());
5151 vec.emplace_back("NumberingSystem", GetNumberingSystem());
5152 vec.emplace_back("Style", JSTaggedValue(static_cast<int>(GetStyle())));
5153 vec.emplace_back("Currency", GetCurrency());
5154 vec.emplace_back("CurrencyDisplay", JSTaggedValue(static_cast<int>(GetCurrencyDisplay())));
5155 vec.emplace_back("CurrencySign", JSTaggedValue(static_cast<int>(GetCurrencySign())));
5156 vec.emplace_back("Unit", GetUnit());
5157 vec.emplace_back("UnitDisplay", JSTaggedValue(static_cast<int>(GetUnitDisplay())));
5158 vec.emplace_back("MinimumIntegerDigits", GetMinimumIntegerDigits());
5159 vec.emplace_back("MinimumFractionDigits", GetMinimumFractionDigits());
5160 vec.emplace_back("MaximumFractionDigits", GetMaximumFractionDigits());
5161 vec.emplace_back("MinimumSignificantDigits", GetMinimumSignificantDigits());
5162 vec.emplace_back("MaximumSignificantDigits", GetMaximumSignificantDigits());
5163 vec.emplace_back("UseGrouping", GetUseGrouping());
5164 vec.emplace_back("RoundingType", JSTaggedValue(static_cast<int>(GetRoundingType())));
5165 vec.emplace_back("Notation", JSTaggedValue(static_cast<int>(GetNotation())));
5166 vec.emplace_back("CompactDisplay", JSTaggedValue(static_cast<int>(GetCompactDisplay())));
5167 vec.emplace_back("SignDisplay", JSTaggedValue(static_cast<int>(GetSignDisplay())));
5168 vec.emplace_back("BoundFormat", GetBoundFormat());
5169 vec.emplace_back("IcuField", GetIcuField());
5170 JSObject::DumpForSnapshot(vec);
5171 }
5172
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5173 void JSCollator::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5174 {
5175 // please update the NUM_OF_ITEMS if you change the items below
5176 constexpr int16_t NUM_OF_ITEMS = 9;
5177 vec.reserve(vec.size() + NUM_OF_ITEMS);
5178 vec.emplace_back("IcuField", GetIcuField());
5179 vec.emplace_back("Locale", GetLocale());
5180 vec.emplace_back("Collation", GetCollation());
5181 vec.emplace_back("BoundCompare", GetBoundCompare());
5182 vec.emplace_back("CaseFirst", JSTaggedValue(static_cast<int>(GetCaseFirst())));
5183 vec.emplace_back("Usage", JSTaggedValue(static_cast<int>(GetUsage())));
5184 vec.emplace_back("Sensitivity", JSTaggedValue(static_cast<int>(GetSensitivity())));
5185 vec.emplace_back("IgnorePunctuation", JSTaggedValue(GetIgnorePunctuation()));
5186 vec.emplace_back("Numeric", JSTaggedValue(GetNumeric()));
5187 JSObject::DumpForSnapshot(vec);
5188 }
5189
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5190 void JSPluralRules::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5191 {
5192 // please update the NUM_OF_ITEMS if you change the items below
5193 constexpr int16_t NUM_OF_ITEMS = 10;
5194 vec.reserve(vec.size() + NUM_OF_ITEMS);
5195 vec.emplace_back("Locale", GetLocale());
5196 vec.emplace_back("MinimumIntegerDigits", GetMinimumIntegerDigits());
5197 vec.emplace_back("MinimumFractionDigits", GetMinimumFractionDigits());
5198 vec.emplace_back("MaximumFractionDigits", GetMaximumFractionDigits());
5199 vec.emplace_back("MinimumSignificantDigits", GetMinimumSignificantDigits());
5200 vec.emplace_back("MaximumSignificantDigits", GetMaximumSignificantDigits());
5201 vec.emplace_back("RoundingType", JSTaggedValue(static_cast<int>(GetRoundingType())));
5202 vec.emplace_back("IcuPR", GetIcuPR());
5203 vec.emplace_back("IcuNF", GetIcuNF());
5204 vec.emplace_back("Type", JSTaggedValue(static_cast<int>(GetType())));
5205 JSObject::DumpForSnapshot(vec);
5206 }
5207
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5208 void JSDisplayNames::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5209 {
5210 vec.emplace_back("Locale", GetLocale());
5211 vec.emplace_back("Type", JSTaggedValue(static_cast<int>(GetType())));
5212 vec.emplace_back("Style", JSTaggedValue(static_cast<int>(GetStyle())));
5213 vec.emplace_back("Fallback", JSTaggedValue(static_cast<int>(GetFallback())));
5214 vec.emplace_back("IcuLDN", GetIcuLDN());
5215 JSObject::DumpForSnapshot(vec);
5216 }
5217
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5218 void JSListFormat::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5219 {
5220 vec.emplace_back("Locale", GetLocale());
5221 vec.emplace_back("Type", JSTaggedValue(static_cast<int>(GetType())));
5222 vec.emplace_back("Style", JSTaggedValue(static_cast<int>(GetStyle())));
5223 vec.emplace_back("IcuLF", GetIcuLF());
5224 JSObject::DumpForSnapshot(vec);
5225 }
5226 #endif
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5227 void JSGeneratorObject::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5228 {
5229 vec.emplace_back("GeneratorContext", GetGeneratorContext());
5230 vec.emplace_back("ResumeResult", GetResumeResult());
5231 vec.emplace_back("GeneratorState", JSTaggedValue(static_cast<int>(GetGeneratorState())));
5232 vec.emplace_back("ResumeMode", JSTaggedValue(static_cast<int>(GetResumeMode())));
5233 JSObject::DumpForSnapshot(vec);
5234 }
5235
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5236 void JSAsyncGeneratorObject::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5237 {
5238 vec.emplace_back("GeneratorContext", GetGeneratorContext());
5239 vec.emplace_back("AsyncGeneratorQueue", GetAsyncGeneratorQueue());
5240 vec.emplace_back("GeneratorBrand", GetGeneratorBrand());
5241 vec.emplace_back("ResumeResult", GetResumeResult());
5242 vec.emplace_back("AsyncGeneratorState", JSTaggedValue(static_cast<int>(GetAsyncGeneratorState())));
5243 vec.emplace_back("ResumeMode", JSTaggedValue(static_cast<int>(GetResumeMode())));
5244 JSObject::DumpForSnapshot(vec);
5245 }
5246
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5247 void JSAsyncFuncObject::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5248 {
5249 vec.emplace_back("Promise", GetPromise());
5250 }
5251
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5252 void GeneratorContext::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5253 {
5254 // please update the NUM_OF_ITEMS if you change the items below
5255 constexpr int16_t NUM_OF_ITEMS = 8;
5256 vec.reserve(vec.size() + NUM_OF_ITEMS);
5257 vec.emplace_back("RegsArray", GetRegsArray());
5258 vec.emplace_back("Method", GetMethod());
5259 vec.emplace_back("This", GetThis());
5260 vec.emplace_back("Acc", GetAcc());
5261 vec.emplace_back("GeneratorObject", GetGeneratorObject());
5262 vec.emplace_back("LexicalEnv", GetLexicalEnv());
5263 vec.emplace_back("NRegs", JSTaggedValue(GetNRegs()));
5264 vec.emplace_back("BCOffset", JSTaggedValue(GetBCOffset()));
5265 }
5266
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5267 void ProtoChangeMarker::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5268 {
5269 vec.emplace_back("Promise", JSTaggedValue(GetHasChanged()));
5270 }
5271
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5272 void ProtoChangeDetails::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5273 {
5274 vec.emplace_back("ChangeListener", GetChangeListener());
5275 vec.emplace_back("RegisterIndex", JSTaggedValue(GetRegisterIndex()));
5276 }
5277
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5278 void MachineCode::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5279 {
5280 vec.emplace_back("InstructionSizeInBytes", JSTaggedValue(GetInstructionSizeInBytes()));
5281 }
5282
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5283 void ClassInfoExtractor::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5284 {
5285 // please update the NUM_OF_ITEMS if you change the items below
5286 constexpr int16_t NUM_OF_ITEMS = 6;
5287 vec.reserve(vec.size() + NUM_OF_ITEMS);
5288 vec.emplace_back("NonStaticKeys", GetNonStaticKeys());
5289 vec.emplace_back("NonStaticProperties", GetNonStaticProperties());
5290 vec.emplace_back("NonStaticElements", GetNonStaticElements());
5291 vec.emplace_back("StaticKeys", GetStaticKeys());
5292 vec.emplace_back("StaticProperties", GetStaticProperties());
5293 vec.emplace_back("StaticElements", GetStaticElements());
5294 }
5295
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5296 void TSObjectType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5297 {
5298 vec.emplace_back("ObjLayoutInfo", GetObjLayoutInfo());
5299 vec.emplace_back("IndexSigns", GetIndexSigns());
5300 }
5301
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5302 void TSClassType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5303 {
5304 // please update the NUM_OF_ITEMS if you change the items below
5305 constexpr int16_t NUM_OF_ITEMS = 5;
5306 vec.reserve(vec.size() + NUM_OF_ITEMS);
5307 vec.emplace_back("InstanceType", GetInstanceType());
5308 vec.emplace_back("ConstructorType", GetConstructorType());
5309 vec.emplace_back("PrototypeType", GetPrototypeType());
5310 vec.emplace_back("ExtensionGT", JSTaggedValue(GetExtensionGT().GetType()));
5311 vec.emplace_back("HasLinked", JSTaggedValue(GetHasLinked()));
5312 }
5313
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5314 void TSInterfaceType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5315 {
5316 vec.emplace_back("Fields", GetFields());
5317 vec.emplace_back("Extends", GetExtends());
5318 }
5319
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5320 void TSClassInstanceType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5321 {
5322 vec.emplace_back("ClassGT", JSTaggedValue(GetClassGT().GetType()));
5323 }
5324
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5325 void TSUnionType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5326 {
5327 vec.emplace_back("ComponentTypes", GetComponents());
5328 }
5329
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5330 void TSFunctionType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5331 {
5332 // please update the NUM_OF_ITEMS if you change the items below
5333 constexpr int16_t NUM_OF_ITEMS = 5;
5334 vec.reserve(vec.size() + NUM_OF_ITEMS);
5335 vec.emplace_back("Name", GetName());
5336 vec.emplace_back("ParameterTypes", GetParameterTypes());
5337 vec.emplace_back("ReturnGT", JSTaggedValue(GetReturnGT().GetType()));
5338 vec.emplace_back("ThisGT", JSTaggedValue(GetThisGT().GetType()));
5339 vec.emplace_back("BitFiled", JSTaggedValue(GetBitField()));
5340 }
5341
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5342 void TSArrayType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5343 {
5344 vec.emplace_back("ParameterTypeRef", JSTaggedValue(GetElementGT().GetType()));
5345 }
5346
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5347 void TSIteratorInstanceType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5348 {
5349 vec.emplace_back("kindGT", JSTaggedValue(GetKindGT().GetType()));
5350 vec.emplace_back("elementGT", JSTaggedValue(GetElementGT().GetType()));
5351 }
5352
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5353 void TSNamespaceType::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5354 {
5355 vec.emplace_back("PropertyType", GetPropertyType());
5356 }
5357
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5358 void SourceTextModule::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5359 {
5360 // please update the NUM_OF_ITEMS if you change the items below
5361 constexpr int16_t NUM_OF_ITEMS = 14;
5362 vec.reserve(vec.size() + NUM_OF_ITEMS);
5363 vec.emplace_back("Environment", GetEnvironment());
5364 vec.emplace_back("Namespace", GetNamespace());
5365 vec.emplace_back("EcmaModuleFilename", GetEcmaModuleFilename());
5366 vec.emplace_back("EcmaModuleRecordName", GetEcmaModuleRecordName());
5367 vec.emplace_back("RequestedModules", GetRequestedModules());
5368 vec.emplace_back("ImportEntries", GetImportEntries());
5369 vec.emplace_back("LocalExportEntries", GetLocalExportEntries());
5370 vec.emplace_back("IndirectExportEntries", GetIndirectExportEntries());
5371 vec.emplace_back("StarExportEntries", GetStarExportEntries());
5372 vec.emplace_back("Status", JSTaggedValue(static_cast<int32_t>(GetStatus())));
5373 vec.emplace_back("EvaluationError", JSTaggedValue(GetEvaluationError()));
5374 vec.emplace_back("DFSIndex", JSTaggedValue(GetDFSIndex()));
5375 vec.emplace_back("DFSAncestorIndex", JSTaggedValue(GetDFSAncestorIndex()));
5376 vec.emplace_back("NameDictionary", GetNameDictionary());
5377 }
5378
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5379 void ImportEntry::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5380 {
5381 vec.emplace_back("ModuleRequest", GetModuleRequest());
5382 vec.emplace_back("ImportName", GetImportName());
5383 vec.emplace_back("LocalName", GetLocalName());
5384 }
5385
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5386 void LocalExportEntry::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5387 {
5388 vec.emplace_back("ExportName", GetExportName());
5389 vec.emplace_back("LocalName", GetLocalName());
5390 }
5391
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5392 void IndirectExportEntry::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5393 {
5394 vec.emplace_back("ExportName", GetExportName());
5395 vec.emplace_back("ModuleRequest", GetModuleRequest());
5396 vec.emplace_back("ImportName", GetImportName());
5397 }
5398
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5399 void StarExportEntry::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5400 {
5401 vec.emplace_back("ModuleRequest", GetModuleRequest());
5402 }
5403
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5404 void ResolvedBinding::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5405 {
5406 vec.emplace_back("Module", GetModule());
5407 vec.emplace_back("BindingName", GetBindingName());
5408 }
5409
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5410 void ResolvedIndexBinding::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5411 {
5412 vec.emplace_back("Module", GetModule());
5413 vec.emplace_back("Index", JSTaggedValue(GetIndex()));
5414 }
5415
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5416 void ModuleNamespace::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5417 {
5418 vec.emplace_back("Module", GetModule());
5419 vec.emplace_back("Exports", GetExports());
5420 }
5421
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5422 void CjsModule::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5423 {
5424 vec.emplace_back("Id", GetId());
5425 vec.emplace_back("Path", GetPath());
5426 vec.emplace_back("Exports", GetExports());
5427 vec.emplace_back("Filename", GetFilename());
5428 }
5429
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5430 void CjsExports::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5431 {
5432 vec.emplace_back("Exports", GetExports());
5433 }
5434
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5435 void CjsRequire::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5436 {
5437 vec.emplace_back("Cache", GetCache());
5438 vec.emplace_back("Parent", GetParent());
5439 }
5440
DumpForSnapshot(std::vector<std::pair<CString,JSTaggedValue>> & vec) const5441 void ClassLiteral::DumpForSnapshot(std::vector<std::pair<CString, JSTaggedValue>> &vec) const
5442 {
5443 vec.emplace_back("Array", GetArray());
5444 vec.emplace_back("IsAOTUsed", GetIsAOTUsed());
5445 }
5446 } // namespace panda::ecmascript
5447