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/dfx/hprof/heap_snapshot.h"
23 #include "ecmascript/ecma_vm.h"
24 #include "ecmascript/global_dictionary-inl.h"
25 #include "ecmascript/global_env.h"
26 #include "ecmascript/vtable.h"
27 #include "ecmascript/ic/ic_handler.h"
28 #include "ecmascript/ic/profile_type_info.h"
29 #include "ecmascript/ic/property_box.h"
30 #include "ecmascript/ic/proto_change_details.h"
31 #include "ecmascript/interpreter/frame_handler.h"
32 #include "ecmascript/jobs/micro_job_queue.h"
33 #include "ecmascript/jobs/pending_job.h"
34 #include "ecmascript/jspandafile/class_info_extractor.h"
35 #include "ecmascript/jspandafile/class_literal.h"
36 #include "ecmascript/jspandafile/program_object.h"
37 #include "ecmascript/js_api/js_api_arraylist.h"
38 #include "ecmascript/js_api/js_api_arraylist_iterator.h"
39 #include "ecmascript/js_api/js_api_deque.h"
40 #include "ecmascript/js_api/js_api_deque_iterator.h"
41 #include "ecmascript/js_api/js_api_hashmap.h"
42 #include "ecmascript/js_api/js_api_hashmap_iterator.h"
43 #include "ecmascript/js_api/js_api_hashset.h"
44 #include "ecmascript/js_api/js_api_hashset_iterator.h"
45 #include "ecmascript/js_api/js_api_lightweightmap.h"
46 #include "ecmascript/js_api/js_api_lightweightmap_iterator.h"
47 #include "ecmascript/js_api/js_api_lightweightset.h"
48 #include "ecmascript/js_api/js_api_lightweightset_iterator.h"
49 #include "ecmascript/js_api/js_api_linked_list.h"
50 #include "ecmascript/js_api/js_api_linked_list_iterator.h"
51 #include "ecmascript/js_api/js_api_list.h"
52 #include "ecmascript/js_api/js_api_list_iterator.h"
53 #include "ecmascript/js_api/js_api_plain_array.h"
54 #include "ecmascript/js_api/js_api_plain_array_iterator.h"
55 #include "ecmascript/js_api/js_api_queue.h"
56 #include "ecmascript/js_api/js_api_queue_iterator.h"
57 #include "ecmascript/js_api/js_api_stack.h"
58 #include "ecmascript/js_api/js_api_stack_iterator.h"
59 #include "ecmascript/js_api/js_api_tree_map.h"
60 #include "ecmascript/js_api/js_api_tree_map_iterator.h"
61 #include "ecmascript/js_api/js_api_tree_set.h"
62 #include "ecmascript/js_api/js_api_tree_set_iterator.h"
63 #include "ecmascript/js_api/js_api_vector.h"
64 #include "ecmascript/js_api/js_api_vector_iterator.h"
65 #include "ecmascript/js_array.h"
66 #include "ecmascript/js_array_iterator.h"
67 #include "ecmascript/js_arraybuffer.h"
68 #include "ecmascript/js_async_from_sync_iterator.h"
69 #include "ecmascript/js_async_function.h"
70 #include "ecmascript/js_async_generator_object.h"
71 #include "ecmascript/js_dataview.h"
72 #include "ecmascript/js_date.h"
73 #include "ecmascript/js_for_in_iterator.h"
74 #include "ecmascript/js_finalization_registry.h"
75 #include "ecmascript/js_function.h"
76 #include "ecmascript/js_generator_object.h"
77 #include "ecmascript/js_global_object.h"
78 #include "ecmascript/js_handle.h"
79 #include "ecmascript/js_map.h"
80 #include "ecmascript/js_map_iterator.h"
81 #include "ecmascript/js_number_format.h"
82 #include "ecmascript/js_object-inl.h"
83 #include "ecmascript/js_plural_rules.h"
84 #include "ecmascript/js_primitive_ref.h"
85 #include "ecmascript/js_promise.h"
86 #include "ecmascript/js_realm.h"
87 #include "ecmascript/js_regexp.h"
88 #include "ecmascript/js_regexp_iterator.h"
89 #include "ecmascript/js_set.h"
90 #include "ecmascript/js_set_iterator.h"
91 #include "ecmascript/js_string_iterator.h"
92 #include "ecmascript/js_tagged_number.h"
93 #include "ecmascript/js_tagged_value-inl.h"
94 #include "ecmascript/js_thread.h"
95 #include "ecmascript/js_typed_array.h"
96 #include "ecmascript/js_weak_container.h"
97 #include "ecmascript/js_weak_ref.h"
98 #include "ecmascript/layout_info-inl.h"
99 #include "ecmascript/lexical_env.h"
100 #include "ecmascript/linked_hash_table.h"
101 #include "ecmascript/marker_cell.h"
102 #include "ecmascript/mem/assert_scope.h"
103 #include "ecmascript/mem/c_containers.h"
104 #include "ecmascript/mem/machine_code.h"
105 #include "ecmascript/module/js_module_namespace.h"
106 #include "ecmascript/module/js_module_source_text.h"
107 #include "ecmascript/require/js_cjs_module.h"
108 #include "ecmascript/require/js_cjs_module_cache.h"
109 #include "ecmascript/require/js_cjs_require.h"
110 #include "ecmascript/require/js_cjs_exports.h"
111 #include "ecmascript/tagged_array.h"
112 #include "ecmascript/tagged_dictionary.h"
113 #include "ecmascript/tagged_hash_array.h"
114 #include "ecmascript/tagged_list.h"
115 #include "ecmascript/tagged_tree.h"
116 #include "ecmascript/template_map.h"
117 #include "ecmascript/transitions_dictionary.h"
118 #include "ecmascript/ts_types/ts_type.h"
119 #include "ecmascript/js_displaynames.h"
120 #include "ecmascript/js_list_format.h"
121 #ifdef ARK_SUPPORT_INTL
122 #include "ecmascript/js_bigint.h"
123 #include "ecmascript/js_collator.h"
124 #include "ecmascript/js_date_time_format.h"
125 #include "ecmascript/js_intl.h"
126 #include "ecmascript/js_locale.h"
127 #include "ecmascript/js_relative_time_format.h"
128 #endif
129
130 namespace panda::ecmascript {
131 using MicroJobQueue = panda::ecmascript::job::MicroJobQueue;
132 using PendingJob = panda::ecmascript::job::PendingJob;
133
134 static constexpr uint32_t DUMP_TYPE_OFFSET = 12;
135 static constexpr uint32_t DUMP_PROPERTY_OFFSET = 20;
136 static constexpr uint32_t DUMP_ELEMENT_OFFSET = 2;
137
DumpJSType(JSType type)138 CString JSHClass::DumpJSType(JSType type)
139 {
140 switch (type) {
141 case JSType::HCLASS:
142 return "JSHClass";
143 case JSType::TAGGED_ARRAY:
144 return "TaggedArray";
145 case JSType::LEXICAL_ENV:
146 return "LexicalEnv";
147 case JSType::TAGGED_DICTIONARY:
148 return "TaggedDictionary";
149 case JSType::CONSTANT_POOL:
150 return "ConstantPool";
151 case JSType::PROFILE_TYPE_INFO:
152 return "ProfileTypeInfo";
153 case JSType::COW_TAGGED_ARRAY:
154 return "COWArray";
155 case JSType::MUTANT_TAGGED_ARRAY:
156 return "MutantTaggedArray";
157 case JSType::COW_MUTANT_TAGGED_ARRAY:
158 return "COWMutantTaggedArray";
159 case JSType::LINE_STRING:
160 case JSType::CONSTANT_STRING:
161 case JSType::TREE_STRING:
162 case JSType::SLICED_STRING:
163 return "BaseString";
164 case JSType::JS_NATIVE_POINTER:
165 return "NativePointer";
166 case JSType::JS_OBJECT:
167 return "Object";
168 case JSType::JS_SHARED_OBJECT:
169 return "SharedObject";
170 case JSType::JS_FUNCTION_BASE:
171 return "Function Base";
172 case JSType::JS_FUNCTION:
173 return "Function";
174 case JSType::JS_SHARED_FUNCTION:
175 return "Shared Function";
176 case JSType::JS_ERROR:
177 return "Error";
178 case JSType::JS_EVAL_ERROR:
179 return "Eval Error";
180 case JSType::JS_RANGE_ERROR:
181 return "Range Error";
182 case JSType::JS_TYPE_ERROR:
183 return "Type Error";
184 case JSType::JS_AGGREGATE_ERROR:
185 return "Aggregate Error";
186 case JSType::JS_REFERENCE_ERROR:
187 return "Reference Error";
188 case JSType::JS_URI_ERROR:
189 return "Uri Error";
190 case JSType::JS_SYNTAX_ERROR:
191 return "Syntax Error";
192 case JSType::JS_OOM_ERROR:
193 return "OutOfMemory Error";
194 case JSType::JS_TERMINATION_ERROR:
195 return "Termination Error";
196 case JSType::JS_REG_EXP:
197 return "Regexp";
198 case JSType::JS_SET:
199 return "Set";
200 case JSType::JS_MAP:
201 return "Map";
202 case JSType::JS_WEAK_SET:
203 return "WeakSet";
204 case JSType::JS_WEAK_MAP:
205 return "WeakMap";
206 case JSType::JS_WEAK_REF:
207 return "WeakRef";
208 case JSType::JS_FINALIZATION_REGISTRY:
209 return "JSFinalizationRegistry";
210 case JSType::CELL_RECORD:
211 return "CellRecord";
212 case JSType::JS_DATE:
213 return "Date";
214 case JSType::JS_BOUND_FUNCTION:
215 return "Bound Function";
216 case JSType::JS_ARRAY:
217 return "Array";
218 case JSType::JS_TYPED_ARRAY:
219 return "Typed Array";
220 case JSType::JS_INT8_ARRAY:
221 return "Int8 Array";
222 case JSType::JS_UINT8_ARRAY:
223 return "Uint8 Array";
224 case JSType::JS_UINT8_CLAMPED_ARRAY:
225 return "Uint8 Clamped Array";
226 case JSType::JS_INT16_ARRAY:
227 return "Int16 Array";
228 case JSType::JS_UINT16_ARRAY:
229 return "Uint16 Array";
230 case JSType::JS_INT32_ARRAY:
231 return "Int32 Array";
232 case JSType::JS_UINT32_ARRAY:
233 return "Uint32 Array";
234 case JSType::BIGINT:
235 return "BigInt";
236 case JSType::JS_FLOAT32_ARRAY:
237 return "Float32 Array";
238 case JSType::JS_FLOAT64_ARRAY:
239 return "Float64 Array";
240 case JSType::JS_BIGINT64_ARRAY:
241 return "BigInt64 Array";
242 case JSType::JS_BIGUINT64_ARRAY:
243 return "BigUint64 Array";
244 case JSType::BYTE_ARRAY:
245 return "ByteArray";
246 case JSType::JS_ARGUMENTS:
247 return "Arguments";
248 case JSType::JS_PROXY:
249 return "Proxy";
250 case JSType::JS_PRIMITIVE_REF:
251 return "Primitive";
252 case JSType::JS_DATA_VIEW:
253 return "DataView";
254 case JSType::JS_ITERATOR:
255 return "Iterator";
256 case JSType::JS_ASYNCITERATOR:
257 return "AsyncIterator";
258 case JSType::JS_FORIN_ITERATOR:
259 return "ForinInterator";
260 case JSType::JS_MAP_ITERATOR:
261 return "MapIterator";
262 case JSType::JS_SET_ITERATOR:
263 return "SetIterator";
264 case JSType::JS_ARRAY_ITERATOR:
265 return "ArrayIterator";
266 case JSType::JS_STRING_ITERATOR:
267 return "StringIterator";
268 case JSType::JS_REG_EXP_ITERATOR:
269 return "RegExpIterator";
270 case JSType::JS_ARRAY_BUFFER:
271 return "ArrayBuffer";
272 case JSType::JS_SHARED_ARRAY_BUFFER:
273 return "SharedArrayBuffer";
274 case JSType::JS_PROXY_REVOC_FUNCTION:
275 return "ProxyRevocFunction";
276 case JSType::PROMISE_REACTIONS:
277 return "PromiseReaction";
278 case JSType::PROMISE_CAPABILITY:
279 return "PromiseCapability";
280 case JSType::PROMISE_ITERATOR_RECORD:
281 return "PromiseIteratorRecord";
282 case JSType::PROMISE_RECORD:
283 return "PromiseRecord";
284 case JSType::RESOLVING_FUNCTIONS_RECORD:
285 return "ResolvingFunctionsRecord";
286 case JSType::ASYNC_GENERATOR_REQUEST:
287 return "AsyncGeneratorRequest";
288 case JSType::ASYNC_ITERATOR_RECORD:
289 return "AsyncIteratorRecord";
290 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR:
291 return "AsyncFromSyncIterator";
292 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION:
293 return "AsyncFromSyncIterUnwarpFunction";
294 case JSType::JS_PROMISE:
295 return "Promise";
296 case JSType::JS_PROMISE_REACTIONS_FUNCTION:
297 return "PromiseReactionsFunction";
298 case JSType::JS_PROMISE_EXECUTOR_FUNCTION:
299 return "PromiseExecutorFunction";
300 case JSType::JS_ASYNC_MODULE_FULFILLED_FUNCTION:
301 return "AsyncModuleFulfilledFunction";
302 case JSType::JS_ASYNC_MODULE_REJECTED_FUNCTION:
303 return "AsyncModuleRejectedFunction";
304 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION:
305 return "PromiseAllResolveElementFunction";
306 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION:
307 return "PromiseAnyRejectElementFunction";
308 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION:
309 return "PromiseAllSettledElementFunction";
310 case JSType::JS_PROMISE_FINALLY_FUNCTION:
311 return "PromiseFinallyFunction";
312 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION:
313 return "PromiseValueThunkOrThrowerFunction";
314 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN:
315 return "AsyncGeneratorResumeNextReturnProcessorRstFtn";
316 case JSType::MICRO_JOB_QUEUE:
317 return "MicroJobQueue";
318 case JSType::PENDING_JOB:
319 return "PendingJob";
320 case JSType::COMPLETION_RECORD:
321 return "CompletionRecord";
322 case JSType::GLOBAL_ENV:
323 return "GlobalEnv";
324 case JSType::ACCESSOR_DATA:
325 return "AccessorData";
326 case JSType::INTERNAL_ACCESSOR:
327 return "InternalAccessor";
328 case JSType::SYMBOL:
329 return "Symbol";
330 case JSType::PROPERTY_BOX:
331 return "PropertyBox";
332 case JSType::JS_ASYNC_FUNCTION:
333 return "AsyncFunction";
334 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION:
335 return "AsyncAwaitStatusFunction";
336 case JSType::JS_ASYNC_FUNC_OBJECT:
337 return "AsyncFunctionObject";
338 case JSType::JS_REALM:
339 return "Realm";
340 case JSType::JS_GLOBAL_OBJECT:
341 return "GlobalObject";
342 case JSType::JS_INTL:
343 return "JSIntl";
344 case JSType::JS_LOCALE:
345 return "JSLocale";
346 case JSType::JS_DATE_TIME_FORMAT:
347 return "JSDateTimeFormat";
348 case JSType::JS_RELATIVE_TIME_FORMAT:
349 return "JSRelativeTimeFormat";
350 case JSType::JS_NUMBER_FORMAT:
351 return "JSNumberFormat";
352 case JSType::JS_COLLATOR:
353 return "JSCollator";
354 case JSType::JS_PLURAL_RULES:
355 return "JSPluralRules";
356 case JSType::JS_DISPLAYNAMES:
357 return "JSDisplayNames";
358 case JSType::JS_LIST_FORMAT:
359 return "JSListFormat";
360 case JSType::JS_GENERATOR_OBJECT:
361 return "JSGeneratorObject";
362 case JSType::JS_ASYNC_GENERATOR_OBJECT:
363 return "JSAsyncGeneratorObject";
364 case JSType::JS_GENERATOR_CONTEXT:
365 return "JSGeneratorContext";
366 case JSType::PROTO_CHANGE_MARKER:
367 return "ProtoChangeMarker";
368 case JSType::MARKER_CELL:
369 return "MarkerCell";
370 case JSType::PROTOTYPE_INFO:
371 return "PrototypeInfo";
372 case JSType::PROGRAM:
373 return "program";
374 case JSType::MACHINE_CODE_OBJECT:
375 return "MachineCode";
376 case JSType::CLASS_INFO_EXTRACTOR:
377 return "ClassInfoExtractor";
378 case JSType::JS_API_ARRAY_LIST:
379 return "ArrayList";
380 case JSType::TS_OBJECT_TYPE:
381 return "TSObjectType";
382 case JSType::TS_CLASS_TYPE:
383 return "TSClassType";
384 case JSType::TS_INTERFACE_TYPE:
385 return "TSInterfaceType";
386 case JSType::TS_CLASS_INSTANCE_TYPE:
387 return "TSClassInstanceType";
388 case JSType::TS_UNION_TYPE:
389 return "TSUnionType";
390 case JSType::TS_FUNCTION_TYPE:
391 return "TSFunctionType";
392 case JSType::TS_ARRAY_TYPE:
393 return "TSArrayType";
394 case JSType::TS_ITERATOR_INSTANCE_TYPE:
395 return "TSIteratorInstanceType";
396 case JSType::TS_NAMESPACE_TYPE:
397 return "TSNamespaceType";
398 case JSType::JS_API_ARRAYLIST_ITERATOR:
399 return "JSArraylistIterator";
400 case JSType::LINKED_NODE:
401 return "LinkedNode";
402 case JSType::RB_TREENODE:
403 return "RBTreeNode";
404 case JSType::JS_API_HASH_MAP:
405 return "HashMap";
406 case JSType::JS_API_HASH_SET:
407 return "HashSet";
408 case JSType::JS_API_HASHMAP_ITERATOR:
409 return "HashMapIterator";
410 case JSType::JS_API_HASHSET_ITERATOR:
411 return "HashSetIterator";
412 case JSType::JS_API_LIGHT_WEIGHT_MAP:
413 return "LightWeightMap";
414 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR:
415 return "LightWeightMapIterator";
416 case JSType::JS_API_LIGHT_WEIGHT_SET:
417 return "LightWeightSet";
418 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR:
419 return "LightWeightSetIterator";
420 case JSType::JS_API_TREE_MAP:
421 return "TreeMap";
422 case JSType::JS_API_TREE_SET:
423 return "TreeSet";
424 case JSType::JS_API_TREEMAP_ITERATOR:
425 return "TreeMapIterator";
426 case JSType::JS_API_TREESET_ITERATOR:
427 return "TreeSetIterator";
428 case JSType::JS_API_VECTOR:
429 return "Vector";
430 case JSType::JS_API_VECTOR_ITERATOR:
431 return "VectorIterator";
432 case JSType::JS_API_QUEUE:
433 return "Queue";
434 case JSType::JS_API_QUEUE_ITERATOR:
435 return "QueueIterator";
436 case JSType::JS_API_PLAIN_ARRAY:
437 return "PlainArray";
438 case JSType::JS_API_PLAIN_ARRAY_ITERATOR:
439 return "PlainArrayIterator";
440 case JSType::JS_API_DEQUE:
441 return "Deque";
442 case JSType::JS_API_DEQUE_ITERATOR:
443 return "DequeIterator";
444 case JSType::JS_API_STACK:
445 return "Stack";
446 case JSType::JS_API_STACK_ITERATOR:
447 return "StackIterator";
448 case JSType::JS_API_LIST:
449 return "List";
450 case JSType::JS_API_LIST_ITERATOR:
451 return "ListIterator";
452 case JSType::JS_API_LINKED_LIST:
453 return "LinkedList";
454 case JSType::JS_API_LINKED_LIST_ITERATOR:
455 return "LinkedListIterator";
456 case JSType::JS_CJS_EXPORTS:
457 return "CommonJSExports";
458 case JSType::JS_CJS_MODULE:
459 return "CommonJSModule";
460 case JSType::JS_CJS_REQUIRE:
461 return "CommonJSRequire";
462 case JSType::METHOD:
463 return "Method";
464 case JSType::AOT_LITERAL_INFO:
465 return "AOTLiteralInfo";
466 case JSType::CLASS_LITERAL:
467 return "ClassLiteral";
468 case JSType::VTABLE:
469 return "VTable";
470 case JSType::SOURCE_TEXT_MODULE_RECORD:
471 return "SourceTextModuleRecord";
472 case JSType::RESOLVEDBINDING_RECORD:
473 return "ResolvedBingingRecord";
474 case JSType::RESOLVEDINDEXBINDING_RECORD:
475 return "ResolvedIndexBingingRecord";
476 case JSType::IMPORTENTRY_RECORD:
477 return "ImportEntry";
478 case JSType::LOCAL_EXPORTENTRY_RECORD:
479 return "LocalExportEntry";
480 case JSType::STAR_EXPORTENTRY_RECORD:
481 return "StarExportEntry";
482 default: {
483 CString ret = "unknown type ";
484 return ret + static_cast<char>(type);
485 }
486 }
487 }
488
DumpArrayClass(const TaggedArray * arr,std::ostream & os)489 static void DumpArrayClass(const TaggedArray *arr, std::ostream &os)
490 {
491 DISALLOW_GARBAGE_COLLECTION;
492 uint32_t len = arr->GetLength();
493 os << " <TaggedArray[" << std::dec << len << "]>\n";
494 for (uint32_t i = 0; i < len; i++) {
495 JSTaggedValue val(arr->Get(i));
496 if (!val.IsHole()) {
497 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
498 val.DumpTaggedValue(os);
499 os << "\n";
500 }
501 }
502 }
503
DumpMutantTaggedArray(const MutantTaggedArray * arr,std::ostream & os)504 static void DumpMutantTaggedArray(const MutantTaggedArray *arr, std::ostream &os)
505 {
506 DISALLOW_GARBAGE_COLLECTION;
507 uint32_t len = arr->GetLength();
508 os << " <MutantTaggedArray[" << std::dec << len << "]>\n";
509 for (uint32_t i = 0; i < len; i++) {
510 JSTaggedValue val(arr->Get(i));
511 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
512 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[JSTaggedType] : " << val.GetRawData();
513 os << "\n";
514 }
515 }
516
DumpCOWMutantTaggedArray(const COWMutantTaggedArray * arr,std::ostream & os)517 static void DumpCOWMutantTaggedArray(const COWMutantTaggedArray *arr, std::ostream &os)
518 {
519 DISALLOW_GARBAGE_COLLECTION;
520 uint32_t len = arr->GetLength();
521 os << " <COWMutantTaggedArray[" << std::dec << len << "]>\n";
522 for (uint32_t i = 0; i < len; i++) {
523 JSTaggedValue val(arr->Get(i));
524 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
525 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[JSTaggedType] : " << val.GetRawData();
526 os << "\n";
527 }
528 }
529
DumpConstantPoolClass(const ConstantPool * pool,std::ostream & os)530 static void DumpConstantPoolClass(const ConstantPool *pool, std::ostream &os)
531 {
532 DISALLOW_GARBAGE_COLLECTION;
533 uint32_t len = pool->GetCacheLength();
534 os << " <ConstantPool[" << std::dec << len << "]>\n";
535 for (uint32_t i = 0; i < len; i++) {
536 JSTaggedValue val(pool->GetObjectFromCache(i));
537 if (!val.IsHole()) {
538 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
539 val.DumpTaggedValue(os);
540 os << "\n";
541 }
542 }
543 }
544
DumpStringClass(const EcmaString * str,std::ostream & os)545 static void DumpStringClass(const EcmaString *str, std::ostream &os)
546 {
547 DISALLOW_GARBAGE_COLLECTION;
548 CString string = ConvertToString(str);
549 os << string;
550 }
551
DumpPropertyKey(JSTaggedValue key,std::ostream & os)552 static void DumpPropertyKey(JSTaggedValue key, std::ostream &os)
553 {
554 if (key.IsString()) {
555 DumpStringClass(EcmaString::Cast(key.GetTaggedObject()), os);
556 } else if (key.IsSymbol()) {
557 JSSymbol *sym = JSSymbol::Cast(key.GetTaggedObject());
558 if (sym->GetDescription().IsString()) {
559 os << "Symbol(\"";
560 DumpStringClass(EcmaString::Cast(sym->GetDescription().GetTaggedObject()), os);
561 os << "\")";
562 } else {
563 os << "Symbol(" << sym << ")";
564 }
565 } else {
566 LOG_ECMA(FATAL) << "this branch is unreachable";
567 UNREACHABLE();
568 }
569 }
570
DumpAttr(const PropertyAttributes & attr,bool fastMode,std::ostream & os)571 static void DumpAttr(const PropertyAttributes &attr, bool fastMode, std::ostream &os)
572 {
573 if (attr.IsAccessor()) {
574 os << "(Accessor) ";
575 }
576
577 os << "Attr(";
578 os << "[Raw: " << std::hex << attr.GetValue() << "] ";
579 if (attr.IsNoneAttributes()) {
580 os << "NONE";
581 }
582 if (attr.IsWritable()) {
583 os << "W";
584 }
585 if (attr.IsEnumerable()) {
586 os << "E";
587 }
588 if (attr.IsConfigurable()) {
589 os << "C";
590 }
591
592 os << ")";
593
594 os << " Rep: " << static_cast<int>(attr.GetRepresentation());
595
596 os << " InlinedProps: " << attr.IsInlinedProps();
597
598 if (fastMode) {
599 os << " Order: " << std::dec << attr.GetOffset();
600 os << " SortedIndex: " << std::dec << attr.GetSortedIndex();
601 } else {
602 os << " Order: " << std::dec << attr.GetDictionaryOrder();
603 }
604 }
605
DumpHClass(const JSHClass * jshclass,std::ostream & os,bool withDetail)606 static void DumpHClass(const JSHClass *jshclass, std::ostream &os, bool withDetail)
607 {
608 DISALLOW_GARBAGE_COLLECTION;
609 os << "JSHClass :" << std::setw(DUMP_TYPE_OFFSET);
610 os << "Type :" << JSHClass::DumpJSType(jshclass->GetObjectType()) << "\n";
611
612 os << " - Prototype :" << std::setw(DUMP_TYPE_OFFSET);
613 jshclass->GetPrototype().DumpTaggedValue(os);
614 os << "\n";
615 os << " - PropertyDescriptors :" << std::setw(DUMP_TYPE_OFFSET);
616 JSTaggedValue attrs = jshclass->GetLayout();
617 attrs.DumpTaggedValue(os);
618 os << "\n";
619 if (withDetail && !attrs.IsNull()) {
620 LayoutInfo *layout = LayoutInfo::Cast(jshclass->GetLayout().GetTaggedObject());
621 int element = static_cast<int>(jshclass->NumberOfProps());
622 for (int i = 0; i < element; i++) {
623 JSTaggedValue key = layout->GetKey(i);
624 PropertyAttributes attr = layout->GetAttr(i);
625 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
626 os << "[" << i << "]: ";
627 DumpPropertyKey(key, os);
628 os << " : ";
629 DumpAttr(attr, true, os);
630 os << "\n";
631 }
632 }
633
634 os << " - Transitions :" << std::setw(DUMP_TYPE_OFFSET);
635 JSTaggedValue transtions = jshclass->GetTransitions();
636 transtions.DumpTaggedValue(os);
637 os << "\n";
638 if (withDetail && !transtions.IsWeakForHeapObject() && transtions.IsDictionary()) {
639 transtions.Dump(os);
640 }
641
642 os << " - ProtoChangeMarker :" << std::setw(DUMP_TYPE_OFFSET);
643 JSTaggedValue marker = jshclass->GetProtoChangeMarker();
644 marker.DumpTaggedValue(os);
645 if (marker.IsHeapObject()) {
646 ProtoChangeMarker::Cast(marker.GetTaggedObject())->Dump(os);
647 } else {
648 os << "\n";
649 }
650
651 os << " - ProtoChangeDetails :" << std::setw(DUMP_TYPE_OFFSET);
652 JSTaggedValue details = jshclass->GetProtoChangeDetails();
653 details.DumpTaggedValue(os);
654 if (details.IsHeapObject()) {
655 ProtoChangeDetails::Cast(details.GetTaggedObject())->Dump(os);
656 } else {
657 os << "\n";
658 }
659
660 JSTaggedValue supers = jshclass->GetSupers();
661 uint32_t length = 0;
662 if (supers.IsTaggedArray()) {
663 length = WeakVector::Cast(supers.GetTaggedObject())->GetExtraLength();
664 }
665 os << " - Supers[" << std::dec << length << "]: ";
666 os << std::setw(DUMP_TYPE_OFFSET);
667 supers.DumpTaggedValue(os);
668 if (withDetail && !supers.IsUndefined()) {
669 WeakVector::Cast(supers.GetTaggedObject())->Dump(os);
670 } else {
671 os << "\n";
672 }
673
674 os << " - VTable :" << std::setw(DUMP_TYPE_OFFSET);
675 JSTaggedValue vtable = jshclass->GetVTable();
676 vtable.DumpTaggedValue(os);
677 if (withDetail && !vtable.IsUndefined()) {
678 VTable::Cast(vtable.GetTaggedObject())->Dump(os);
679 } else {
680 os << "\n";
681 }
682
683 os << " - Flags : " << std::setw(DUMP_TYPE_OFFSET);
684 os << "IsCtor :" << std::boolalpha << jshclass->IsConstructor();
685 os << "| IsCallable :" << std::boolalpha << jshclass->IsCallable();
686 os << "| IsExtensible :" << std::boolalpha << jshclass->IsExtensible();
687 os << "| ElementsKind :" << Elements::GetString(jshclass->GetElementsKind());
688 os << "| NumberOfProps :" << std::dec << jshclass->NumberOfProps();
689 os << "| InlinedProperties :" << std::dec << jshclass->GetInlinedProperties();
690 os << "| IsTS :" << std::boolalpha << jshclass->IsTS();
691 os << "| Level :" << std::dec << static_cast<int>(jshclass->GetLevel());
692 os << "\n";
693 }
694
DumpClass(TaggedObject * obj,std::ostream & os)695 static void DumpClass(TaggedObject *obj, std::ostream &os)
696 {
697 ASSERT(obj->GetClass()->GetObjectType() == JSType::HCLASS);
698 DumpHClass(JSHClass::Cast(obj), os, true);
699 }
700
DumpObject(TaggedObject * obj,std::ostream & os)701 static void DumpObject(TaggedObject *obj, std::ostream &os)
702 {
703 DISALLOW_GARBAGE_COLLECTION;
704 auto jsHclass = obj->GetClass();
705 JSType type = jsHclass->GetObjectType();
706
707 bool needDumpHClass = false;
708 switch (type) {
709 case JSType::HCLASS:
710 return DumpClass(obj, os);
711 case JSType::TAGGED_ARRAY:
712 case JSType::TAGGED_DICTIONARY:
713 case JSType::TEMPLATE_MAP:
714 case JSType::LEXICAL_ENV:
715 case JSType::COW_TAGGED_ARRAY:
716 case JSType::AOT_LITERAL_INFO:
717 DumpArrayClass(TaggedArray::Cast(obj), os);
718 break;
719 case JSType::MUTANT_TAGGED_ARRAY:
720 DumpMutantTaggedArray(MutantTaggedArray::Cast(obj), os);
721 break;
722 case JSType::COW_MUTANT_TAGGED_ARRAY:
723 DumpCOWMutantTaggedArray(COWMutantTaggedArray::Cast(obj), os);
724 break;
725 case JSType::CONSTANT_POOL:
726 DumpConstantPoolClass(ConstantPool::Cast(obj), os);
727 break;
728 case JSType::PROFILE_TYPE_INFO:
729 ProfileTypeInfo::Cast(obj)->Dump(os);
730 break;
731 case JSType::VTABLE:
732 VTable::Cast(obj)->Dump(os);
733 break;
734 case JSType::LINE_STRING:
735 case JSType::CONSTANT_STRING:
736 case JSType::TREE_STRING:
737 case JSType::SLICED_STRING:
738 DumpStringClass(EcmaString::Cast(obj), os);
739 os << "\n";
740 break;
741 case JSType::JS_NATIVE_POINTER:
742 break;
743 case JSType::JS_OBJECT:
744 case JSType::JS_SHARED_OBJECT:
745 case JSType::JS_GLOBAL_OBJECT:
746 case JSType::JS_ERROR:
747 case JSType::JS_EVAL_ERROR:
748 case JSType::JS_RANGE_ERROR:
749 case JSType::JS_TYPE_ERROR:
750 case JSType::JS_AGGREGATE_ERROR:
751 case JSType::JS_REFERENCE_ERROR:
752 case JSType::JS_URI_ERROR:
753 case JSType::JS_SYNTAX_ERROR:
754 case JSType::JS_OOM_ERROR:
755 case JSType::JS_TERMINATION_ERROR:
756 case JSType::JS_ARGUMENTS:
757 needDumpHClass = true;
758 JSObject::Cast(obj)->Dump(os);
759 break;
760 case JSType::JS_FUNCTION_BASE:
761 needDumpHClass = true;
762 JSFunctionBase::Cast(obj)->Dump(os);
763 break;
764 case JSType::GLOBAL_ENV:
765 GlobalEnv::Cast(obj)->Dump(os);
766 break;
767 case JSType::ACCESSOR_DATA:
768 break;
769 case JSType::JS_SHARED_FUNCTION:
770 case JSType::JS_FUNCTION:
771 needDumpHClass = true;
772 JSFunction::Cast(obj)->Dump(os);
773 break;
774 case JSType::JS_BOUND_FUNCTION:
775 needDumpHClass = true;
776 JSBoundFunction::Cast(obj)->Dump(os);
777 break;
778 case JSType::JS_SET:
779 needDumpHClass = true;
780 JSSet::Cast(obj)->Dump(os);
781 break;
782 case JSType::JS_MAP:
783 needDumpHClass = true;
784 JSMap::Cast(obj)->Dump(os);
785 break;
786 case JSType::JS_WEAK_SET:
787 needDumpHClass = true;
788 JSWeakSet::Cast(obj)->Dump(os);
789 break;
790 case JSType::JS_WEAK_MAP:
791 needDumpHClass = true;
792 JSWeakMap::Cast(obj)->Dump(os);
793 break;
794 case JSType::JS_WEAK_REF:
795 needDumpHClass = true;
796 JSWeakRef::Cast(obj)->Dump(os);
797 break;
798 case JSType::JS_FINALIZATION_REGISTRY:
799 JSFinalizationRegistry::Cast(obj)->Dump(os);
800 break;
801 case JSType::CELL_RECORD:
802 CellRecord::Cast(obj)->Dump(os);
803 break;
804 case JSType::JS_REG_EXP:
805 needDumpHClass = true;
806 JSRegExp::Cast(obj)->Dump(os);
807 break;
808 case JSType::JS_DATE:
809 needDumpHClass = true;
810 JSDate::Cast(obj)->Dump(os);
811 break;
812 case JSType::JS_ARRAY:
813 needDumpHClass = true;
814 JSArray::Cast(obj)->Dump(os);
815 break;
816 case JSType::JS_TYPED_ARRAY:
817 case JSType::JS_INT8_ARRAY:
818 case JSType::JS_UINT8_ARRAY:
819 case JSType::JS_UINT8_CLAMPED_ARRAY:
820 case JSType::JS_INT16_ARRAY:
821 case JSType::JS_UINT16_ARRAY:
822 case JSType::JS_INT32_ARRAY:
823 case JSType::JS_UINT32_ARRAY:
824 case JSType::JS_FLOAT32_ARRAY:
825 case JSType::JS_FLOAT64_ARRAY:
826 case JSType::JS_BIGINT64_ARRAY:
827 case JSType::JS_BIGUINT64_ARRAY:
828 needDumpHClass = true;
829 JSTypedArray::Cast(obj)->Dump(os);
830 break;
831 case JSType::BIGINT:
832 BigInt::Cast(obj)->Dump(os);
833 break;
834 case JSType::BYTE_ARRAY:
835 ByteArray::Cast(obj)->Dump(os);
836 break;
837 case JSType::JS_PROXY:
838 needDumpHClass = true;
839 JSProxy::Cast(obj)->Dump(os);
840 break;
841 case JSType::JS_PRIMITIVE_REF:
842 JSPrimitiveRef::Cast(obj)->Dump(os);
843 break;
844 case JSType::SYMBOL:
845 JSSymbol::Cast(obj)->Dump(os);
846 break;
847 case JSType::JS_DATA_VIEW:
848 JSDataView::Cast(obj)->Dump(os);
849 break;
850 case JSType::JS_ARRAY_BUFFER:
851 JSArrayBuffer::Cast(obj)->Dump(os);
852 break;
853 case JSType::JS_SHARED_ARRAY_BUFFER:
854 JSArrayBuffer::Cast(obj)->Dump(os);
855 break;
856 case JSType::PROMISE_REACTIONS:
857 PromiseReaction::Cast(obj)->Dump(os);
858 break;
859 case JSType::PROMISE_CAPABILITY:
860 PromiseCapability::Cast(obj)->Dump(os);
861 break;
862 case JSType::PROMISE_ITERATOR_RECORD:
863 PromiseIteratorRecord::Cast(obj)->Dump(os);
864 break;
865 case JSType::PROMISE_RECORD:
866 PromiseRecord::Cast(obj)->Dump(os);
867 break;
868 case JSType::RESOLVING_FUNCTIONS_RECORD:
869 ResolvingFunctionsRecord::Cast(obj)->Dump(os);
870 break;
871 case JSType::JS_PROMISE:
872 needDumpHClass = true;
873 JSPromise::Cast(obj)->Dump(os);
874 break;
875 case JSType::JS_PROMISE_REACTIONS_FUNCTION:
876 JSPromiseReactionsFunction::Cast(obj)->Dump(os);
877 break;
878 case JSType::JS_PROMISE_EXECUTOR_FUNCTION:
879 JSPromiseExecutorFunction::Cast(obj)->Dump(os);
880 break;
881 case JSType::JS_ASYNC_MODULE_FULFILLED_FUNCTION:
882 JSAsyncModuleFulfilledFunction::Cast(obj)->Dump(os);
883 break;
884 case JSType::JS_ASYNC_MODULE_REJECTED_FUNCTION:
885 JSAsyncModuleRejectedFunction::Cast(obj)->Dump(os);
886 break;
887 case JSType::ASYNC_GENERATOR_REQUEST:
888 AsyncGeneratorRequest::Cast(obj)->Dump(os);
889 break;
890 case JSType::ASYNC_ITERATOR_RECORD:
891 AsyncIteratorRecord::Cast(obj)->Dump(os);
892 break;
893 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR:
894 JSAsyncFromSyncIterator::Cast(obj)->Dump(os);
895 break;
896 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION:
897 JSAsyncFromSyncIterUnwarpFunction::Cast(obj)->Dump(os);
898 break;
899 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION:
900 JSPromiseAllResolveElementFunction::Cast(obj)->Dump(os);
901 break;
902 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION:
903 JSPromiseAnyRejectElementFunction::Cast(obj)->Dump(os);
904 break;
905 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION:
906 JSPromiseAllSettledElementFunction::Cast(obj)->Dump(os);
907 break;
908 case JSType::JS_PROMISE_FINALLY_FUNCTION:
909 JSPromiseFinallyFunction::Cast(obj)->Dump(os);
910 break;
911 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION:
912 JSPromiseValueThunkOrThrowerFunction::Cast(obj)->Dump(os);
913 break;
914 case JSType::MICRO_JOB_QUEUE:
915 MicroJobQueue::Cast(obj)->Dump(os);
916 break;
917 case JSType::PENDING_JOB:
918 PendingJob::Cast(obj)->Dump(os);
919 break;
920 case JSType::COMPLETION_RECORD:
921 CompletionRecord::Cast(obj)->Dump(os);
922 break;
923 case JSType::JS_PROXY_REVOC_FUNCTION:
924 JSProxyRevocFunction::Cast(obj)->Dump(os);
925 break;
926 case JSType::JS_ASYNC_FUNCTION:
927 needDumpHClass = true;
928 JSAsyncFunction::Cast(obj)->Dump(os);
929 break;
930 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION:
931 JSAsyncAwaitStatusFunction::Cast(obj)->Dump(os);
932 break;
933 case JSType::JS_GENERATOR_FUNCTION:
934 JSGeneratorFunction::Cast(obj)->Dump(os);
935 break;
936 case JSType::JS_ASYNC_GENERATOR_FUNCTION:
937 needDumpHClass = true;
938 JSAsyncGeneratorFunction::Cast(obj)->Dump(os);
939 break;
940 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN:
941 JSAsyncGeneratorResNextRetProRstFtn::Cast(obj)->Dump(os);
942 break;
943 case JSType::JS_INTL_BOUND_FUNCTION:
944 JSIntlBoundFunction::Cast(obj)->Dump(os);
945 break;
946 case JSType::JS_ITERATOR:
947 break;
948 case JSType::JS_ASYNCITERATOR:
949 break;
950 case JSType::JS_FORIN_ITERATOR:
951 JSForInIterator::Cast(obj)->Dump(os);
952 break;
953 case JSType::JS_MAP_ITERATOR:
954 JSMapIterator::Cast(obj)->Dump(os);
955 break;
956 case JSType::JS_SET_ITERATOR:
957 JSSetIterator::Cast(obj)->Dump(os);
958 break;
959 case JSType::JS_REG_EXP_ITERATOR:
960 JSRegExpIterator::Cast(obj)->Dump(os);
961 break;
962 case JSType::JS_ARRAY_ITERATOR:
963 JSArrayIterator::Cast(obj)->Dump(os);
964 break;
965 case JSType::JS_STRING_ITERATOR:
966 JSStringIterator::Cast(obj)->Dump(os);
967 break;
968 case JSType::PROTOTYPE_HANDLER:
969 PrototypeHandler::Cast(obj)->Dump(os);
970 break;
971 case JSType::TRANSITION_HANDLER:
972 TransitionHandler::Cast(obj)->Dump(os);
973 break;
974 case JSType::TRANS_WITH_PROTO_HANDLER:
975 TransWithProtoHandler::Cast(obj)->Dump(os);
976 break;
977 case JSType::STORE_TS_HANDLER:
978 StoreTSHandler::Cast(obj)->Dump(os);
979 break;
980 case JSType::PROPERTY_BOX:
981 PropertyBox::Cast(obj)->Dump(os);
982 break;
983 case JSType::JS_REALM:
984 needDumpHClass = true;
985 JSRealm::Cast(obj)->Dump(os);
986 break;
987 #ifdef ARK_SUPPORT_INTL
988 case JSType::JS_INTL:
989 needDumpHClass = true;
990 JSIntl::Cast(obj)->Dump(os);
991 break;
992 case JSType::JS_LOCALE:
993 needDumpHClass = true;
994 JSLocale::Cast(obj)->Dump(os);
995 break;
996 case JSType::JS_DATE_TIME_FORMAT:
997 JSDateTimeFormat::Cast(obj)->Dump(os);
998 break;
999 case JSType::JS_RELATIVE_TIME_FORMAT:
1000 JSRelativeTimeFormat::Cast(obj)->Dump(os);
1001 break;
1002 case JSType::JS_NUMBER_FORMAT:
1003 JSNumberFormat::Cast(obj)->Dump(os);
1004 break;
1005 case JSType::JS_COLLATOR:
1006 needDumpHClass = true;
1007 JSCollator::Cast(obj)->Dump(os);
1008 break;
1009 case JSType::JS_PLURAL_RULES:
1010 JSPluralRules::Cast(obj)->Dump(os);
1011 break;
1012 case JSType::JS_DISPLAYNAMES:
1013 JSDisplayNames::Cast(obj)->Dump(os);
1014 break;
1015 case JSType::JS_LIST_FORMAT:
1016 JSListFormat::Cast(obj)->Dump(os);
1017 break;
1018 #else
1019 case JSType::JS_INTL:
1020 case JSType::JS_LOCALE:
1021 case JSType::JS_DATE_TIME_FORMAT:
1022 case JSType::JS_RELATIVE_TIME_FORMAT:
1023 case JSType::JS_NUMBER_FORMAT:
1024 case JSType::JS_COLLATOR:
1025 case JSType::JS_PLURAL_RULES:
1026 case JSType::JS_DISPLAYNAMES:
1027 case JSType::JS_LIST_FORMAT:
1028 break;
1029 #endif
1030 case JSType::JS_GENERATOR_OBJECT:
1031 needDumpHClass = true;
1032 JSGeneratorObject::Cast(obj)->Dump(os);
1033 break;
1034 case JSType::JS_ASYNC_GENERATOR_OBJECT:
1035 needDumpHClass = true;
1036 JSAsyncGeneratorObject::Cast(obj)->Dump(os);
1037 break;
1038 case JSType::JS_ASYNC_FUNC_OBJECT:
1039 needDumpHClass = true;
1040 JSAsyncFuncObject::Cast(obj)->Dump(os);
1041 break;
1042 case JSType::JS_GENERATOR_CONTEXT:
1043 GeneratorContext::Cast(obj)->Dump(os);
1044 break;
1045 case JSType::PROTOTYPE_INFO:
1046 ProtoChangeDetails::Cast(obj)->Dump(os);
1047 break;
1048 case JSType::TRACK_INFO:
1049 TrackInfo::Cast(obj)->Dump(os);
1050 break;
1051 case JSType::PROTO_CHANGE_MARKER:
1052 ProtoChangeMarker::Cast(obj)->Dump(os);
1053 break;
1054 case JSType::MARKER_CELL:
1055 MarkerCell::Cast(obj)->Dump(os);
1056 break;
1057 case JSType::PROGRAM:
1058 Program::Cast(obj)->Dump(os);
1059 break;
1060 case JSType::MACHINE_CODE_OBJECT:
1061 MachineCode::Cast(obj)->Dump(os);
1062 break;
1063 case JSType::CLASS_INFO_EXTRACTOR:
1064 ClassInfoExtractor::Cast(obj)->Dump(os);
1065 break;
1066 case JSType::JS_API_ARRAY_LIST:
1067 JSAPIArrayList::Cast(obj)->Dump(os);
1068 break;
1069 case JSType::JS_API_ARRAYLIST_ITERATOR:
1070 JSAPIArrayListIterator::Cast(obj)->Dump(os);
1071 break;
1072 case JSType::JS_API_LIGHT_WEIGHT_MAP:
1073 JSAPILightWeightMap::Cast(obj)->Dump(os);
1074 break;
1075 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR:
1076 JSAPILightWeightMapIterator::Cast(obj)->Dump(os);
1077 break;
1078 case JSType::JS_API_LIGHT_WEIGHT_SET:
1079 JSAPILightWeightSet::Cast(obj)->Dump(os);
1080 break;
1081 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR:
1082 JSAPILightWeightSetIterator::Cast(obj)->Dump(os);
1083 break;
1084 case JSType::TS_OBJECT_TYPE:
1085 TSObjectType::Cast(obj)->Dump(os);
1086 break;
1087 case JSType::TS_CLASS_TYPE:
1088 TSClassType::Cast(obj)->Dump(os);
1089 break;
1090 case JSType::TS_INTERFACE_TYPE:
1091 TSInterfaceType::Cast(obj)->Dump(os);
1092 break;
1093 case JSType::TS_CLASS_INSTANCE_TYPE:
1094 TSClassInstanceType::Cast(obj)->Dump(os);
1095 break;
1096 case JSType::TS_UNION_TYPE:
1097 TSUnionType::Cast(obj)->Dump(os);
1098 break;
1099 case JSType::TS_FUNCTION_TYPE:
1100 TSFunctionType::Cast(obj)->Dump(os);
1101 break;
1102 case JSType::TS_ARRAY_TYPE:
1103 TSArrayType::Cast(obj)->Dump(os);
1104 break;
1105 case JSType::TS_ITERATOR_INSTANCE_TYPE:
1106 TSIteratorInstanceType::Cast(obj)->Dump(os);
1107 break;
1108 case JSType::TS_NAMESPACE_TYPE:
1109 TSNamespaceType::Cast(obj)->Dump(os);
1110 break;
1111 case JSType::LINKED_NODE:
1112 LinkedNode::Cast(obj)->Dump(os);
1113 break;
1114 case JSType::RB_TREENODE:
1115 break;
1116 case JSType::JS_API_HASH_MAP:
1117 JSAPIHashMap::Cast(obj)->Dump(os);
1118 break;
1119 case JSType::JS_API_HASH_SET:
1120 JSAPIHashSet::Cast(obj)->Dump(os);
1121 break;
1122 case JSType::JS_API_HASHMAP_ITERATOR:
1123 JSAPIHashMapIterator::Cast(obj)->Dump(os);
1124 break;
1125 case JSType::JS_API_HASHSET_ITERATOR:
1126 JSAPIHashSetIterator::Cast(obj)->Dump(os);
1127 break;
1128 case JSType::JS_API_TREE_MAP:
1129 JSAPITreeMap::Cast(obj)->Dump(os);
1130 break;
1131 case JSType::JS_API_TREE_SET:
1132 JSAPITreeSet::Cast(obj)->Dump(os);
1133 break;
1134 case JSType::JS_API_TREEMAP_ITERATOR:
1135 JSAPITreeMapIterator::Cast(obj)->Dump(os);
1136 break;
1137 case JSType::JS_API_TREESET_ITERATOR:
1138 JSAPITreeSetIterator::Cast(obj)->Dump(os);
1139 break;
1140 case JSType::JS_API_VECTOR:
1141 JSAPIVector::Cast(obj)->Dump(os);
1142 break;
1143 case JSType::JS_API_VECTOR_ITERATOR:
1144 JSAPIVectorIterator::Cast(obj)->Dump(os);
1145 break;
1146 case JSType::JS_API_QUEUE:
1147 JSAPIQueue::Cast(obj)->Dump(os);
1148 break;
1149 case JSType::JS_API_QUEUE_ITERATOR:
1150 JSAPIQueueIterator::Cast(obj)->Dump(os);
1151 break;
1152 case JSType::JS_API_DEQUE:
1153 JSAPIDeque::Cast(obj)->Dump(os);
1154 break;
1155 case JSType::JS_API_DEQUE_ITERATOR:
1156 JSAPIDequeIterator::Cast(obj)->Dump(os);
1157 break;
1158 case JSType::JS_API_STACK:
1159 JSAPIStack::Cast(obj)->Dump(os);
1160 break;
1161 case JSType::JS_API_STACK_ITERATOR:
1162 JSAPIStackIterator::Cast(obj)->Dump(os);
1163 break;
1164 case JSType::JS_API_LIST:
1165 JSAPIList::Cast(obj)->Dump(os);
1166 break;
1167 case JSType::JS_API_LIST_ITERATOR:
1168 JSAPIListIterator::Cast(obj)->Dump(os);
1169 break;
1170 case JSType::JS_API_LINKED_LIST:
1171 JSAPILinkedList::Cast(obj)->Dump(os);
1172 break;
1173 case JSType::JS_API_LINKED_LIST_ITERATOR:
1174 JSAPILinkedListIterator::Cast(obj)->Dump(os);
1175 break;
1176 case JSType::SOURCE_TEXT_MODULE_RECORD:
1177 SourceTextModule::Cast(obj)->Dump(os);
1178 break;
1179 case JSType::IMPORTENTRY_RECORD:
1180 ImportEntry::Cast(obj)->Dump(os);
1181 break;
1182 case JSType::LOCAL_EXPORTENTRY_RECORD:
1183 LocalExportEntry::Cast(obj)->Dump(os);
1184 break;
1185 case JSType::INDIRECT_EXPORTENTRY_RECORD:
1186 IndirectExportEntry::Cast(obj)->Dump(os);
1187 break;
1188 case JSType::STAR_EXPORTENTRY_RECORD:
1189 StarExportEntry::Cast(obj)->Dump(os);
1190 break;
1191 case JSType::RESOLVEDBINDING_RECORD:
1192 ResolvedBinding::Cast(obj)->Dump(os);
1193 break;
1194 case JSType::RESOLVEDINDEXBINDING_RECORD:
1195 ResolvedIndexBinding::Cast(obj)->Dump(os);
1196 break;
1197 case JSType::JS_MODULE_NAMESPACE:
1198 ModuleNamespace::Cast(obj)->Dump(os);
1199 break;
1200 case JSType::JS_API_PLAIN_ARRAY:
1201 JSAPIPlainArray::Cast(obj)->Dump(os);
1202 break;
1203 case JSType::JS_API_PLAIN_ARRAY_ITERATOR:
1204 JSAPIPlainArrayIterator::Cast(obj)->Dump(os);
1205 break;
1206 case JSType::JS_CJS_MODULE:
1207 CjsModule::Cast(obj)->Dump(os);
1208 break;
1209 case JSType::JS_CJS_REQUIRE:
1210 CjsRequire::Cast(obj)->Dump(os);
1211 break;
1212 case JSType::JS_CJS_EXPORTS:
1213 CjsExports::Cast(obj)->Dump(os);
1214 break;
1215 case JSType::METHOD:
1216 Method::Cast(obj)->Dump(os);
1217 break;
1218 case JSType::CLASS_LITERAL:
1219 ClassLiteral::Cast(obj)->Dump(os);
1220 break;
1221 default:
1222 LOG_ECMA(FATAL) << "this branch is unreachable";
1223 UNREACHABLE();
1224 break;
1225 }
1226
1227 if (needDumpHClass) {
1228 DumpHClass(jsHclass, os, false);
1229 }
1230 }
1231
DumpSpecialValue(std::ostream & os) const1232 void JSTaggedValue::DumpSpecialValue(std::ostream &os) const
1233 {
1234 ASSERT(IsSpecial());
1235 os << "[Special Value] : ";
1236 switch (GetRawData()) {
1237 case VALUE_HOLE:
1238 os << "Hole";
1239 break;
1240 case VALUE_NULL:
1241 os << "Null";
1242 break;
1243 case VALUE_FALSE:
1244 os << "False";
1245 break;
1246 case VALUE_TRUE:
1247 os << "True";
1248 break;
1249 case VALUE_UNDEFINED:
1250 os << "Undefined";
1251 break;
1252 case VALUE_EXCEPTION:
1253 os << "Exception";
1254 break;
1255 default:
1256 LOG_ECMA(FATAL) << "this branch is unreachable";
1257 UNREACHABLE();
1258 break;
1259 }
1260 }
1261
DumpHeapObjectType(std::ostream & os) const1262 void JSTaggedValue::DumpHeapObjectType(std::ostream &os) const
1263 {
1264 ASSERT(IsWeak() || IsHeapObject());
1265 bool isWeak = IsWeak();
1266 TaggedObject *obj = isWeak ? GetTaggedWeakRef() : GetTaggedObject();
1267 if (isWeak) {
1268 os << " [Weak Ref] ";
1269 }
1270
1271 JSType type = obj->GetClass()->GetObjectType();
1272 if (type >= JSType::STRING_FIRST && type <= JSType::STRING_LAST) {
1273 CString string = ConvertToString(EcmaString::Cast(obj));
1274 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[" + string + "]";
1275 } else if (type == JSType::METHOD) {
1276 std::ostringstream address;
1277 address << obj;
1278 CString addrStr = CString(address.str());
1279 Method *method = Method::Cast(obj);
1280
1281 os << std::left << std::setw(DUMP_TYPE_OFFSET)
1282 << "[" + JSHClass::DumpJSType(type) + "(" + addrStr + "-" + method->GetMethodName() + ")]";
1283 } else {
1284 std::ostringstream address;
1285 address << obj;
1286 CString addrStr = CString(address.str());
1287
1288 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[" + JSHClass::DumpJSType(type) + "(" + addrStr + ")]";
1289 }
1290 }
1291
DumpTaggedValue(std::ostream & os) const1292 void JSTaggedValue::DumpTaggedValue(std::ostream &os) const
1293 {
1294 if (IsInt()) {
1295 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[Int] : " << std::hex << "0x" << GetInt() << std::dec << " ("
1296 << GetInt() << ")";
1297 } else if (IsDouble()) {
1298 os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[Double] : " << GetDouble();
1299 } else if (IsSpecial()) {
1300 DumpSpecialValue(os);
1301 } else {
1302 DumpHeapObjectType(os);
1303 }
1304 }
1305
Dump(std::ostream & os) const1306 void JSTaggedValue::Dump(std::ostream &os) const
1307 {
1308 DumpTaggedValue(os);
1309 os << "\n";
1310
1311 if (IsHeapObject()) {
1312 TaggedObject *obj = IsWeak() ? GetTaggedWeakRef() : GetTaggedObject();
1313 DumpObject(obj, os);
1314 }
1315 }
1316
D() const1317 void JSTaggedValue::D() const
1318 {
1319 Dump(std::cout);
1320 }
1321
DV(JSTaggedType val)1322 void JSTaggedValue::DV(JSTaggedType val)
1323 {
1324 JSTaggedValue(val).D();
1325 }
1326
DumpStack()1327 void JSThread::DumpStack()
1328 {
1329 FrameHandler handler(this);
1330 handler.DumpStack(std::cout);
1331 }
1332
Dump(std::ostream & os) const1333 void NumberDictionary::Dump(std::ostream &os) const
1334 {
1335 DISALLOW_GARBAGE_COLLECTION;
1336 int size = Size();
1337 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1338 JSTaggedValue key(GetKey(hashIndex));
1339 if (!key.IsUndefined() && !key.IsHole()) {
1340 JSTaggedValue val(GetValue(hashIndex));
1341 os << std::right << std::setw(DUMP_PROPERTY_OFFSET)
1342 << static_cast<uint32_t>(JSTaggedNumber(key).GetNumber()) << ": ";
1343 val.DumpTaggedValue(os);
1344 os << " ";
1345 DumpAttr(GetAttributes(hashIndex), false, os);
1346 os << "\n";
1347 }
1348 }
1349 }
1350
Dump(std::ostream & os) const1351 void NameDictionary::Dump(std::ostream &os) const
1352 {
1353 DISALLOW_GARBAGE_COLLECTION;
1354 int size = Size();
1355 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1356 JSTaggedValue key(GetKey(hashIndex));
1357 if (!key.IsUndefined() && !key.IsHole()) {
1358 JSTaggedValue val(GetValue(hashIndex));
1359 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1360 DumpPropertyKey(key, os);
1361 os << ": ";
1362 val.DumpTaggedValue(os);
1363 os << " ";
1364 DumpAttr(GetAttributes(hashIndex), false, os);
1365 os << "\n";
1366 }
1367 }
1368 }
1369
Dump(std::ostream & os) const1370 void GlobalDictionary::Dump(std::ostream &os) const
1371 {
1372 DISALLOW_GARBAGE_COLLECTION;
1373 int size = Size();
1374 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1375 JSTaggedValue key(GetKey(hashIndex));
1376 if (!key.IsUndefined() && !key.IsHole()) {
1377 JSTaggedValue val(GetValue(hashIndex));
1378 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1379 DumpPropertyKey(key, os);
1380 os << " : ";
1381 val.DumpTaggedValue(os);
1382 os << " ";
1383 DumpAttr(GetAttributes(hashIndex), false, os);
1384 os << "\n";
1385 }
1386 }
1387 }
1388
Dump(std::ostream & os) const1389 void LayoutInfo::Dump(std::ostream &os) const
1390 {
1391 DISALLOW_GARBAGE_COLLECTION;
1392 int num = NumberOfElements();
1393 for (int i = 0; i < num; i++) {
1394 JSTaggedValue key = GetKey(i);
1395 PropertyAttributes attr = GetAttr(i);
1396 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1397 os << "[" << i << "]: ";
1398 DumpPropertyKey(key, os);
1399 os << " : ";
1400 DumpAttr(attr, true, os);
1401 os << "\n";
1402 }
1403 }
1404
Dump(std::ostream & os) const1405 void TransitionsDictionary::Dump(std::ostream &os) const
1406 {
1407 DISALLOW_GARBAGE_COLLECTION;
1408 int size = Size();
1409 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
1410 JSTaggedValue key(GetKey(hashIndex));
1411 if (!key.IsUndefined() && !key.IsHole()) {
1412 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1413 DumpPropertyKey(key, os);
1414 os << " : ";
1415 GetValue(hashIndex).DumpTaggedValue(os);
1416 os << " : ";
1417 GetAttributes(hashIndex).DumpTaggedValue(os);
1418 os << "\n";
1419 }
1420 }
1421 }
1422
Dump(std::ostream & os) const1423 void LinkedHashSet::Dump(std::ostream &os) const
1424 {
1425 DISALLOW_GARBAGE_COLLECTION;
1426 int capacity = NumberOfElements() + NumberOfDeletedElements();
1427 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
1428 JSTaggedValue key(GetKey(hashIndex));
1429 if (!key.IsUndefined() && !key.IsHole()) {
1430 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1431 key.DumpTaggedValue(os);
1432 os << "\n";
1433 }
1434 }
1435 }
1436
Dump(std::ostream & os) const1437 void LinkedHashMap::Dump(std::ostream &os) const
1438 {
1439 DISALLOW_GARBAGE_COLLECTION;
1440 int capacity = NumberOfElements() + NumberOfDeletedElements();
1441 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
1442 JSTaggedValue key(GetKey(hashIndex));
1443 if (!key.IsUndefined() && !key.IsHole()) {
1444 JSTaggedValue val(GetValue(hashIndex));
1445 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1446 key.DumpTaggedValue(os);
1447 os << ": ";
1448 val.DumpTaggedValue(os);
1449 os << "\n";
1450 }
1451 }
1452 }
1453
Dump(std::ostream & os) const1454 void TaggedDoubleList::Dump(std::ostream &os) const
1455 {
1456 DISALLOW_GARBAGE_COLLECTION;
1457 int capacity = NumberOfNodes();
1458 os << " - node num: " << std::dec << capacity << "\n";
1459 os << " - delete node num: " << std::dec << NumberOfDeletedNodes() << "\n";
1460 os << "head-next: ";
1461 // 5 : 5 first element next ptr
1462 GetElement(5).Dump(os);
1463 os << "head-pre: ";
1464 // 6 : 6 first element per ptr
1465 GetElement(6).Dump(os);
1466 os << "\n";
1467 int i = 0;
1468 int next = GetElement(5).GetInt();
1469 while (capacity > i) {
1470 os << " value: ";
1471 GetElement(next).DumpTaggedValue(os);
1472 os << " next: ";
1473 // 1 : 1 current element next ptr offset
1474 GetElement(next + 1).Dump(os);
1475 os << " pre: ";
1476 // 2 : 2 current element pre ptr offset
1477 GetElement(next + 2).Dump(os);
1478 os << "\n";
1479 next = GetElement(next + 1).GetInt();
1480 i++;
1481 }
1482 }
1483
Dump(std::ostream & os) const1484 void TaggedSingleList::Dump(std::ostream &os) const
1485 {
1486 DISALLOW_GARBAGE_COLLECTION;
1487 int capacity = NumberOfNodes();
1488 os << "head-next: ";
1489 // 5 : 5 first element next ptr
1490 GetElement(5).Dump(os);
1491 os << "\n";
1492 int i = 0;
1493 int next = GetElement(5).GetInt();
1494 while (capacity > i) {
1495 os << " value: ";
1496 GetElement(next).DumpTaggedValue(os);
1497 os << " next: ";
1498 // 1 : 1 current element next ptr offset
1499 GetElement(next + 1).Dump(os);
1500 os << "\n";
1501 next = GetElement(next + 1).GetInt();
1502 i++;
1503 }
1504 }
1505
Dump(std::ostream & os) const1506 void JSObject::Dump(std::ostream &os) const
1507 {
1508 DISALLOW_GARBAGE_COLLECTION;
1509 JSHClass *jshclass = GetJSHClass();
1510 os << " - hclass: " << std::hex << jshclass << "\n";
1511 os << " - prototype: ";
1512 jshclass->GetPrototype().DumpTaggedValue(os);
1513 os << "\n";
1514
1515 JSTaggedType hashField = Barriers::GetValue<JSTaggedType>(this, HASH_OFFSET);
1516 JSTaggedValue value(hashField);
1517 os << " - hash: " << std::hex << hashField;
1518 value.Dump(os);
1519
1520 TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject());
1521 os << " - elements: " << std::hex << elements;
1522 if (elements->GetLength() == 0) {
1523 os << " NONE\n";
1524 } else if (!elements->IsDictionaryMode()) {
1525 DumpArrayClass(elements, os);
1526 } else {
1527 NumberDictionary *dict = NumberDictionary::Cast(elements);
1528 os << " <NumberDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
1529 dict->Dump(os);
1530 }
1531
1532 TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject());
1533 os << " - properties: " << std::hex << properties;
1534 if (IsJSGlobalObject()) {
1535 GlobalDictionary *dict = GlobalDictionary::Cast(properties);
1536 os << " <GlobalDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
1537 dict->Dump(os);
1538 return;
1539 }
1540
1541 if (!properties->IsDictionaryMode()) {
1542 JSTaggedValue attrs = jshclass->GetLayout();
1543 if (attrs.IsNull()) {
1544 return;
1545 }
1546
1547 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
1548 int propNumber = static_cast<int>(jshclass->NumberOfProps());
1549 os << " <LayoutInfo[" << std::dec << propNumber << "]>\n";
1550 for (int i = 0; i < propNumber; i++) {
1551 JSTaggedValue key = layoutInfo->GetKey(i);
1552 PropertyAttributes attr = layoutInfo->GetAttr(i);
1553 ASSERT(i == static_cast<int>(attr.GetOffset()));
1554 os << " " << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1555 DumpPropertyKey(key, os);
1556 os << ": (";
1557 JSTaggedValue val;
1558 if (attr.IsInlinedProps()) {
1559 val = GetPropertyInlinedPropsWithRep(i, attr);
1560 } else {
1561 val = properties->Get(i - static_cast<int>(jshclass->GetInlinedProperties()));
1562 }
1563 val.DumpTaggedValue(os);
1564 os << ") ";
1565 DumpAttr(attr, true, os);
1566 os << "\n";
1567 }
1568 } else {
1569 NameDictionary *dict = NameDictionary::Cast(properties);
1570 os << " <NameDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
1571 dict->Dump(os);
1572 }
1573 }
1574
Dump(std::ostream & os) const1575 void TaggedArray::Dump(std::ostream &os) const
1576 {
1577 DumpArrayClass(this, os);
1578 }
1579
Dump(std::ostream & os) const1580 void AccessorData::Dump(std::ostream &os) const
1581 {
1582 auto *hclass = GetClass();
1583 if (hclass->GetObjectType() == JSType::INTERNAL_ACCESSOR) {
1584 os << " - Getter: " << reinterpret_cast<void *>(GetGetter().GetTaggedObject()) << "\n";
1585 os << " - Setter: " << reinterpret_cast<void *>(GetSetter().GetTaggedObject()) << "\n";
1586 return;
1587 }
1588
1589 os << " - Getter: ";
1590 GetGetter().DumpTaggedValue(os);
1591 os << "\n";
1592
1593 os << " - Setter: ";
1594 GetSetter().DumpTaggedValue(os);
1595 os << "\n";
1596 }
1597
Dump(std::ostream & os) const1598 void Program::Dump(std::ostream &os) const
1599 {
1600 os << " - MainFunction: ";
1601 GetMainFunction().Dump(os);
1602 os << "\n";
1603 }
1604
Dump(std::ostream & os) const1605 void LinkedNode::Dump(std::ostream &os) const
1606 {
1607 os << " - Next: ";
1608
1609 os << "\n";
1610 }
1611
Dump(std::ostream & os) const1612 void ConstantPool::Dump(std::ostream &os) const
1613 {
1614 DumpArrayClass(this, os);
1615 }
1616
Dump(std::ostream & os) const1617 void ProfileTypeInfo::Dump(std::ostream &os) const
1618 {
1619 DISALLOW_GARBAGE_COLLECTION;
1620 uint32_t len = GetCacheLength();
1621 os << " <ProfileTypeInfo[" << std::dec << len << "]>\n";
1622 for (uint32_t i = 0; i < len; i++) {
1623 JSTaggedValue val(Get(i));
1624 if (!val.IsHole()) {
1625 os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": ";
1626 val.DumpTaggedValue(os);
1627 os << "\n";
1628 }
1629 }
1630 }
1631
Dump(std::ostream & os) const1632 void VTable::Dump(std::ostream &os) const
1633 {
1634 DISALLOW_GARBAGE_COLLECTION;
1635 uint32_t num = GetNumberOfTuples();
1636
1637 for (uint32_t i = 0; i < num; i++) {
1638 os << std::right << std::setw(DUMP_PROPERTY_OFFSET);
1639 os << "[" << i << "]: [ name :";
1640 JSTaggedValue name = GetTupleItem(i, VTable::TupleItem::NAME);
1641 DumpPropertyKey(name, os);
1642 os << ", type :" << (IsAccessor(i) ? "Accessor" : "Function");
1643 JSTaggedValue owner = GetTupleItem(i, VTable::TupleItem::OWNER);
1644 os << ", owner :";
1645 owner.DumpTaggedValue(os);
1646 JSTaggedValue offset = GetTupleItem(i, VTable::TupleItem::OFFSET);
1647 os << ", offset :" << offset.GetInt();
1648 os << " ] ";
1649 os << "\n";
1650 }
1651 }
1652
Dump(std::ostream & os) const1653 void JSFunction::Dump(std::ostream &os) const
1654 {
1655 os << " - ProtoOrHClass: ";
1656 GetProtoOrHClass().Dump(os);
1657 os << "\n";
1658 os << " - LexicalEnv: ";
1659 if (GetClass()->IsJSSharedFunction()) {
1660 os << GetLexicalEnv().GetTaggedObject()<< "\n";
1661 } else {
1662 GetLexicalEnv().Dump(os);
1663 os << "\n";
1664 }
1665 os << " - HomeObject: ";
1666 GetHomeObject().Dump(os);
1667 os << "\n";
1668 os << " - FunctionExtraInfo: ";
1669 GetFunctionExtraInfo().Dump(os);
1670 os << "\n";
1671 os << " - Method: ";
1672 GetMethod().Dump(os);
1673 os << "\n";
1674 JSObject::Dump(os);
1675 }
1676
Dump(std::ostream & os) const1677 void JSHClass::Dump(std::ostream &os) const
1678 {
1679 DumpHClass(this, os, true);
1680 }
1681
Dump(std::ostream & os) const1682 void JSBoundFunction::Dump(std::ostream &os) const
1683 {
1684 os << " - BoundTarget: ";
1685 GetBoundTarget().DumpTaggedValue(os);
1686 os << "\n";
1687
1688 os << " - BoundThis: ";
1689 GetBoundThis().DumpTaggedValue(os);
1690 os << "\n";
1691
1692 os << " - BoundArguments: ";
1693 GetBoundArguments().DumpTaggedValue(os);
1694 os << "\n";
1695
1696 JSObject::Dump(os);
1697 }
1698
Dump(std::ostream & os) const1699 void JSPrimitiveRef::Dump(std::ostream &os) const
1700 {
1701 os << " - SubValue : ";
1702 GetValue().DumpTaggedValue(os);
1703 os << "\n";
1704 JSObject::Dump(os);
1705 }
1706
Dump(std::ostream & os) const1707 void BigInt::Dump(std::ostream &os) const
1708 {
1709 os << " - length : " << GetLength() << "\n";
1710 os << " - Sign : " << GetSign() << "\n";
1711 os << " - value : " << ToStdString(DECIMAL) << "\n";
1712 }
1713
Dump(std::ostream & os) const1714 void JSDate::Dump(std::ostream &os) const
1715 {
1716 os << " - time: " << GetTime().GetDouble() << "\n";
1717 os << " - localOffset: " << GetLocalOffset().GetDouble() << "\n";
1718 JSObject::Dump(os);
1719 }
1720
Dump(std::ostream & os) const1721 void JSMap::Dump(std::ostream &os) const
1722 {
1723 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
1724 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1725 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1726 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1727 JSObject::Dump(os);
1728
1729 os << " <NameDictionary[" << map->NumberOfElements() << "]>\n";
1730 map->Dump(os);
1731 }
1732
Dump(std::ostream & os) const1733 void JSAPITreeMap::Dump(std::ostream &os) const
1734 {
1735 TaggedTreeMap *map = TaggedTreeMap::Cast(GetTreeMap().GetTaggedObject());
1736 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1737 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1738 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1739 JSObject::Dump(os);
1740
1741 os << " <TaggedTree[" << map->NumberOfElements() << "]>\n";
1742 map->Dump(os);
1743 }
1744
DumpForSnapshot(std::vector<Reference> & vec) const1745 void JSAPITreeMap::DumpForSnapshot(std::vector<Reference> &vec) const
1746 {
1747 TaggedTreeMap *map = TaggedTreeMap::Cast(GetTreeMap().GetTaggedObject());
1748 vec.emplace_back("treemap", GetTreeMap());
1749 map->DumpForSnapshot(vec);
1750
1751 JSObject::DumpForSnapshot(vec);
1752 }
1753
Dump(std::ostream & os) const1754 void JSAPITreeMapIterator::Dump(std::ostream &os) const
1755 {
1756 TaggedTreeMap *map =
1757 TaggedTreeMap::Cast(JSAPITreeMap::Cast(GetIteratedMap().GetTaggedObject())->GetTreeMap().GetTaggedObject());
1758 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1759 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1760 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1761 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1762 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1763 JSObject::Dump(os);
1764
1765 os << " <TaggedTree[" << map->NumberOfElements() << "]>\n";
1766 map->Dump(os);
1767 }
1768
DumpForSnapshot(std::vector<Reference> & vec) const1769 void JSAPITreeMapIterator::DumpForSnapshot(std::vector<Reference> &vec) const
1770 {
1771 TaggedTreeMap *map =
1772 TaggedTreeMap::Cast(JSAPITreeMap::Cast(GetIteratedMap().GetTaggedObject())->GetTreeMap().GetTaggedObject());
1773 vec.emplace_back("iteratedmap", GetIteratedMap());
1774 map->DumpForSnapshot(vec);
1775 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
1776 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
1777 JSObject::DumpForSnapshot(vec);
1778 }
1779
1780 template <typename T>
DumpTaggedTreeEntry(T tree,std::ostream & os,int index,bool isMap=false)1781 void DumpTaggedTreeEntry(T tree, std::ostream &os, int index, bool isMap = false)
1782 {
1783 DISALLOW_GARBAGE_COLLECTION;
1784 JSTaggedValue parent(tree->GetParent(index));
1785 JSTaggedValue val(tree->GetValue(index));
1786 JSTaggedValue color(static_cast<int>(tree->GetColor(index)));
1787 JSTaggedValue left = tree->GetLeftChild(index);
1788 JSTaggedValue right = tree->GetRightChild(index);
1789 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": ";
1790 os << "\n";
1791 if (isMap) {
1792 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [key]: {";
1793 JSTaggedValue key(tree->GetKey(index));
1794 key.DumpTaggedValue(os);
1795 os << std::right << "};";
1796 os << "\n";
1797 }
1798 os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [value]: {";
1799 val.DumpTaggedValue(os);
1800 os << std::right << "};";
1801 os << "\n";
1802 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [parent]: {";
1803 parent.DumpTaggedValue(os);
1804 os << std::right << "};";
1805 os << "\n";
1806 os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [color]: {";
1807 color.DumpTaggedValue(os);
1808 os << std::right << "};";
1809 os << "\n";
1810 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [left]: {";
1811 left.DumpTaggedValue(os);
1812 os << std::right << "}; ";
1813 os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [right]: {";
1814 right.DumpTaggedValue(os);
1815 os << std::right << "};";
1816 os << "\n";
1817 }
Dump(std::ostream & os) const1818 void TaggedTreeMap::Dump(std::ostream &os) const
1819 {
1820 DISALLOW_GARBAGE_COLLECTION;
1821 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Elements]: {";
1822 JSTaggedValue node = TaggedArray::Get(0);
1823 node.DumpTaggedValue(os);
1824 os << std::right << "}" << "\n";
1825 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Delete]: {";
1826 node = TaggedArray::Get(1);
1827 node.DumpTaggedValue(os);
1828 os << std::right << "}" << "\n";
1829 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Capacity]: {";
1830 node = TaggedArray::Get(2); // 2 means the three element
1831 node.DumpTaggedValue(os);
1832 os << std::right << "}" << "\n";
1833 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[RootNode]: {";
1834 node = TaggedArray::Get(3); // 3 means the three element
1835 node.DumpTaggedValue(os);
1836 os << std::right << "}" << "\n";
1837
1838 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
1839 for (uint32_t index = 0; index < capacity; index++) {
1840 if (GetKey(index).IsHole()) {
1841 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": ";
1842 GetKey(index).DumpTaggedValue(os);
1843 os << "\n";
1844 } else {
1845 DumpTaggedTreeEntry(const_cast<TaggedTreeMap *>(this), os, index, true);
1846 }
1847 }
1848 }
1849
Dump(std::ostream & os) const1850 void JSAPITreeSet::Dump(std::ostream &os) const
1851 {
1852 TaggedTreeSet *set = TaggedTreeSet::Cast(GetTreeSet().GetTaggedObject());
1853 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1854 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1855 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1856 JSObject::Dump(os);
1857
1858 os << " <TaggedTree[" << set->NumberOfElements() << "]>\n";
1859 set->Dump(os);
1860 }
1861
DumpForSnapshot(std::vector<Reference> & vec) const1862 void JSAPITreeSet::DumpForSnapshot(std::vector<Reference> &vec) const
1863 {
1864 TaggedTreeSet *set = TaggedTreeSet::Cast(GetTreeSet().GetTaggedObject());
1865 vec.emplace_back("treeset", GetTreeSet());
1866 set->DumpForSnapshot(vec);
1867
1868 JSObject::DumpForSnapshot(vec);
1869 }
1870
Dump(std::ostream & os) const1871 void JSAPITreeSetIterator::Dump(std::ostream &os) const
1872 {
1873 TaggedTreeSet *set =
1874 TaggedTreeSet::Cast(JSAPITreeSet::Cast(GetIteratedSet().GetTaggedObject())->GetTreeSet().GetTaggedObject());
1875 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1876 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1877 os << " - capacity: " << std::dec << set->Capacity() << "\n";
1878 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1879 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1880 JSObject::Dump(os);
1881
1882 os << " <TaggedTree[" << set->NumberOfElements() << "]>\n";
1883 set->Dump(os);
1884 }
1885
DumpForSnapshot(std::vector<Reference> & vec) const1886 void JSAPITreeSetIterator::DumpForSnapshot(std::vector<Reference> &vec) const
1887 {
1888 TaggedTreeSet *set =
1889 TaggedTreeSet::Cast(JSAPITreeSet::Cast(GetIteratedSet().GetTaggedObject())->GetTreeSet().GetTaggedObject());
1890 vec.emplace_back("iteratedset", GetIteratedSet());
1891 set->DumpForSnapshot(vec);
1892 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
1893 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
1894 JSObject::DumpForSnapshot(vec);
1895 }
1896
Dump(std::ostream & os) const1897 void TaggedTreeSet::Dump(std::ostream &os) const
1898 {
1899 DISALLOW_GARBAGE_COLLECTION;
1900 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Elements]: {";
1901 JSTaggedValue node = TaggedArray::Get(0);
1902 node.DumpTaggedValue(os);
1903 os << std::right << "}" << "\n";
1904 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Delete]: {";
1905 node = TaggedArray::Get(1);
1906 node.DumpTaggedValue(os);
1907 os << std::right << "}" << "\n";
1908 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Capacity]: {";
1909 node = TaggedArray::Get(2); // 2 means the three element
1910 node.DumpTaggedValue(os);
1911 os << std::right << "}" << "\n";
1912 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[RootNode]: {";
1913 node = TaggedArray::Get(3); // 3 means the three element
1914 node.DumpTaggedValue(os);
1915 os << std::right << "}" << "\n";
1916
1917 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
1918 for (uint32_t index = 0; index < capacity; index++) {
1919 if (GetKey(index).IsHole()) {
1920 os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": ";
1921 GetKey(index).DumpTaggedValue(os);
1922 os << "\n";
1923 } else {
1924 DumpTaggedTreeEntry(const_cast<TaggedTreeSet *>(this), os, index);
1925 }
1926 }
1927 }
1928
Dump(std::ostream & os) const1929 void JSAPIPlainArray::Dump(std::ostream &os) const
1930 {
1931 TaggedArray *keys = TaggedArray::Cast(GetKeys().GetTaggedObject());
1932 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
1933 uint32_t len = static_cast<uint32_t>(GetLength());
1934 for (uint32_t i = 0; i < len; i++) {
1935 os << " - keys: ";
1936 keys->Get(i).DumpTaggedValue(os);
1937 os << "\n";
1938 os << " - values: ";
1939 values->Get(i).DumpTaggedValue(os);
1940 os << "\n";
1941 }
1942 os << " - length: " << std::dec << len << "\n";
1943 JSObject::Dump(os);
1944 }
1945
Dump(std::ostream & os) const1946 void JSAPIPlainArrayIterator::Dump(std::ostream &os) const
1947 {
1948 JSAPIPlainArray *array = JSAPIPlainArray::Cast(GetIteratedPlainArray().GetTaggedObject());
1949 os << " - length: " << std::dec << array->GetSize() << "\n";
1950 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1951 JSObject::Dump(os);
1952 }
1953
DumpForSnapshot(std::vector<Reference> & vec) const1954 void JSAPIPlainArrayIterator::DumpForSnapshot(std::vector<Reference> &vec) const
1955 {
1956 JSAPIPlainArray *array = JSAPIPlainArray::Cast(GetIteratedPlainArray().GetTaggedObject());
1957 vec.emplace_back("iteratedplainarray", GetIteratedPlainArray());
1958 array->DumpForSnapshot(vec);
1959 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
1960 JSObject::DumpForSnapshot(vec);
1961 }
1962
Dump(std::ostream & os) const1963 void JSForInIterator::Dump(std::ostream &os) const
1964 {
1965 os << " - Object : ";
1966 GetObject().DumpTaggedValue(os);
1967 os << " - CachedHclass : ";
1968 GetCachedHclass().DumpTaggedValue(os);
1969 os << "\n";
1970 os << " - Keys : ";
1971 GetKeys().DumpTaggedValue(os);
1972 os << "\n";
1973 os << " - Index : " << GetIndex();
1974 os << "\n";
1975 os << " - Length : " << GetLength();
1976 os << "\n";
1977 JSObject::Dump(os);
1978 }
1979
Dump(std::ostream & os) const1980 void JSMapIterator::Dump(std::ostream &os) const
1981 {
1982 LinkedHashMap *map = LinkedHashMap::Cast(GetIteratedMap().GetTaggedObject());
1983 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
1984 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
1985 os << " - capacity: " << std::dec << map->Capacity() << "\n";
1986 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
1987 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
1988 JSObject::Dump(os);
1989
1990 os << " <NameDictionary[" << map->NumberOfElements() << "]>\n";
1991 map->Dump(os);
1992 }
1993
Dump(std::ostream & os) const1994 void JSSet::Dump(std::ostream &os) const
1995 {
1996 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
1997 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
1998 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
1999 os << " - capacity: " << std::dec << set->Capacity() << "\n";
2000 JSObject::Dump(os);
2001
2002 os << " <NameDictionary[" << set->NumberOfElements() << "]>\n";
2003 set->Dump(os);
2004 }
2005
Dump(std::ostream & os) const2006 void JSWeakMap::Dump(std::ostream &os) const
2007 {
2008 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
2009 os << " - length: " << std::dec << GetSize() << "\n";
2010 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
2011 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
2012 os << " - capacity: " << std::dec << map->Capacity() << "\n";
2013 JSObject::Dump(os);
2014
2015 os << " <NameDictionary[" << map->NumberOfElements() << "]>\n";
2016 map->Dump(os);
2017 }
2018
Dump(std::ostream & os) const2019 void JSWeakSet::Dump(std::ostream &os) const
2020 {
2021 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
2022 os << " - size: " << std::dec << GetSize() << "\n";
2023 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
2024 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
2025 os << " - capacity: " << std::dec << set->Capacity() << "\n";
2026 JSObject::Dump(os);
2027
2028 os << " <NameDictionary[" << set->NumberOfElements() << "]>\n";
2029 set->Dump(os);
2030 }
2031
Dump(std::ostream & os) const2032 void JSWeakRef::Dump(std::ostream &os) const
2033 {
2034 os << " - WeakObject : ";
2035 GetWeakObject().DumpTaggedValue(os);
2036 os << "\n";
2037 JSObject::Dump(os);
2038 }
2039
Dump(std::ostream & os) const2040 void JSFinalizationRegistry::Dump(std::ostream &os) const
2041 {
2042 os << " - CleanupCallback : ";
2043 GetCleanupCallback().DumpTaggedValue(os);
2044 os << "\n";
2045 os << " - NoUnregister : ";
2046 GetNoUnregister().Dump(os);
2047 os << "\n";
2048 os << " - MaybeUnregister : ";
2049 LinkedHashMap *map = LinkedHashMap::Cast(GetMaybeUnregister().GetTaggedObject());
2050 os << " - elements: " << std::dec << map->NumberOfElements() << "\n";
2051 os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n";
2052 os << " - capacity: " << std::dec << map->Capacity() << "\n";
2053 JSObject::Dump(os);
2054 }
2055
Dump(std::ostream & os) const2056 void CellRecord::Dump(std::ostream &os) const
2057 {
2058 os << " - WeakRefTarget : ";
2059 GetFromWeakRefTarget().DumpTaggedValue(os);
2060 os << "\n";
2061 os << " - HeldValue : ";
2062 GetHeldValue().DumpTaggedValue(os);
2063 os << "\n";
2064 }
2065
Dump(std::ostream & os) const2066 void JSSetIterator::Dump(std::ostream &os) const
2067 {
2068 LinkedHashSet *set = LinkedHashSet::Cast(GetIteratedSet().GetTaggedObject());
2069 os << " - elements: " << std::dec << set->NumberOfElements() << "\n";
2070 os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n";
2071 os << " - capacity: " << std::dec << set->Capacity() << "\n";
2072 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2073 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2074 JSObject::Dump(os);
2075
2076 os << " <NameDictionary[" << set->NumberOfElements() << "]>\n";
2077 set->Dump(os);
2078 }
2079
Dump(std::ostream & os) const2080 void JSRegExpIterator::Dump(std::ostream &os) const
2081 {
2082 os << " - IteratingRegExp: ";
2083 GetIteratingRegExp().Dump(os);
2084 os << "\n";
2085 os << " - IteratedString: ";
2086 GetIteratedString().Dump(os);
2087 os << "\n";
2088 os << " - Global: " << std::dec << GetGlobal() << "\n";
2089 os << " - Unicode: " << std::dec << GetUnicode() << "\n";
2090 os << " - Done: " << std::dec << GetDone() << "\n";
2091 JSObject::Dump(os);
2092 }
2093
Dump(std::ostream & os) const2094 void JSArray::Dump(std::ostream &os) const
2095 {
2096 os << " - length: " << std::dec << GetArrayLength() << "\n";
2097 JSObject::Dump(os);
2098 }
2099
Dump(std::ostream & os) const2100 void JSArrayIterator::Dump(std::ostream &os) const
2101 {
2102 JSArray *array = JSArray::Cast(GetIteratedArray().GetTaggedObject());
2103 os << " - length: " << std::dec << array->GetArrayLength() << "\n";
2104 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2105 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2106 JSObject::Dump(os);
2107 }
2108
Dump(std::ostream & os) const2109 void JSAPIArrayList::Dump(std::ostream &os) const
2110 {
2111 os << " - length: " << std::dec << GetSize() << "\n";
2112 JSObject::Dump(os);
2113 }
2114
Dump(std::ostream & os) const2115 void JSAPIArrayListIterator::Dump(std::ostream &os) const
2116 {
2117 JSAPIArrayList *arrayList = JSAPIArrayList::Cast(GetIteratedArrayList().GetTaggedObject());
2118 os << " - length: " << std::dec << arrayList->GetSize() << "\n";
2119 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2120 JSObject::Dump(os);
2121 }
2122
Dump(std::ostream & os) const2123 void JSAPIDeque::Dump(std::ostream &os) const
2124 {
2125 os << " - first: " << std::dec << GetFirst() << "\n";
2126 os << " - last: " << std::dec << GetLast() << "\n";
2127 JSObject::Dump(os);
2128 }
2129
Dump(std::ostream & os) const2130 void JSAPIDequeIterator::Dump(std::ostream &os) const
2131 {
2132 JSAPIDeque *deque = JSAPIDeque::Cast(GetIteratedDeque().GetTaggedObject());
2133 os << " - length: " << std::dec << deque->GetSize() << "\n";
2134 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2135 JSObject::Dump(os);
2136 }
2137
Dump(std::ostream & os) const2138 void JSAPILightWeightMap::Dump(std::ostream &os) const
2139 {
2140 uint32_t capacity = GetSize();
2141 os << " - length: " << std::dec << capacity << "\n";
2142 uint32_t i = 0;
2143 TaggedArray *hashArray = TaggedArray::Cast(GetHashes().GetTaggedObject());
2144 TaggedArray *keyArray = TaggedArray::Cast(GetKeys().GetTaggedObject());
2145 TaggedArray *valueArray = TaggedArray::Cast(GetValues().GetTaggedObject());
2146 while (capacity > i) {
2147 os << " hash: ";
2148 hashArray->Get(i).DumpTaggedValue(os);
2149 os << " key: ";
2150 keyArray->Get(i).DumpTaggedValue(os);
2151 os << " value: ";
2152 valueArray->Get(i).DumpTaggedValue(os);
2153 os << "\n";
2154 i++;
2155 }
2156 JSObject::Dump(os);
2157 }
2158
Dump(std::ostream & os) const2159 void JSAPILightWeightMapIterator::Dump(std::ostream &os) const
2160 {
2161 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2162 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2163 JSObject::Dump(os);
2164 }
2165
Dump(std::ostream & os) const2166 void JSAPIHashMap::Dump(std::ostream &os) const
2167 {
2168 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable().GetTaggedObject());
2169 os << " - elements: " << std::dec << GetSize() << "\n";
2170 os << " - table capacity: " << std::dec << static_cast<int>(hashArray->GetLength()) << "\n";
2171 JSObject::Dump(os);
2172 }
2173
DumpForSnapshot(std::vector<Reference> & vec) const2174 void JSAPIHashMap::DumpForSnapshot(std::vector<Reference> &vec) const
2175 {
2176 TaggedHashArray *map = TaggedHashArray::Cast(GetTable().GetTaggedObject());
2177 vec.emplace_back("hashmap", GetTable());
2178 map->DumpForSnapshot(vec);
2179 JSObject::DumpForSnapshot(vec);
2180 }
2181
Dump(std::ostream & os) const2182 void JSAPIHashSet::Dump(std::ostream &os) const
2183 {
2184 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable().GetTaggedObject());
2185 os << " - elements: " << std::dec << GetSize() << "\n";
2186 os << " - table capacity: " << std::dec << static_cast<int>(hashArray->GetLength()) << "\n";
2187 JSObject::Dump(os);
2188 }
2189
DumpForSnapshot(std::vector<Reference> & vec) const2190 void JSAPIHashSet::DumpForSnapshot(std::vector<Reference> &vec) const
2191 {
2192 TaggedHashArray *set = TaggedHashArray::Cast(GetTable().GetTaggedObject());
2193 vec.emplace_back("hashset", GetTable());
2194 set->DumpForSnapshot(vec);
2195 JSObject::DumpForSnapshot(vec);
2196 }
2197
Dump(std::ostream & os) const2198 void JSAPIHashMapIterator::Dump(std::ostream &os) const
2199 {
2200 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2201 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2202 JSObject::Dump(os);
2203 }
2204
DumpForSnapshot(std::vector<Reference> & vec) const2205 void JSAPIHashMapIterator::DumpForSnapshot(std::vector<Reference> &vec) const
2206 {
2207 vec.emplace_back(CString("IteratedHashMap"), JSTaggedValue(GetIteratedHashMap()));
2208 vec.emplace_back(CString("TaggedQueue"), JSTaggedValue(GetTaggedQueue()));
2209 vec.emplace_back(CString("CurrentNodeResult"), JSTaggedValue(GetCurrentNodeResult()));
2210 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
2211 JSObject::DumpForSnapshot(vec);
2212 }
2213
Dump(std::ostream & os) const2214 void JSAPIHashSetIterator::Dump(std::ostream &os) const
2215 {
2216 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2217 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2218 JSObject::Dump(os);
2219 }
2220
DumpForSnapshot(std::vector<Reference> & vec) const2221 void JSAPIHashSetIterator::DumpForSnapshot(std::vector<Reference> &vec) const
2222 {
2223 JSObject::DumpForSnapshot(vec);
2224 }
2225
Dump(std::ostream & os) const2226 void JSAPILightWeightSet::Dump(std::ostream &os) const
2227 {
2228 TaggedArray *keys = TaggedArray::Cast(GetHashes().GetTaggedObject());
2229 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
2230 uint32_t len = GetLength();
2231 for (uint32_t i = 0; i < len; i++) {
2232 os << " - keys: ";
2233 keys->Get(i).DumpTaggedValue(os);
2234 os << "\n";
2235 os << " - values: ";
2236 values->Get(i).DumpTaggedValue(os);
2237 os << "\n";
2238 }
2239 os << " - length: " << std::dec << len << "\n";
2240 JSObject::Dump(os);
2241 }
2242
Dump(std::ostream & os) const2243 void JSAPILightWeightSetIterator::Dump(std::ostream &os) const
2244 {
2245 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2246 os << " - IterationKind: " << std::dec << static_cast<int>(GetIterationKind()) << "\n";
2247 JSObject::Dump(os);
2248 }
2249
Dump(std::ostream & os) const2250 void JSAPIList::Dump(std::ostream &os) const
2251 {
2252 TaggedSingleList *list = TaggedSingleList::Cast(GetSingleList().GetTaggedObject());
2253 os << " - length: " << std::dec << list->GetCapacityFromTaggedArray() << "\n";
2254 os << " - node num: " << std::dec << list->NumberOfNodes() << "\n";
2255 os << " - delete node num: " << std::dec << list->NumberOfDeletedNodes() << "\n";
2256 JSObject::Dump(os);
2257 list->Dump(os);
2258 }
2259
DumpForSnapshot(std::vector<Reference> & vec) const2260 void JSAPIList::DumpForSnapshot(std::vector<Reference> &vec) const
2261 {
2262 if (!(GetSingleList().IsInvalidValue())) {
2263 TaggedSingleList *list = TaggedSingleList::Cast(GetSingleList().GetTaggedObject());
2264 list->DumpForSnapshot(vec);
2265 }
2266 JSObject::DumpForSnapshot(vec);
2267 }
2268
Dump(std::ostream & os) const2269 void JSAPIListIterator::Dump(std::ostream &os) const
2270 {
2271 TaggedSingleList *list = TaggedSingleList::Cast(GetIteratedList().GetTaggedObject());
2272 os << " - length: " << std::dec << list->GetCapacityFromTaggedArray() << "\n";
2273 os << " - node num: " << std::dec << list->NumberOfNodes() << "\n";
2274 os << " - delete node num: " << std::dec << list->NumberOfDeletedNodes() << "\n";
2275 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2276 JSObject::Dump(os);
2277 list->Dump(os);
2278 }
2279
DumpForSnapshot(std::vector<Reference> & vec) const2280 void JSAPIListIterator::DumpForSnapshot(std::vector<Reference> &vec) const
2281 {
2282 if (!(GetIteratedList().IsInvalidValue())) {
2283 TaggedSingleList *list = TaggedSingleList::Cast(GetIteratedList().GetTaggedObject());
2284 vec.emplace_back("iteratedlist", GetIteratedList());
2285 list->DumpForSnapshot(vec);
2286 }
2287 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
2288 JSObject::DumpForSnapshot(vec);
2289 }
2290
Dump(std::ostream & os) const2291 void JSAPILinkedList::Dump(std::ostream &os) const
2292 {
2293 TaggedDoubleList *linkedList = TaggedDoubleList::Cast(GetDoubleList().GetTaggedObject());
2294 os << " - length: " << std::dec << linkedList->GetCapacityFromTaggedArray() << "\n";
2295 os << " - node num: " << std::dec << linkedList->NumberOfNodes() << "\n";
2296 os << " - delete node num: " << std::dec << linkedList->NumberOfDeletedNodes() << "\n";
2297 JSObject::Dump(os);
2298 linkedList->Dump(os);
2299 }
2300
DumpForSnapshot(std::vector<Reference> & vec) const2301 void JSAPILinkedList::DumpForSnapshot(std::vector<Reference> &vec) const
2302 {
2303 TaggedDoubleList *list = TaggedDoubleList::Cast(GetDoubleList().GetTaggedObject());
2304 list->DumpForSnapshot(vec);
2305
2306 JSObject::DumpForSnapshot(vec);
2307 }
2308
Dump(std::ostream & os) const2309 void JSAPILinkedListIterator::Dump(std::ostream &os) const
2310 {
2311 TaggedDoubleList *linkedList = TaggedDoubleList::Cast(GetIteratedLinkedList().GetTaggedObject());
2312 os << " - length: " << std::dec << linkedList->GetCapacityFromTaggedArray() << "\n";
2313 os << " - node num: " << std::dec << linkedList->NumberOfNodes() << "\n";
2314 os << " - delete node num: " << std::dec << linkedList->NumberOfDeletedNodes() << "\n";
2315 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2316 JSObject::Dump(os);
2317 linkedList->Dump(os);
2318 }
2319
DumpForSnapshot(std::vector<Reference> & vec) const2320 void JSAPILinkedListIterator::DumpForSnapshot(std::vector<Reference> &vec) const
2321 {
2322 TaggedDoubleList *linkedList = TaggedDoubleList::Cast(GetIteratedLinkedList().GetTaggedObject());
2323 vec.emplace_back("iteratedlist", GetIteratedLinkedList());
2324 linkedList->DumpForSnapshot(vec);
2325 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
2326 JSObject::DumpForSnapshot(vec);
2327 }
2328
Dump(std::ostream & os) const2329 void JSAPIQueue::Dump(std::ostream &os) const
2330 {
2331 os << " - length: " << std::dec << GetSize() << "\n";
2332 os << " - front: " << std::dec << GetFront() << "\n";
2333 os << " - tail: " << std::dec << GetTail() << "\n";
2334 JSObject::Dump(os);
2335 }
2336
Dump(std::ostream & os) const2337 void JSAPIQueueIterator::Dump(std::ostream &os) const
2338 {
2339 JSAPIQueue *queue = JSAPIQueue::Cast(GetIteratedQueue().GetTaggedObject());
2340 os << " - length: " << std::dec << queue->GetSize() << "\n";
2341 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2342 JSObject::Dump(os);
2343 }
2344
Dump(std::ostream & os) const2345 void JSAPIStack::Dump(std::ostream &os) const
2346 {
2347 os << " - top: " << std::dec << GetTop() << "\n";
2348 JSObject::Dump(os);
2349 }
2350
Dump(std::ostream & os) const2351 void JSAPIStackIterator::Dump(std::ostream &os) const
2352 {
2353 JSAPIStack *stack = JSAPIStack::Cast(GetIteratedStack().GetTaggedObject());
2354 os << " - length: " << std::dec << stack->GetSize() << "\n";
2355 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2356 JSObject::Dump(os);
2357 }
2358
Dump(std::ostream & os) const2359 void JSAPIVector::Dump(std::ostream &os) const
2360 {
2361 os << " - length: " << std::dec << GetSize() << "\n";
2362 JSObject::Dump(os);
2363 }
2364
Dump(std::ostream & os) const2365 void JSAPIVectorIterator::Dump(std::ostream &os) const
2366 {
2367 JSAPIVector *vector = JSAPIVector::Cast(GetIteratedVector().GetTaggedObject());
2368 os << " - length: " << std::dec << vector->GetSize() << "\n";
2369 os << " - nextIndex: " << std::dec << GetNextIndex() << "\n";
2370 JSObject::Dump(os);
2371 }
2372
Dump(std::ostream & os) const2373 void JSStringIterator::Dump(std::ostream &os) const
2374 {
2375 EcmaString *str = EcmaString::Cast(GetIteratedString().GetTaggedObject());
2376 os << " - IteratedString: " << EcmaStringAccessor(str).ToCString() << "\n";
2377 os << " - StringIteratorNextIndex: " << std::dec << GetStringIteratorNextIndex() << "\n";
2378 JSObject::Dump(os);
2379 }
Dump(std::ostream & os) const2380 void JSTypedArray::Dump(std::ostream &os) const
2381 {
2382 os << " - viewed-array-buffer: ";
2383 GetViewedArrayBufferOrByteArray().Dump(os);
2384 os << " - typed-array-name: ";
2385 GetTypedArrayName().Dump(os);
2386 os << " - byte-length: " << GetByteLength();
2387 os << " - byte-offset: " << GetByteOffset();
2388 os << " - array-length: " << GetArrayLength();
2389 JSObject::Dump(os);
2390 }
2391
Dump(std::ostream & os) const2392 void ByteArray::Dump(std::ostream &os) const
2393 {
2394 os << " - array-length: " << GetArrayLength();
2395 os << " - byte-length: " << GetByteLength();
2396 }
2397
Dump(std::ostream & os) const2398 void JSRegExp::Dump(std::ostream &os) const
2399 {
2400 os << "\n";
2401 os << " - ByteCodeBuffer: ";
2402 GetByteCodeBuffer().Dump(os);
2403 os << "\n";
2404 os << " - OriginalSource: ";
2405 GetOriginalSource().Dump(os);
2406 os << "\n";
2407 os << " - OriginalFlags: ";
2408 GetOriginalFlags().Dump(os);
2409 os << "\n";
2410 os << " - GroupName: ";
2411 GetGroupName().Dump(os);
2412 os << "\n";
2413 os << " - Length: " << GetLength();
2414 os << "\n";
2415 JSObject::Dump(os);
2416 }
2417
Dump(std::ostream & os) const2418 void JSProxy::Dump(std::ostream &os) const
2419 {
2420 os << " - Target: ";
2421 os << "\n";
2422 JSObject::Cast(GetTarget().GetTaggedObject())->Dump(os);
2423 os << " - Handler: ";
2424 os << "\n";
2425 JSObject::Cast(GetHandler().GetTaggedObject())->Dump(os);
2426 os << "\n";
2427 }
2428
Dump(std::ostream & os) const2429 void JSSymbol::Dump(std::ostream &os) const
2430 {
2431 os << " - hash-field: " << GetHashField();
2432 os << "\n - flags: " << GetFlags();
2433 os << "\n - description: ";
2434 JSTaggedValue description = GetDescription();
2435 description.Dump(os);
2436 }
2437
Dump(std::ostream & os) const2438 void LexicalEnv::Dump(std::ostream &os) const
2439 {
2440 DumpArrayClass(this, os);
2441 }
2442
Dump(std::ostream & os) const2443 void COWTaggedArray::Dump(std::ostream &os) const
2444 {
2445 DumpArrayClass(this, os);
2446 }
2447
Dump(std::ostream & os) const2448 void MutantTaggedArray::Dump(std::ostream &os) const
2449 {
2450 DumpMutantTaggedArray(this, os);
2451 }
2452
Dump(std::ostream & os) const2453 void COWMutantTaggedArray::Dump(std::ostream &os) const
2454 {
2455 DumpCOWMutantTaggedArray(this, os);
2456 }
2457
2458 // NOLINTNEXTLINE(readability-function-size)
Dump(std::ostream & os) const2459 void GlobalEnv::Dump(std::ostream &os) const
2460 {
2461 auto globalConst = GetJSThread()->GlobalConstants();
2462 os << " - ObjectFunction: ";
2463 GetObjectFunction().GetTaggedValue().Dump(os);
2464 os << " - FunctionFunction: ";
2465 GetFunctionFunction().GetTaggedValue().Dump(os);
2466 os << " - NumberFunction: ";
2467 GetNumberFunction().GetTaggedValue().Dump(os);
2468 os << " - BigIntFunction: ";
2469 GetBigIntFunction().GetTaggedValue().Dump(os);
2470 os << " - DateFunction: ";
2471 GetDateFunction().GetTaggedValue().Dump(os);
2472 os << " - BooleanFunction: ";
2473 GetBooleanFunction().GetTaggedValue().Dump(os);
2474 os << " - ErrorFunction: ";
2475 GetErrorFunction().GetTaggedValue().Dump(os);
2476 os << " - ArrayFunction: ";
2477 GetArrayFunction().GetTaggedValue().Dump(os);
2478 os << " - TypedArrayFunction: ";
2479 GetTypedArrayFunction().GetTaggedValue().Dump(os);
2480 os << " - Int8ArrayFunction: ";
2481 GetInt8ArrayFunction().GetTaggedValue().Dump(os);
2482 os << " - Uint8ArrayFunction: ";
2483 GetUint8ArrayFunction().GetTaggedValue().Dump(os);
2484 os << " - Uint8ClampedArrayFunction: ";
2485 GetUint8ClampedArrayFunction().GetTaggedValue().Dump(os);
2486 os << " - Int16ArrayFunction: ";
2487 GetInt16ArrayFunction().GetTaggedValue().Dump(os);
2488 os << " - ArrayBufferFunction: ";
2489 GetArrayBufferFunction().GetTaggedValue().Dump(os);
2490 os << " - SharedArrayBufferFunction: ";
2491 GetSharedArrayBufferFunction().GetTaggedValue().Dump(os);
2492 os << " - SymbolFunction: ";
2493 GetSymbolFunction().GetTaggedValue().Dump(os);
2494 os << " - RangeErrorFunction: ";
2495 GetRangeErrorFunction().GetTaggedValue().Dump(os);
2496 os << " - ReferenceErrorFunction: ";
2497 GetReferenceErrorFunction().GetTaggedValue().Dump(os);
2498 os << " - TypeErrorFunction: ";
2499 GetTypeErrorFunction().GetTaggedValue().Dump(os);
2500 os << " - AggregateErrorFunction: ";
2501 GetAggregateErrorFunction().GetTaggedValue().Dump(os);
2502 os << " - URIErrorFunction: ";
2503 GetURIErrorFunction().GetTaggedValue().Dump(os);
2504 os << " - SyntaxErrorFunction: ";
2505 GetSyntaxErrorFunction().GetTaggedValue().Dump(os);
2506 os << " - EvalErrorFunction: ";
2507 GetEvalErrorFunction().GetTaggedValue().Dump(os);
2508 os << " - OOMErrorFunction: ";
2509 GetOOMErrorFunction().GetTaggedValue().Dump(os);
2510 os << " - TerminationErrorFunction: ";
2511 GetTerminationErrorFunction().GetTaggedValue().Dump(os);
2512 os << " - RegExpFunction: ";
2513 GetRegExpFunction().GetTaggedValue().Dump(os);
2514 os << " - BuiltinsSetFunction: ";
2515 GetBuiltinsSetFunction().GetTaggedValue().Dump(os);
2516 os << " - BuiltinsMapFunction: ";
2517 GetBuiltinsMapFunction().GetTaggedValue().Dump(os);
2518 os << " - BuiltinsWeakSetFunction: ";
2519 GetBuiltinsWeakSetFunction().GetTaggedValue().Dump(os);
2520 os << " - BuiltinsWeakMapFunction: ";
2521 GetBuiltinsWeakMapFunction().GetTaggedValue().Dump(os);
2522 os << " - BuiltinsWeakRefFunction: ";
2523 GetBuiltinsWeakRefFunction().GetTaggedValue().Dump(os);
2524 os << " - BuiltinsFinalizationRegistryFunction: ";
2525 GetBuiltinsFinalizationRegistryFunction().GetTaggedValue().Dump(os);
2526 os << " - MathFunction: ";
2527 GetMathFunction().GetTaggedValue().Dump(os);
2528 os << " - AtomicsFunction: ";
2529 GetAtomicsFunction().GetTaggedValue().Dump(os);
2530 os << " - JsonFunction: ";
2531 GetJsonFunction().GetTaggedValue().Dump(os);
2532 os << " - StringFunction: ";
2533 GetStringFunction().GetTaggedValue().Dump(os);
2534 os << " - ProxyFunction: ";
2535 GetProxyFunction().GetTaggedValue().Dump(os);
2536 os << " - ReflectFunction: ";
2537 GetReflectFunction().GetTaggedValue().Dump(os);
2538 os << " - AsyncFunction: ";
2539 GetAsyncFunction().GetTaggedValue().Dump(os);
2540 os << " - AsyncFunctionPrototype: ";
2541 GetAsyncFunctionPrototype().GetTaggedValue().Dump(os);
2542 os << " - JSGlobalObject: ";
2543 GetJSGlobalObject().GetTaggedValue().Dump(os);
2544 os << " - GlobalPatch: ";
2545 GetGlobalPatch().GetTaggedValue().Dump(os);
2546 os << " - EmptyArray: ";
2547 globalConst->GetEmptyArray().Dump(os);
2548 os << " - EmptyString ";
2549 globalConst->GetEmptyString().Dump(os);
2550 os << " - EmptyTaggedQueue: ";
2551 globalConst->GetEmptyTaggedQueue().Dump(os);
2552 os << " - PrototypeString: ";
2553 globalConst->GetPrototypeString().Dump(os);
2554 os << " - HasInstanceSymbol: ";
2555 GetHasInstanceSymbol().GetTaggedValue().Dump(os);
2556 os << " - IsConcatSpreadableSymbol: ";
2557 GetIsConcatSpreadableSymbol().GetTaggedValue().Dump(os);
2558 os << " - ToStringTagSymbol: ";
2559 GetToStringTagSymbol().GetTaggedValue().Dump(os);
2560 os << " - IteratorSymbol: ";
2561 GetIteratorSymbol().GetTaggedValue().Dump(os);
2562 os << " - AsyncIteratorSymbol: ";
2563 GetAsyncIteratorSymbol().GetTaggedValue().Dump(os);
2564 os << " - MatchSymbol: ";
2565 GetMatchSymbol().GetTaggedValue().Dump(os);
2566 os << " - MatchAllSymbol: ";
2567 GetMatchAllSymbol().GetTaggedValue().Dump(os);
2568 os << " - ReplaceSymbol: ";
2569 GetReplaceSymbol().GetTaggedValue().Dump(os);
2570 os << " - SearchSymbol: ";
2571 GetSearchSymbol().GetTaggedValue().Dump(os);
2572 os << " - SpeciesSymbol: ";
2573 GetSpeciesSymbol().GetTaggedValue().Dump(os);
2574 os << " - SplitSymbol: ";
2575 GetSplitSymbol().GetTaggedValue().Dump(os);
2576 os << " - ToPrimitiveSymbol: ";
2577 GetToPrimitiveSymbol().GetTaggedValue().Dump(os);
2578 os << " - UnscopablesSymbol: ";
2579 GetUnscopablesSymbol().GetTaggedValue().Dump(os);
2580 os << " - HoleySymbol: ";
2581 GetHoleySymbol().GetTaggedValue().Dump(os);
2582 os << " - NativeBindingSymbol: ";
2583 GetNativeBindingSymbol().GetTaggedValue().Dump(os);
2584 os << " - ConstructorString: ";
2585 globalConst->GetConstructorString().Dump(os);
2586 os << " - IteratorPrototype: ";
2587 GetIteratorPrototype().GetTaggedValue().Dump(os);
2588 os << " - ForinIteratorPrototype: ";
2589 GetForinIteratorPrototype().GetTaggedValue().Dump(os);
2590 os << " - StringIterator: ";
2591 GetStringIterator().GetTaggedValue().Dump(os);
2592 os << " - MapIteratorPrototype: ";
2593 GetMapIteratorPrototype().GetTaggedValue().Dump(os);
2594 os << " - SetIteratorPrototype: ";
2595 GetSetIteratorPrototype().GetTaggedValue().Dump(os);
2596 os << " - RegExpIteratorPrototype: ";
2597 GetRegExpIteratorPrototype().GetTaggedValue().Dump(os);
2598 os << " - ArrayIteratorPrototype: ";
2599 GetArrayIteratorPrototype().GetTaggedValue().Dump(os);
2600 os << " - StringIteratorPrototype: ";
2601 GetStringIteratorPrototype().GetTaggedValue().Dump(os);
2602 os << " - LengthString: ";
2603 globalConst->GetLengthString().Dump(os);
2604 os << " - ValueString: ";
2605 globalConst->GetValueString().Dump(os);
2606 os << " - WritableString: ";
2607 globalConst->GetWritableString().Dump(os);
2608 os << " - GetString: ";
2609 globalConst->GetGetString().Dump(os);
2610 os << " - SetString: ";
2611 globalConst->GetSetString().Dump(os);
2612 os << " - EnumerableString: ";
2613 globalConst->GetEnumerableString().Dump(os);
2614 os << " - ConfigurableString: ";
2615 globalConst->GetConfigurableString().Dump(os);
2616 os << " - NameString: ";
2617 globalConst->GetNameString().Dump(os);
2618 os << " - ValueOfString: ";
2619 globalConst->GetValueOfString().Dump(os);
2620 os << " - ToStringString: ";
2621 globalConst->GetToStringString().Dump(os);
2622 os << " - ToLocaleStringString: ";
2623 globalConst->GetToLocaleStringString().Dump(os);
2624 os << " - UndefinedString: ";
2625 globalConst->GetUndefinedString().Dump(os);
2626 os << " - NullString: ";
2627 globalConst->GetNullString().Dump(os);
2628 os << " - TrueString: ";
2629 globalConst->GetTrueString().Dump(os);
2630 os << " - FalseString: ";
2631 globalConst->GetFalseString().Dump(os);
2632 os << " - RegisterSymbols: ";
2633 GetRegisterSymbols().GetTaggedValue().Dump(os);
2634 os << " - ThrowTypeError: ";
2635 GetThrowTypeError().GetTaggedValue().Dump(os);
2636 os << " - GetPrototypeOfString: ";
2637 globalConst->GetGetPrototypeOfString().Dump(os);
2638 os << " - SetPrototypeOfString: ";
2639 globalConst->GetSetPrototypeOfString().Dump(os);
2640 os << " - IsExtensibleString: ";
2641 globalConst->GetIsExtensibleString().Dump(os);
2642 os << " - PreventExtensionsString: ";
2643 globalConst->GetPreventExtensionsString().Dump(os);
2644 os << " - GetOwnPropertyDescriptorString: ";
2645 globalConst->GetGetOwnPropertyDescriptorString().Dump(os);
2646 os << " - DefinePropertyString: ";
2647 globalConst->GetDefinePropertyString().Dump(os);
2648 os << " - HasString: ";
2649 globalConst->GetHasString().Dump(os);
2650 os << " - DeletePropertyString: ";
2651 globalConst->GetDeletePropertyString().Dump(os);
2652 os << " - EnumerateString: ";
2653 globalConst->GetEnumerateString().Dump(os);
2654 os << " - OwnKeysString: ";
2655 globalConst->GetOwnKeysString().Dump(os);
2656 os << " - ApplyString: ";
2657 globalConst->GetApplyString().Dump(os);
2658 os << " - ProxyString: ";
2659 globalConst->GetProxyString().Dump(os);
2660 os << " - RevokeString: ";
2661 globalConst->GetRevokeString().Dump(os);
2662 os << " - ProxyConstructString: ";
2663 globalConst->GetProxyConstructString().Dump(os);
2664 os << " - ProxyCallString: ";
2665 globalConst->GetProxyCallString().Dump(os);
2666 os << " - DoneString: ";
2667 globalConst->GetDoneString().Dump(os);
2668 os << " - NegativeZeroString: ";
2669 globalConst->GetNegativeZeroString().Dump(os);
2670 os << " - NextString: ";
2671 globalConst->GetNextString().Dump(os);
2672 os << " - PromiseThenString: ";
2673 globalConst->GetPromiseThenString().Dump(os);
2674 os << " - PromiseFunction: ";
2675 GetPromiseFunction().GetTaggedValue().Dump(os);
2676 os << " - PromiseReactionJob: ";
2677 GetPromiseReactionJob().GetTaggedValue().Dump(os);
2678 os << " - PromiseResolveThenableJob: ";
2679 GetPromiseResolveThenableJob().GetTaggedValue().Dump(os);
2680 os << " - DynamicImportJob: ";
2681 GetDynamicImportJob().GetTaggedValue().Dump(os);
2682 os << " - ScriptJobString: ";
2683 globalConst->GetScriptJobString().Dump(os);
2684 os << " - PromiseString: ";
2685 globalConst->GetPromiseString().Dump(os);
2686 os << " - IdentityString: ";
2687 globalConst->GetIdentityString().Dump(os);
2688 os << " - AsyncFunctionString: ";
2689 globalConst->GetAsyncFunctionString().Dump(os);
2690 os << " - ThrowerString: ";
2691 globalConst->GetThrowerString().Dump(os);
2692 os << " - Undefined: ";
2693 globalConst->GetUndefined().Dump(os);
2694 }
2695
Dump(std::ostream & os) const2696 void JSDataView::Dump(std::ostream &os) const
2697 {
2698 os << " - data-view: ";
2699 GetDataView().Dump(os);
2700 os << " - buffer: ";
2701 GetViewedArrayBuffer().Dump(os);
2702 os << "- byte-length: " << GetByteLength();
2703 os << "\n - byte-offset: " << GetByteOffset();
2704 }
2705
Dump(std::ostream & os) const2706 void JSArrayBuffer::Dump(std::ostream &os) const
2707 {
2708 os << " - byte-length: " << GetArrayBufferByteLength();
2709 os << " - buffer-data: ";
2710 GetArrayBufferData().Dump(os);
2711 os << " - Shared: " << GetShared();
2712 }
2713
Dump(std::ostream & os) const2714 void PromiseReaction::Dump(std::ostream &os) const
2715 {
2716 os << " - promise-capability: ";
2717 GetPromiseCapability().Dump(os);
2718 os << " - type: " << static_cast<int>(GetType());
2719 os << " - handler: ";
2720 GetHandler().Dump(os);
2721 }
2722
Dump(std::ostream & os) const2723 void PromiseCapability::Dump(std::ostream &os) const
2724 {
2725 os << " - promise: ";
2726 GetPromise().Dump(os);
2727 os << " - resolve: ";
2728 GetResolve().Dump(os);
2729 os << " - reject: ";
2730 GetReject().Dump(os);
2731 }
2732
Dump(std::ostream & os) const2733 void PromiseIteratorRecord::Dump(std::ostream &os) const
2734 {
2735 os << " - iterator: ";
2736 GetIterator().Dump(os);
2737 os << " - done: " << GetDone();
2738 }
2739
Dump(std::ostream & os) const2740 void PromiseRecord::Dump(std::ostream &os) const
2741 {
2742 os << " - value: ";
2743 GetValue().Dump(os);
2744 }
2745
Dump(std::ostream & os) const2746 void ResolvingFunctionsRecord::Dump(std::ostream &os) const
2747 {
2748 os << " - resolve-function: ";
2749 GetResolveFunction().Dump(os);
2750 os << " - reject-function: ";
2751 GetRejectFunction().Dump(os);
2752 }
2753
Dump(std::ostream & os) const2754 void AsyncGeneratorRequest::Dump(std::ostream &os) const
2755 {
2756 os << " - completion: ";
2757 GetCompletion().Dump(os);
2758 os << " - capability: ";
2759 GetCapability().Dump(os);
2760 }
2761
Dump(std::ostream & os) const2762 void AsyncIteratorRecord::Dump(std::ostream &os) const
2763 {
2764 os << " - completion: ";
2765 GetIterator().Dump(os);
2766 os << " - nextmethod: ";
2767 GetNextMethod().Dump(os);
2768 os << " - done: " << GetDone();
2769 }
2770
Dump(std::ostream & os) const2771 void JSAsyncFromSyncIterator::Dump(std::ostream &os) const
2772 {
2773 os << " - sync-iterator-record: ";
2774 GetSyncIteratorRecord().Dump(os);
2775 JSObject::Dump(os);
2776 }
2777
Dump(std::ostream & os) const2778 void JSAsyncFromSyncIterUnwarpFunction::Dump(std::ostream &os) const
2779 {
2780 os << " - done: " ;
2781 GetDone().Dump(os);
2782 JSObject::Dump(os);
2783 }
2784
Dump(std::ostream & os) const2785 void JSPromise::Dump(std::ostream &os) const
2786 {
2787 os << " - promise-state: " << static_cast<int>(GetPromiseState());
2788 os << "\n - promise-result: ";
2789 GetPromiseResult().Dump(os);
2790 os << " - promise-fulfill-reactions: ";
2791 GetPromiseFulfillReactions().Dump(os);
2792 os << " - promise-reject-reactions: ";
2793 GetPromiseRejectReactions().Dump(os);
2794 os << " - promise-is-handled: " << GetPromiseIsHandled();
2795 JSObject::Dump(os);
2796 }
2797
Dump(std::ostream & os) const2798 void JSPromiseReactionsFunction::Dump(std::ostream &os) const
2799 {
2800 os << " - promise: ";
2801 GetPromise().Dump(os);
2802 os << " - already-resolved: ";
2803 GetAlreadyResolved().Dump(os);
2804 JSObject::Dump(os);
2805 }
2806
Dump(std::ostream & os) const2807 void JSPromiseExecutorFunction::Dump(std::ostream &os) const
2808 {
2809 os << " - capability: ";
2810 GetCapability().Dump(os);
2811 JSObject::Dump(os);
2812 }
2813
Dump(std::ostream & os) const2814 void JSAsyncModuleFulfilledFunction::Dump(std::ostream &os) const
2815 {
2816 os << " - module: ";
2817 GetModule().Dump(os);
2818 JSObject::Dump(os);
2819 }
2820
Dump(std::ostream & os) const2821 void JSAsyncModuleRejectedFunction::Dump(std::ostream &os) const
2822 {
2823 os << " - module: ";
2824 GetModule().Dump(os);
2825 JSObject::Dump(os);
2826 }
2827
Dump(std::ostream & os) const2828 void JSPromiseAllResolveElementFunction::Dump(std::ostream &os) const
2829 {
2830 os << " - index: ";
2831 GetIndex().Dump(os);
2832 os << " - values: ";
2833 GetValues().Dump(os);
2834 os << " - capability: ";
2835 GetCapabilities().Dump(os);
2836 os << " - remaining-elements: ";
2837 GetRemainingElements().Dump(os);
2838 os << " - already-called: ";
2839 GetAlreadyCalled().Dump(os);
2840 JSObject::Dump(os);
2841 }
2842
Dump(std::ostream & os) const2843 void JSPromiseAnyRejectElementFunction::Dump(std::ostream &os) const
2844 {
2845 os << " - index: ";
2846 JSTaggedValue(GetIndex()).Dump(os);
2847 os << " - errors: ";
2848 GetErrors().Dump(os);
2849 os << " - capability: ";
2850 GetCapability().Dump(os);
2851 os << " - remaining-elements: ";
2852 GetRemainingElements().Dump(os);
2853 os << " - already-called: ";
2854 GetAlreadyCalled().Dump(os);
2855 JSObject::Dump(os);
2856 }
2857
Dump(std::ostream & os) const2858 void JSPromiseAllSettledElementFunction::Dump(std::ostream &os) const
2859 {
2860 os << " - already-called: ";
2861 GetAlreadyCalled().Dump(os);
2862 os << " - index: ";
2863 JSTaggedValue(GetIndex()).Dump(os);
2864 os << " - values: ";
2865 GetValues().Dump(os);
2866 os << " - capability: ";
2867 GetCapability().Dump(os);
2868 os << " - remaining-elements: ";
2869 GetRemainingElements().Dump(os);
2870 JSObject::Dump(os);
2871 }
2872
Dump(std::ostream & os) const2873 void JSPromiseFinallyFunction::Dump(std::ostream &os) const
2874 {
2875 os << " - constructor: ";
2876 GetConstructor().Dump(os);
2877 os << " - onFinally: ";
2878 GetOnFinally().Dump(os);
2879 JSObject::Dump(os);
2880 }
2881
Dump(std::ostream & os) const2882 void JSPromiseValueThunkOrThrowerFunction::Dump(std::ostream &os) const
2883 {
2884 os << " - result: ";
2885 GetResult().Dump(os);
2886 JSObject::Dump(os);
2887 }
2888
Dump(std::ostream & os) const2889 void JSAsyncGeneratorResNextRetProRstFtn::Dump(std::ostream &os) const
2890 {
2891 os << " - AsyncGeneratorObject";
2892 GetAsyncGeneratorObject().Dump(os);
2893 JSObject::Dump(os);
2894 }
2895
Dump(std::ostream & os) const2896 void MicroJobQueue::Dump(std::ostream &os) const
2897 {
2898 os << " - promise-job-queue: ";
2899 GetPromiseJobQueue().Dump(os);
2900 os << " - script-job-queue: ";
2901 GetScriptJobQueue().Dump(os);
2902 }
2903
Dump(std::ostream & os) const2904 void PendingJob::Dump(std::ostream &os) const
2905 {
2906 os << " - job: ";
2907 GetJob().Dump(os);
2908 os << "\n";
2909 os << " - arguments: ";
2910 GetArguments().Dump(os);
2911 #if defined(ENABLE_HITRACE)
2912 os << "\n";
2913 os << " - chainId: " << GetChainId();
2914 os << "\n";
2915 os << " - spanId: " << GetSpanId();
2916 os << "\n";
2917 os << " - parentSpanId: " << GetParentSpanId();
2918 os << "\n";
2919 os << " - flags: " << GetFlags();
2920 os << "\n";
2921 #endif
2922 }
2923
Dump(std::ostream & os) const2924 void CompletionRecord::Dump(std::ostream &os) const
2925 {
2926 os << " - type: " << static_cast<int>(GetType());
2927 os << " - value: ";
2928 GetValue().Dump(os);
2929 }
2930
Dump(std::ostream & os) const2931 void JSProxyRevocFunction::Dump(std::ostream &os) const
2932 {
2933 os << " - RevocableProxy: ";
2934 os << "\n";
2935 GetRevocableProxy().Dump(os);
2936 os << "\n";
2937 }
2938
Dump(std::ostream & os) const2939 void JSAsyncFunction::Dump(std::ostream &os) const
2940 {
2941 JSFunction::Dump(os);
2942 }
2943
Dump(std::ostream & os) const2944 void JSAsyncAwaitStatusFunction::Dump(std::ostream &os) const
2945 {
2946 os << " - AsyncContext: ";
2947 os << "\n";
2948 GetAsyncContext().Dump(os);
2949 os << "\n";
2950 }
2951
Dump(std::ostream & os) const2952 void JSGeneratorFunction::Dump(std::ostream &os) const
2953 {
2954 JSFunction::Dump(os);
2955 }
2956
Dump(std::ostream & os) const2957 void JSAsyncGeneratorFunction::Dump(std::ostream &os) const
2958 {
2959 JSFunction::Dump(os);
2960 }
2961
Dump(std::ostream & os) const2962 void JSIntlBoundFunction::Dump(std::ostream &os) const
2963 {
2964 JSObject::Dump(os);
2965 }
2966
Dump(std::ostream & os) const2967 void PropertyBox::Dump(std::ostream &os) const
2968 {
2969 os << " - Value: ";
2970 GetValue().Dump(os);
2971 os << "\n";
2972 }
2973
Dump(std::ostream & os) const2974 void PrototypeHandler::Dump(std::ostream &os) const
2975 {
2976 os << " - HandlerInfo: ";
2977 GetHandlerInfo().Dump(os);
2978 os << "\n";
2979 os << " - ProtoCell: ";
2980 GetHandlerInfo().Dump(os);
2981 os << "\n";
2982 os << " - Holder: ";
2983 GetHandlerInfo().Dump(os);
2984 os << "\n";
2985 }
2986
Dump(std::ostream & os) const2987 void TransitionHandler::Dump(std::ostream &os) const
2988 {
2989 os << " - HandlerInfo: ";
2990 GetHandlerInfo().Dump(os);
2991 os << "\n";
2992 os << " - TransitionHClass: ";
2993 GetTransitionHClass().Dump(os);
2994 os << "\n";
2995 }
2996
Dump(std::ostream & os) const2997 void TransWithProtoHandler::Dump(std::ostream &os) const
2998 {
2999 os << " - HandlerInfo: ";
3000 GetHandlerInfo().Dump(os);
3001 os << "\n";
3002 os << " - TransitionHClass: ";
3003 GetTransitionHClass().Dump(os);
3004 os << "\n";
3005 os << " - Holder: ";
3006 GetHandlerInfo().Dump(os);
3007 os << "\n";
3008 }
3009
Dump(std::ostream & os) const3010 void StoreTSHandler::Dump(std::ostream &os) const
3011 {
3012 os << " - HandlerInfo: ";
3013 GetHandlerInfo().Dump(os);
3014 os << "\n";
3015 os << " - ProtoCell: ";
3016 GetHandlerInfo().Dump(os);
3017 os << "\n";
3018 os << " - Holder: ";
3019 GetHandlerInfo().Dump(os);
3020 os << "\n";
3021 }
3022
Dump(std::ostream & os) const3023 void JSRealm::Dump(std::ostream &os) const
3024 {
3025 os << " - Value: ";
3026 GetValue().Dump(os);
3027 os << "\n";
3028 os << " - GlobalEnv: ";
3029 GetGlobalEnv().Dump(os);
3030 os << "\n";
3031 JSObject::Dump(os);
3032 }
3033 #ifdef ARK_SUPPORT_INTL
Dump(std::ostream & os) const3034 void JSIntl::Dump(std::ostream &os) const
3035 {
3036 os << " - FallbackSymbol: ";
3037 GetFallbackSymbol().Dump(os);
3038 os << "\n";
3039 JSObject::Dump(os);
3040 }
3041
Dump(std::ostream & os) const3042 void JSLocale::Dump(std::ostream &os) const
3043 {
3044 os << " - IcuField: ";
3045 GetIcuField().Dump(os);
3046 os << "\n";
3047 JSObject::Dump(os);
3048 }
3049
Dump(std::ostream & os) const3050 void JSDateTimeFormat::Dump(std::ostream &os) const
3051 {
3052 os << " - Locale: ";
3053 GetLocale().Dump(os);
3054 os << "\n";
3055 os << " - Calendar: ";
3056 GetCalendar().Dump(os);
3057 os << "\n";
3058 os << " - NumberingSystem: ";
3059 GetNumberingSystem().Dump(os);
3060 os << "\n";
3061 os << " - TimeZone: ";
3062 GetTimeZone().Dump(os);
3063 os << "\n";
3064 os << " - HourCycle: " << static_cast<int>(GetHourCycle());
3065 os << "\n";
3066 os << " - LocaleIcu: ";
3067 GetLocaleIcu().Dump(os);
3068 os << "\n";
3069 os << " - SimpleDateTimeFormatIcu: ";
3070 GetSimpleDateTimeFormatIcu().Dump(os);
3071 os << "\n";
3072 os << " - Iso8601: ";
3073 GetIso8601().Dump(os);
3074 os << "\n";
3075 os << " - DateStyle: " << static_cast<int>(GetDateStyle());
3076 os << "\n";
3077 os << " - TimeStyle: " << static_cast<int>(GetTimeStyle());
3078 os << "\n";
3079 os << " - BoundFormat: ";
3080 GetBoundFormat().Dump(os);
3081 os << "\n";
3082 JSObject::Dump(os);
3083 }
3084
Dump(std::ostream & os) const3085 void JSRelativeTimeFormat::Dump(std::ostream &os) const
3086 {
3087 os << " - Locale: ";
3088 GetLocale().Dump(os);
3089 os << "\n";
3090 os << " - NumberingSystem: ";
3091 GetNumberingSystem().Dump(os);
3092 os << "\n";
3093 os << " - Style: " << static_cast<int>(GetStyle());
3094 os << "\n";
3095 os << " - Numeric: " << static_cast<int>(GetNumeric());
3096 os << "\n";
3097 os << " - IcuField: ";
3098 GetIcuField().Dump(os);
3099 os << "\n";
3100 JSObject::Dump(os);
3101 }
3102
Dump(std::ostream & os) const3103 void JSNumberFormat::Dump(std::ostream &os) const
3104 {
3105 os << " - Locale: ";
3106 GetLocale().Dump(os);
3107 os << "\n" << " - NumberingSystem: ";
3108 GetNumberingSystem().Dump(os);
3109 os << "\n" << " - Style: " << static_cast<int>(GetStyle());
3110 os << "\n" << " - Currency: ";
3111 GetCurrency().Dump(os);
3112 os << "\n" << " - CurrencyDisplay: " << static_cast<int>(GetCurrencyDisplay());
3113 os << "\n" << " - CurrencySign: " << static_cast<int>(GetCurrencySign());
3114 os << "\n" << " - Unit: ";
3115 GetUnit().Dump(os);
3116 os << "\n" << " - UnitDisplay: " << static_cast<int>(GetUnitDisplay());
3117 os << "\n" << " - MinimumIntegerDigits: ";
3118 GetMinimumIntegerDigits().Dump(os);
3119 os << "\n" << " - MinimumFractionDigits: ";
3120 GetMinimumFractionDigits().Dump(os);
3121 os << "\n" << " - MaximumFractionDigits: ";
3122 GetMaximumFractionDigits().Dump(os);
3123 os << "\n" << " - MinimumSignificantDigits: ";
3124 GetMinimumSignificantDigits().Dump(os);
3125 os << "\n" << " - MaximumSignificantDigits: ";
3126 GetMaximumSignificantDigits().Dump(os);
3127 os << "\n" << " - UseGrouping: ";
3128 GetUseGrouping().Dump(os);
3129 os << "\n" << " - RoundingType: " << static_cast<int>(GetRoundingType());
3130 os << "\n" << " - Notation: " << static_cast<int>(GetNotation());
3131 os << "\n" << " - CompactDisplay: " << static_cast<int>(GetCompactDisplay());
3132 os << "\n" << " - SignDisplay: " << static_cast<int>(GetSignDisplay());
3133 os << "\n" << " - BoundFormat: ";
3134 GetBoundFormat().Dump(os);
3135 os << "\n" << " - IcuField: ";
3136 GetIcuField().Dump(os);
3137 os << "\n";
3138 JSObject::Dump(os);
3139 }
3140
Dump(std::ostream & os) const3141 void JSCollator::Dump(std::ostream &os) const
3142 {
3143 os << " - IcuField: ";
3144 GetIcuField().Dump(os);
3145 os << "\n - Locale: ";
3146 GetLocale().Dump(os);
3147 os << "\n - Usage: " << static_cast<int>(GetUsage());
3148 os << "\n - Sensitivity: " << static_cast<int>(GetSensitivity());
3149 os << "\n - IgnorePunctuation: " << GetIgnorePunctuation();
3150 os << "\n - Collation: ";
3151 GetCollation().Dump(os);
3152 os << "\n - Numeric: " << GetNumeric();
3153 os << "\n - CaseFirst: " << static_cast<int>(GetCaseFirst());
3154 os << "\n - BoundCompare: ";
3155 GetBoundCompare().Dump(os);
3156 os << "\n";
3157 JSObject::Dump(os);
3158 }
3159
Dump(std::ostream & os) const3160 void JSPluralRules::Dump(std::ostream &os) const
3161 {
3162 os << " - Locale: ";
3163 GetLocale().Dump(os);
3164 os << "\n";
3165 os << " - Type: " << static_cast<int>(GetType());
3166 os << "\n";
3167 os << " - MinimumIntegerDigits: ";
3168 GetMinimumIntegerDigits().Dump(os);
3169 os << "\n";
3170 os << " - MinimumFractionDigits: ";
3171 GetMinimumFractionDigits().Dump(os);
3172 os << "\n";
3173 os << " - MaximumFractionDigits: ";
3174 GetMaximumFractionDigits().Dump(os);
3175 os << "\n";
3176 os << " - MinimumSignificantDigits: ";
3177 GetMinimumSignificantDigits().Dump(os);
3178 os << "\n";
3179 os << " - MaximumSignificantDigits: ";
3180 GetMaximumSignificantDigits().Dump(os);
3181 os << "\n";
3182 os << " - RoundingType: " << static_cast<int>(GetRoundingType());
3183 os << "\n";
3184 os << " - IcuPR: ";
3185 GetIcuPR().Dump(os);
3186 os << "\n";
3187 os << " - IcuNF: ";
3188 GetIcuNF().Dump(os);
3189 os << "\n";
3190 JSObject::Dump(os);
3191 }
3192
Dump(std::ostream & os) const3193 void JSDisplayNames::Dump(std::ostream &os) const
3194 {
3195 os << " - Locale: ";
3196 GetLocale().Dump(os);
3197 os << "\n";
3198 os << " - Type: "<< static_cast<int>(GetType());
3199 os << "\n";
3200 os << " - Style: "<< static_cast<int>(GetStyle());
3201 os << "\n";
3202 os << " - Fallback: "<< static_cast<int>(GetFallback());
3203 os << "\n";
3204 os << " - IcuLDN: ";
3205 GetIcuLDN().Dump(os);
3206 os << "\n";
3207 JSObject::Dump(os);
3208 }
3209
Dump(std::ostream & os) const3210 void JSListFormat::Dump(std::ostream &os) const
3211 {
3212 os << " - Locale: ";
3213 GetLocale().Dump(os);
3214 os << "\n";
3215 os << " - Type: "<< static_cast<int>(GetType());
3216 os << "\n";
3217 os << " - Style: "<< static_cast<int>(GetStyle());
3218 os << "\n";
3219 os << " - IcuLF: ";
3220 GetIcuLF().Dump(os);
3221 os << "\n";
3222 JSObject::Dump(os);
3223 }
3224 #endif
Dump(std::ostream & os) const3225 void JSGeneratorObject::Dump(std::ostream &os) const
3226 {
3227 os << " - GeneratorContext: ";
3228 GetGeneratorContext().Dump(os);
3229 os << "\n";
3230 os << " - ResumeResult: ";
3231 GetResumeResult().Dump(os);
3232 os << "\n";
3233 os << " - GeneratorState: " << static_cast<uint8_t>(GetGeneratorState());
3234 os << "\n";
3235 os << " - ResumeMode: " << static_cast<uint8_t>(GetResumeMode());
3236 os << "\n";
3237 JSObject::Dump(os);
3238 }
3239
Dump(std::ostream & os) const3240 void JSAsyncGeneratorObject::Dump(std::ostream &os) const
3241 {
3242 os << " - GeneratorContext: ";
3243 GetGeneratorContext().Dump(os);
3244 os << "\n";
3245 os << " - AsyncGeneratorQueue: ";
3246 GetAsyncGeneratorQueue().Dump(os);
3247 os << "\n";
3248 os << " - GeneratorBrand: ";
3249 GetGeneratorBrand().Dump(os);
3250 os << "\n";
3251 os << " - ResumeResult: ";
3252 GetResumeResult().Dump(os);
3253 os << "\n";
3254 os << " - AsyncGeneratorState: " << static_cast<uint8_t>(GetAsyncGeneratorState());
3255 os << "\n";
3256 os << " - ResumeMode: " << static_cast<uint8_t>(GetResumeMode());
3257 os << "\n";
3258 JSObject::Dump(os);
3259 }
3260
Dump(std::ostream & os) const3261 void JSAsyncFuncObject::Dump(std::ostream &os) const
3262 {
3263 os << " - Promise: ";
3264 GetPromise().Dump(os);
3265 os << "\n";
3266 }
3267
Dump(std::ostream & os) const3268 void GeneratorContext::Dump(std::ostream &os) const
3269 {
3270 os << " - RegsArray: ";
3271 GetRegsArray().Dump(os);
3272 os << "\n";
3273 os << " - Method: ";
3274 GetMethod().Dump(os);
3275 os << "\n";
3276 os << " - This: ";
3277 GetThis().Dump(os);
3278 os << "\n";
3279 os << " - Acc: ";
3280 GetAcc().Dump(os);
3281 os << "\n";
3282 os << " - GeneratorObject: ";
3283 GetGeneratorObject().Dump(os);
3284 os << "\n";
3285 os << " - LexicalEnv: ";
3286 GetLexicalEnv().Dump(os);
3287 os << "\n";
3288 os << " - NRegs: " << GetNRegs();
3289 os << "\n";
3290 os << " - BCOffset: " << GetBCOffset();
3291 os << "\n";
3292 }
3293
Dump(std::ostream & os) const3294 void ProtoChangeMarker::Dump(std::ostream &os) const
3295 {
3296 os << " - HasChanged: " << GetHasChanged() << "\n";
3297 os << " - HasAccessorChanged: " << GetAccessorHasChanged() << "\n";
3298 }
3299
Dump(std::ostream & os) const3300 void MarkerCell::Dump(std::ostream &os) const
3301 {
3302 os << " - IsDetectorInvalid: " << GetIsDetectorInvalid() << "\n";
3303 }
3304
Dump(std::ostream & os) const3305 void ProtoChangeDetails::Dump(std::ostream &os) const
3306 {
3307 os << " - ChangeListener: ";
3308 GetChangeListener().Dump(os);
3309 os << " \t- RegisterIndex: " << GetRegisterIndex();
3310 os << "\n";
3311 }
3312
Dump(std::ostream & os) const3313 void TrackInfo::Dump(std::ostream &os) const
3314 {
3315 os << " - ElementsKind: " << static_cast<uint32_t>(GetElementsKind()) << "\n";
3316 os << " - ArrayLength: " << static_cast<uint32_t>(GetArrayLength()) << "\n";
3317 os << " - SpaceFlag: " << static_cast<uint32_t>(GetSpaceFlag()) << "\n";
3318 }
3319
Dump(std::ostream & os) const3320 void MachineCode::Dump(std::ostream &os) const
3321 {
3322 os << " - InstructionSizeInBytes: " << GetInstructionSizeInBytes();
3323 os << "\n";
3324 }
3325
Dump(std::ostream & os) const3326 void ClassInfoExtractor::Dump(std::ostream &os) const
3327 {
3328 os << " - NonStaticKeys: ";
3329 GetNonStaticKeys().Dump(os);
3330 os << "\n";
3331 os << " - NonStaticProperties: ";
3332 GetNonStaticProperties().Dump(os);
3333 os << "\n";
3334 os << " - NonStaticElements: ";
3335 GetNonStaticElements().Dump(os);
3336 os << "\n";
3337 os << " - StaticKeys: ";
3338 GetStaticKeys().Dump(os);
3339 os << "\n";
3340 os << " - StaticProperties: ";
3341 GetStaticProperties().Dump(os);
3342 os << "\n";
3343 os << " - StaticElements: ";
3344 GetStaticElements().Dump(os);
3345 os << "\n";
3346 }
3347
Dump(std::ostream & os) const3348 void TSObjectType::Dump(std::ostream &os) const
3349 {
3350 os << " - TSObjectType globalTSTypeRef: ";
3351 GlobalTSTypeRef gt = GetGT();
3352 uint64_t globalTSTypeRef = gt.GetType();
3353 os << globalTSTypeRef;
3354 os << "\n";
3355 os << " - TSObjectType moduleId: ";
3356 uint32_t moduleId = gt.GetModuleId();
3357 os << moduleId;
3358 os << "\n";
3359 os << " - TSObjectType localTypeId: ";
3360 uint32_t localTypeId = gt.GetLocalId();
3361 os << localTypeId;
3362 os << "\n";
3363 os << " - ObjLayoutInfo: ";
3364 DumpArrayClass(TaggedArray::Cast(GetObjLayoutInfo().GetTaggedObject()), os);
3365
3366 os << " - Index signature: ";
3367 if (GetIndexSigns().IsUndefined()) {
3368 os << " no index signature type " << "\n";
3369 } else {
3370 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), os);
3371 }
3372 }
3373
Dump(std::ostream & os) const3374 void TSClassType::Dump(std::ostream &os) const
3375 {
3376 os << " - Dump TSClassType - " << "\n";
3377 os << " - TSClassType globalTSTypeRef: ";
3378 GlobalTSTypeRef gt = GetGT();
3379 uint64_t globalTSTypeRef = gt.GetType();
3380 os << globalTSTypeRef;
3381 os << "\n";
3382 os << " - TSClassType moduleId: ";
3383 uint32_t moduleId = gt.GetModuleId();
3384 os << moduleId;
3385 os << "\n";
3386 os << " - TSClassType localTypeId: ";
3387 uint32_t localTypeId = gt.GetLocalId();
3388 os << localTypeId;
3389 os << "\n";
3390 os << " - ExtensionTypeGT: ";
3391 GlobalTSTypeRef extensionGT = GetExtensionGT();
3392 if (extensionGT.IsDefault()) {
3393 os << " (base class type) ";
3394 } else {
3395 os << extensionGT.GetType();
3396 }
3397 os << "\n";
3398
3399 CString hasLinked = GetHasLinked() ? "true" : "false";
3400 os << " - HasLinked: " << hasLinked << "\n";
3401
3402 os << " - InstanceType: " << "\n";
3403 if (GetInstanceType().IsTSObjectType()) {
3404 TSObjectType *instanceType = TSObjectType::Cast(GetInstanceType().GetTaggedObject());
3405 instanceType->Dump(os);
3406 os << "\n";
3407 }
3408
3409 os << " - ConstructorType: " << "\n";
3410 if (GetConstructorType().IsTSObjectType()) {
3411 TSObjectType *constructorType = TSObjectType::Cast(GetConstructorType().GetTaggedObject());
3412 constructorType->Dump(os);
3413 os << "\n";
3414 }
3415
3416 os << " - PrototypeType: " << "\n";
3417 if (GetPrototypeType().IsTSObjectType()) {
3418 TSObjectType *prototypeType = TSObjectType::Cast(GetPrototypeType().GetTaggedObject());
3419 prototypeType->Dump(os);
3420 os << "\n";
3421 }
3422
3423 os << " - Index signature: ";
3424 if (GetIndexSigns().IsUndefined()) {
3425 os << " no index signature type " << "\n";
3426 } else {
3427 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), os);
3428 }
3429 os << "\n";
3430 }
3431
Dump(std::ostream & os) const3432 void TSInterfaceType::Dump(std::ostream &os) const
3433 {
3434 os << " - Dump Interface Type - " << "\n";
3435 os << " - TSInterfaceType globalTSTypeRef: ";
3436 GlobalTSTypeRef gt = GetGT();
3437 uint64_t globalTSTypeRef = gt.GetType();
3438 os << globalTSTypeRef;
3439 os << "\n";
3440 os << " - TSInterfaceType moduleId: ";
3441 uint32_t moduleId = gt.GetModuleId();
3442 os << moduleId;
3443 os << "\n";
3444 os << " - TSInterfaceType localTypeId: ";
3445 uint32_t localTypeId = gt.GetLocalId();
3446 os << localTypeId;
3447 os << "\n";
3448 os << " - Extends TypeId: " << "\n";
3449 if (TaggedArray::Cast(GetExtends().GetTaggedObject())->GetLength() == 0) {
3450 os << " (base interface type) "<< "\n";
3451 }
3452 DumpArrayClass(TaggedArray::Cast(GetExtends().GetTaggedObject()), os);
3453
3454 os << " - Fields: " << "\n";
3455 if (GetFields().IsTSObjectType()) {
3456 TSObjectType *fieldsType = TSObjectType::Cast(GetFields().GetTaggedObject());
3457 fieldsType->Dump(os);
3458 os << "\n";
3459 }
3460
3461 os << " - Index signature: ";
3462 if (GetIndexSigns().IsUndefined()) {
3463 os << " no index signature type " << "\n";
3464 } else {
3465 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), os);
3466 }
3467 os << "\n";
3468 }
3469
Dump(std::ostream & os) const3470 void TSClassInstanceType::Dump(std::ostream &os) const
3471 {
3472 os << " - Dump ClassInstance Type - " << "\n";
3473 os << " - TSClassInstanceType globalTSTypeRef: ";
3474 GlobalTSTypeRef gt = GetGT();
3475 uint64_t globalTSTypeRef = gt.GetType();
3476 os << globalTSTypeRef;
3477 os << "\n";
3478 os << " - TSClassInstanceType moduleId: ";
3479 uint32_t moduleId = gt.GetModuleId();
3480 os << moduleId;
3481 os << "\n";
3482 os << " - TSClassInstanceType localTypeId: ";
3483 uint32_t localTypeId = gt.GetLocalId();
3484 os << localTypeId;
3485 os << "\n";
3486
3487 os << " - createClassType GT: ";
3488 GlobalTSTypeRef createClassTypeGT = GetClassGT();
3489 os << createClassTypeGT.GetType();
3490 os << "\n";
3491 }
3492
Dump(std::ostream & os) const3493 void TSUnionType::Dump(std::ostream &os) const
3494 {
3495 os << " - Dump UnionType Type - " << "\n";
3496 os << " - TSUnionType globalTSTypeRef: ";
3497 GlobalTSTypeRef gt = GetGT();
3498 uint64_t globalTSTypeRef = gt.GetType();
3499 os << globalTSTypeRef;
3500 os << "\n";
3501 os << " - TSUnionType moduleId: ";
3502 uint32_t moduleId = gt.GetModuleId();
3503 os << moduleId;
3504 os << "\n";
3505 os << " - TSUnionType localTypeId: ";
3506 uint32_t localTypeId = gt.GetLocalId();
3507 os << localTypeId;
3508 os << "\n";
3509 os << " - TSUnionType TypeId: " << "\n";
3510 DumpArrayClass(TaggedArray::Cast(GetComponents().GetTaggedObject()), os);
3511 }
3512
Dump(std::ostream & os) const3513 void TSFunctionType::Dump(std::ostream &os) const
3514 {
3515 os << " - Dump TSFunctionType - " << "\n";
3516 os << " - TSFunctionType globalTSTypeRef: ";
3517 GlobalTSTypeRef gt = GetGT();
3518 uint64_t globalTSTypeRef = gt.GetType();
3519 os << globalTSTypeRef;
3520 os << "\n";
3521 os << " - TSFunctionType moduleId: ";
3522 uint32_t moduleId = gt.GetModuleId();
3523 os << moduleId;
3524 os << "\n";
3525 os << " - TSFunctionType localTypeId: ";
3526 uint32_t localTypeId = gt.GetLocalId();
3527 os << localTypeId;
3528 os << "\n";
3529 os << " - TSFunctionType Name: ";
3530 JSTaggedValue name = GetName();
3531 if (name.IsString()) {
3532 os << ConvertToString(EcmaString::Cast(name.GetTaggedObject()));
3533 }
3534 os << "\n";
3535 os << " - TSFunctionType ParameterTypeIds: " << "\n";
3536 DumpArrayClass(TaggedArray::Cast(GetParameterTypes().GetTaggedObject()), os);
3537 os << " - TSFunctionType ReturnType: " << GetReturnGT().GetType() << "\n";
3538 os << " - TSFunctionType ThisType: " << GetThisGT().GetType() << "\n";
3539 TSFunctionType::Visibility visibility = GetVisibility();
3540 switch (visibility) {
3541 case TSFunctionType::Visibility::PUBLIC:
3542 os << " - Visibility: public";
3543 break;
3544 case TSFunctionType::Visibility::PRIVATE:
3545 os << " - Visibility: private";
3546 break;
3547 case TSFunctionType::Visibility::PROTECTED:
3548 os << " - Visibility: protected";
3549 break;
3550 }
3551 os << " | IsStatic: " << std::boolalpha << GetStatic();
3552 os << " | IsAsync: " << std::boolalpha << GetAsync();
3553 os << " | IsGenerator: " << std::boolalpha << GetGenerator();
3554 os << " | IsGetterSetter: " << std::boolalpha << GetIsGetterSetter();
3555 os << "\n";
3556 }
3557
Dump(std::ostream & os) const3558 void TSArrayType::Dump(std::ostream &os) const
3559 {
3560 os << " - Dump TSArrayType - " << "\n";
3561 os << " - TSArrayType globalTSTypeRef: ";
3562 GlobalTSTypeRef gt = GetGT();
3563 os << gt.GetType();
3564 os << "\n";
3565 os << " - TSArrayType ElementGT: ";
3566 os << GetElementGT().GetType();
3567 os << "\n";
3568 }
3569
Dump(std::ostream & os) const3570 void TSIteratorInstanceType::Dump(std::ostream &os) const
3571 {
3572 os << " - Dump IteratorInstance Type - " << "\n";
3573 os << " - TSIteratorInstanceType globalTSTypeRef: ";
3574 GlobalTSTypeRef gt = GetGT();
3575 uint64_t globalTSTypeRef = gt.GetType();
3576 os << globalTSTypeRef;
3577 os << "\n";
3578 os << " - TSIteratorInstanceType moduleId: ";
3579 uint32_t moduleId = gt.GetModuleId();
3580 os << moduleId;
3581 os << "\n";
3582 os << " - TSIteratorInstanceType localTypeId: ";
3583 uint32_t localTypeId = gt.GetLocalId();
3584 os << localTypeId;
3585 os << "\n";
3586
3587 os << " - TSIteratorInstanceType KindGT: ";
3588 os << GetKindGT().GetType();
3589 os << "\n";
3590
3591 os << " - TSIteratorInstanceType ElementGT: ";
3592 os << GetElementGT().GetType();
3593 os << "\n";
3594 }
3595
Dump(std::ostream & os) const3596 void TSNamespaceType::Dump(std::ostream &os) const
3597 {
3598 os << " - Dump Namespace Type - " << "\n";
3599 os << " - TSNamespaceType globalTSTypeRef: ";
3600 GlobalTSTypeRef gt = GetGT();
3601 uint64_t globalTSTypeRef = gt.GetType();
3602 os << globalTSTypeRef;
3603 os << "\n";
3604 os << " - TSNamespaceType moduleId: ";
3605 uint32_t moduleId = gt.GetModuleId();
3606 os << moduleId;
3607 os << "\n";
3608 os << " - TSNamespaceType localTypeId: ";
3609 uint32_t localTypeId = gt.GetLocalId();
3610 os << localTypeId;
3611 os << "\n";
3612 os << " - Properties: ";
3613 DumpArrayClass(TaggedArray::Cast(GetPropertyType().GetTaggedObject()), os);
3614 }
3615
Dump(std::ostream & os) const3616 void SourceTextModule::Dump(std::ostream &os) const
3617 {
3618 os << " - Environment: ";
3619 GetEnvironment().Dump(os);
3620 os << "\n";
3621 os << " - Namespace: ";
3622 GetNamespace().Dump(os);
3623 os << "\n";
3624 os << " - EcmaModuleFilename: ";
3625 GetEcmaModuleFilename().Dump(os);
3626 os << "\n";
3627 os << " - EcmaModuleRecordName: ";
3628 GetEcmaModuleRecordName().Dump(os);
3629 os << "\n";
3630 os << " - RequestedModules: ";
3631 GetRequestedModules().Dump(os);
3632 os << "\n";
3633 os << " - ImportEntries: ";
3634 GetImportEntries().Dump(os);
3635 os << "\n";
3636 os << " - LocalExportEntries: ";
3637 GetLocalExportEntries().Dump(os);
3638 os << "\n";
3639 os << " - IndirectExportEntries: ";
3640 GetIndirectExportEntries().Dump(os);
3641 os << "\n";
3642 os << " - StarExportEntries: ";
3643 GetStarExportEntries().Dump(os);
3644 os << "\n";
3645 os << " - Status: ";
3646 os << static_cast<int32_t>(GetStatus());
3647 os << "\n";
3648 os << " - EvaluationError: ";
3649 os << GetEvaluationError();
3650 os << "\n";
3651 os << " - DFSIndex: ";
3652 os << GetDFSIndex();
3653 os << "\n";
3654 os << " - DFSAncestorIndex: ";
3655 os << GetDFSAncestorIndex();
3656 os << "\n";
3657 os << " - NameDictionary: ";
3658 GetNameDictionary().Dump(os);
3659 os << "\n";
3660 os << " - CycleRoot: ";
3661 // avoid infinite dump
3662 if (GetCycleRoot() != JSTaggedValue(this)) {
3663 GetCycleRoot().Dump(os);
3664 } else {
3665 os << "this";
3666 }
3667 os << "\n";
3668 os << " - TopLevelCapability: ";
3669 GetTopLevelCapability().Dump(os);
3670 os << "\n";
3671 os << " - AsyncParentModules: ";
3672 GetAsyncParentModules().Dump(os);
3673 os << "\n";
3674 os << " - HasTLA: ";
3675 os << GetHasTLA();
3676 os << "\n";
3677 os << " - AsyncEvaluatingOrdinal: ";
3678 os << GetAsyncEvaluatingOrdinal();
3679 os << "\n";
3680 os << " - PendingAsyncDependencies: ";
3681 os << GetPendingAsyncDependencies();
3682 os << "\n";
3683 }
3684
Dump(std::ostream & os) const3685 void ImportEntry::Dump(std::ostream &os) const
3686 {
3687 os << " - ModuleRequest: ";
3688 GetModuleRequest().Dump(os);
3689 os << "\n";
3690 os << " - ImportName: ";
3691 GetImportName().Dump(os);
3692 os << "\n";
3693 os << " - LocalName: ";
3694 GetLocalName().Dump(os);
3695 os << "\n";
3696 }
3697
Dump(std::ostream & os) const3698 void LocalExportEntry::Dump(std::ostream &os) const
3699 {
3700 os << " - ExportName: ";
3701 GetExportName().Dump(os);
3702 os << "\n";
3703 os << " - LocalName: ";
3704 GetLocalName().Dump(os);
3705 os << "\n";
3706 os << " - LocalIndex: " << GetLocalIndex();
3707 os << "\n";
3708 }
3709
Dump(std::ostream & os) const3710 void IndirectExportEntry::Dump(std::ostream &os) const
3711 {
3712 os << " - ExportName: ";
3713 GetExportName().Dump(os);
3714 os << "\n";
3715 os << " - ModuleRequest: ";
3716 GetModuleRequest().Dump(os);
3717 os << "\n";
3718 os << " - ImportName: ";
3719 GetImportName().Dump(os);
3720 os << "\n";
3721 }
3722
Dump(std::ostream & os) const3723 void StarExportEntry::Dump(std::ostream &os) const
3724 {
3725 os << " - ModuleRequest: ";
3726 GetModuleRequest().Dump(os);
3727 os << "\n";
3728 }
3729
Dump(std::ostream & os) const3730 void ResolvedBinding::Dump(std::ostream &os) const
3731 {
3732 os << " - Module: ";
3733 GetModule().Dump(os);
3734 os << "\n";
3735 os << " - BindingName: ";
3736 GetBindingName().Dump(os);
3737 os << "\n";
3738 }
3739
Dump(std::ostream & os) const3740 void ResolvedIndexBinding::Dump(std::ostream &os) const
3741 {
3742 os << " - Module: ";
3743 GetModule().Dump(os);
3744 os << "\n";
3745 os << " - Index: ";
3746 GetIndex();
3747 os << "\n";
3748 }
3749
Dump(std::ostream & os) const3750 void ModuleNamespace::Dump(std::ostream &os) const
3751 {
3752 os << " - Exports: ";
3753 GetExports().Dump(os);
3754 os << "\n";
3755 }
3756
Dump(std::ostream & os) const3757 void CjsModule::Dump(std::ostream &os) const
3758 {
3759 os << " - current module path: ";
3760 GetPath().Dump(os);
3761 os << "\n";
3762 os << " - current module filename: ";
3763 GetFilename().Dump(os);
3764 os << "\n";
3765 }
3766
Dump(std::ostream & os) const3767 void CjsRequire::Dump(std::ostream &os) const
3768 {
3769 os << " --- CjsRequire is JSFunction: ";
3770 os << "\n";
3771 }
3772
Dump(std::ostream & os) const3773 void CjsExports::Dump(std::ostream &os) const
3774 {
3775 DISALLOW_GARBAGE_COLLECTION;
3776 JSHClass *jshclass = GetJSHClass();
3777 os << " - hclass: " << std::hex << jshclass << "\n";
3778 os << " - prototype: ";
3779 jshclass->GetPrototype().DumpTaggedValue(os);
3780 os << "\n";
3781
3782 TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject());
3783 os << " - properties: " << std::hex << properties;
3784
3785 if (!properties->IsDictionaryMode()) {
3786 JSTaggedValue attrs = jshclass->GetLayout();
3787 if (attrs.IsNull()) {
3788 return;
3789 }
3790
3791 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
3792 int propNumber = static_cast<int>(jshclass->NumberOfProps());
3793 os << " <LayoutInfo[" << std::dec << propNumber << "]>\n";
3794 for (int i = 0; i < propNumber; i++) {
3795 JSTaggedValue key = layoutInfo->GetKey(i);
3796 PropertyAttributes attr = layoutInfo->GetAttr(i);
3797 ASSERT(i == static_cast<int>(attr.GetOffset()));
3798 os << " " << std::right << std::setw(DUMP_PROPERTY_OFFSET);
3799 DumpPropertyKey(key, os);
3800 os << ": (";
3801 JSTaggedValue val;
3802 if (attr.IsInlinedProps()) {
3803 val = GetPropertyInlinedPropsWithRep(i, attr);
3804 } else {
3805 val = properties->Get(i - static_cast<int>(jshclass->GetInlinedProperties()));
3806 }
3807 val.DumpTaggedValue(os);
3808 os << ") ";
3809 DumpAttr(attr, true, os);
3810 os << "\n";
3811 }
3812 } else {
3813 NameDictionary *dict = NameDictionary::Cast(properties);
3814 os << " <NameDictionary[" << std::dec << dict->EntriesCount() << "]>\n";
3815 dict->Dump(os);
3816 }
3817 }
3818
Dump(std::ostream & os) const3819 void JSFunctionBase::Dump(std::ostream &os) const
3820 {
3821 os << " - Method: ";
3822 GetMethod().Dump(os);
3823 os << "\n";
3824 }
3825
Dump(std::ostream & os) const3826 void Method::Dump(std::ostream &os) const
3827 {
3828 os << " - MethodName: ";
3829 os << GetMethodName();
3830 os << "\n";
3831 os << " - ConstantPool: ";
3832 GetConstantPool().Dump(os);
3833 os << "\n";
3834 os << " - ProfileTypeInfo: ";
3835 GetProfileTypeInfo().Dump(os);
3836 os << "\n";
3837 os << " - Module: ";
3838 GetModule().Dump(os);
3839 os << "\n";
3840 os << " - FunctionKind: " << static_cast<int>(GetFunctionKind());
3841 os << "\n";
3842 os << " - CodeEntryOrLiteral: " << std::hex << GetCodeEntryOrLiteral() << "\n";
3843 os << "\n";
3844 }
3845
Dump(std::ostream & os) const3846 void ClassLiteral::Dump(std::ostream &os) const
3847 {
3848 os << " - ClassLiteral: ";
3849 os << "\n";
3850 os << " - IsAOTUsed: " << std::boolalpha << GetIsAOTUsed();
3851 os << "\n";
3852 os << " - Array: ";
3853 GetArray().Dump(os);
3854 os << "\n";
3855 }
3856
3857 // ########################################################################################
3858 // Dump for Snapshot
3859 // ########################################################################################
DumpArrayClass(const TaggedArray * arr,std::vector<Reference> & vec)3860 static void DumpArrayClass(const TaggedArray *arr, std::vector<Reference> &vec)
3861 {
3862 DISALLOW_GARBAGE_COLLECTION;
3863 uint32_t len = arr->GetLength();
3864 vec.reserve(vec.size() + len);
3865 for (uint32_t i = 0; i < len; i++) {
3866 JSTaggedValue val(arr->Get(i));
3867 CString str = ToCString(i);
3868 vec.emplace_back(str, val);
3869 }
3870 }
3871
DumpMutantTaggedArrayClass(const MutantTaggedArray * arr,std::vector<Reference> & vec)3872 static void DumpMutantTaggedArrayClass(const MutantTaggedArray *arr, std::vector<Reference> &vec)
3873 {
3874 DISALLOW_GARBAGE_COLLECTION;
3875 uint32_t len = arr->GetLength();
3876 vec.reserve(vec.size() + len);
3877 for (uint32_t i = 0; i < len; i++) {
3878 JSTaggedValue val(arr->Get(i));
3879 CString str = ToCString(i);
3880 vec.emplace_back(str, val);
3881 }
3882 }
3883
DumpCOWMutantTaggedArrayClass(const COWMutantTaggedArray * arr,std::vector<Reference> & vec)3884 static void DumpCOWMutantTaggedArrayClass(const COWMutantTaggedArray *arr, std::vector<Reference> &vec)
3885 {
3886 DISALLOW_GARBAGE_COLLECTION;
3887 uint32_t len = arr->GetLength();
3888 vec.reserve(vec.size() + len);
3889 for (uint32_t i = 0; i < len; i++) {
3890 JSTaggedValue val(arr->Get(i));
3891 CString str = ToCString(i);
3892 vec.emplace_back(str, val);
3893 }
3894 }
3895
DumpElementClass(const TaggedArray * arr,std::vector<Reference> & vec)3896 static void DumpElementClass(const TaggedArray *arr, std::vector<Reference> &vec)
3897 {
3898 DISALLOW_GARBAGE_COLLECTION;
3899 uint32_t len = arr->GetLength();
3900 vec.reserve(vec.size() + len);
3901 for (uint32_t i = 0; i < len; i++) {
3902 JSTaggedValue val(arr->Get(i));
3903 vec.emplace_back(i, val, Reference::ReferenceType::ELEMENT);
3904 }
3905 }
3906
DumpConstantPoolClass(const ConstantPool * arr,std::vector<Reference> & vec)3907 static void DumpConstantPoolClass(const ConstantPool *arr, std::vector<Reference> &vec)
3908 {
3909 DISALLOW_GARBAGE_COLLECTION;
3910 uint32_t len = arr->GetCacheLength();
3911 vec.reserve(vec.size() + len);
3912 for (uint32_t i = 0; i < len; i++) {
3913 JSTaggedValue val(arr->GetObjectFromCache(i));
3914 CString str = ToCString(i);
3915 vec.emplace_back(str, val);
3916 }
3917 }
3918
DumpStringClass(const EcmaString * str,std::vector<Reference> & vec)3919 static void DumpStringClass([[maybe_unused]] const EcmaString *str, [[maybe_unused]] std::vector<Reference> &vec)
3920 {
3921 // Before EcmaString dump self node, it need not show, so delete.
3922 // If some properties need be shown, add here.
3923 }
3924
DumpObject(TaggedObject * obj,std::vector<Reference> & vec,bool isVmMode)3925 static void DumpObject(TaggedObject *obj, std::vector<Reference> &vec, bool isVmMode)
3926 {
3927 DISALLOW_GARBAGE_COLLECTION;
3928 auto jsHclass = obj->GetClass();
3929 JSType type = jsHclass->GetObjectType();
3930 vec.emplace_back("hclass", JSTaggedValue(jsHclass));
3931 switch (type) {
3932 case JSType::HCLASS:
3933 JSHClass::Cast(obj)->DumpForSnapshot(vec);
3934 return;
3935 case JSType::TAGGED_ARRAY:
3936 case JSType::TAGGED_DICTIONARY:
3937 case JSType::LEXICAL_ENV:
3938 case JSType::COW_TAGGED_ARRAY:
3939 case JSType::AOT_LITERAL_INFO:
3940 DumpArrayClass(TaggedArray::Cast(obj), vec);
3941 return;
3942 case JSType::MUTANT_TAGGED_ARRAY:
3943 DumpMutantTaggedArrayClass(MutantTaggedArray::Cast(obj), vec);
3944 return;
3945 case JSType::COW_MUTANT_TAGGED_ARRAY:
3946 DumpCOWMutantTaggedArrayClass(COWMutantTaggedArray::Cast(obj), vec);
3947 return;
3948 case JSType::CONSTANT_POOL:
3949 DumpConstantPoolClass(ConstantPool::Cast(obj), vec);
3950 return;
3951 case JSType::VTABLE:
3952 VTable::Cast(obj)->DumpForSnapshot(vec);
3953 return;
3954 case JSType::PROFILE_TYPE_INFO:
3955 ProfileTypeInfo::Cast(obj)->DumpForSnapshot(vec);
3956 return;
3957 case JSType::LINE_STRING:
3958 case JSType::CONSTANT_STRING:
3959 case JSType::TREE_STRING:
3960 case JSType::SLICED_STRING:
3961 DumpStringClass(EcmaString::Cast(obj), vec);
3962 return;
3963 case JSType::JS_NATIVE_POINTER:
3964 return;
3965 case JSType::JS_OBJECT:
3966 case JSType::JS_ERROR:
3967 case JSType::JS_EVAL_ERROR:
3968 case JSType::JS_RANGE_ERROR:
3969 case JSType::JS_TYPE_ERROR:
3970 case JSType::JS_AGGREGATE_ERROR:
3971 case JSType::JS_REFERENCE_ERROR:
3972 case JSType::JS_URI_ERROR:
3973 case JSType::JS_SYNTAX_ERROR:
3974 case JSType::JS_OOM_ERROR:
3975 case JSType::JS_TERMINATION_ERROR:
3976 case JSType::JS_ARGUMENTS:
3977 case JSType::JS_GLOBAL_OBJECT:
3978 case JSType::JS_SHARED_OBJECT:
3979 JSObject::Cast(obj)->DumpForSnapshot(vec);
3980 return;
3981 case JSType::JS_FUNCTION_BASE:
3982 case JSType::JS_FUNCTION:
3983 case JSType::JS_SHARED_FUNCTION:
3984 JSFunction::Cast(obj)->DumpForSnapshot(vec);
3985 return;
3986 case JSType::JS_BOUND_FUNCTION:
3987 JSBoundFunction::Cast(obj)->DumpForSnapshot(vec);
3988 return;
3989 case JSType::JS_SET:
3990 JSSet::Cast(obj)->DumpForSnapshot(vec);
3991 return;
3992 case JSType::JS_MAP:
3993 JSMap::Cast(obj)->DumpForSnapshot(vec);
3994 return;
3995 case JSType::JS_WEAK_SET:
3996 JSWeakSet::Cast(obj)->DumpForSnapshot(vec);
3997 return;
3998 case JSType::JS_WEAK_MAP:
3999 JSWeakMap::Cast(obj)->DumpForSnapshot(vec);
4000 return;
4001 case JSType::JS_WEAK_REF:
4002 JSWeakRef::Cast(obj)->DumpForSnapshot(vec);
4003 return;
4004 case JSType::JS_FINALIZATION_REGISTRY:
4005 JSFinalizationRegistry::Cast(obj)->DumpForSnapshot(vec);
4006 return;
4007 case JSType::CELL_RECORD:
4008 CellRecord::Cast(obj)->DumpForSnapshot(vec);
4009 return;
4010 case JSType::JS_REG_EXP:
4011 JSRegExp::Cast(obj)->DumpForSnapshot(vec);
4012 return;
4013 case JSType::JS_DATE:
4014 JSDate::Cast(obj)->DumpForSnapshot(vec);
4015 return;
4016 case JSType::JS_ARRAY:
4017 JSArray::Cast(obj)->DumpForSnapshot(vec);
4018 return;
4019 case JSType::JS_TYPED_ARRAY:
4020 case JSType::JS_INT8_ARRAY:
4021 case JSType::JS_UINT8_ARRAY:
4022 case JSType::JS_UINT8_CLAMPED_ARRAY:
4023 case JSType::JS_INT16_ARRAY:
4024 case JSType::JS_UINT16_ARRAY:
4025 case JSType::JS_INT32_ARRAY:
4026 case JSType::JS_UINT32_ARRAY:
4027 case JSType::JS_FLOAT32_ARRAY:
4028 case JSType::JS_FLOAT64_ARRAY:
4029 case JSType::JS_BIGINT64_ARRAY:
4030 case JSType::JS_BIGUINT64_ARRAY:
4031 JSTypedArray::Cast(obj)->DumpForSnapshot(vec);
4032 return;
4033 case JSType::BIGINT:
4034 BigInt::Cast(obj)->DumpForSnapshot(vec);
4035 return;
4036 case JSType::BYTE_ARRAY:
4037 ByteArray::Cast(obj)->DumpForSnapshot(vec);
4038 return;
4039 case JSType::JS_PROXY:
4040 JSProxy::Cast(obj)->DumpForSnapshot(vec);
4041 return;
4042 case JSType::JS_PRIMITIVE_REF:
4043 JSPrimitiveRef::Cast(obj)->DumpForSnapshot(vec);
4044 return;
4045 case JSType::SYMBOL:
4046 JSSymbol::Cast(obj)->DumpForSnapshot(vec);
4047 return;
4048 case JSType::ACCESSOR_DATA:
4049 case JSType::INTERNAL_ACCESSOR:
4050 AccessorData::Cast(obj)->DumpForSnapshot(vec);
4051 return;
4052 case JSType::JS_DATA_VIEW:
4053 JSDataView::Cast(obj)->DumpForSnapshot(vec);
4054 return;
4055 case JSType::PROMISE_REACTIONS:
4056 PromiseReaction::Cast(obj)->DumpForSnapshot(vec);
4057 return;
4058 case JSType::PROMISE_CAPABILITY:
4059 PromiseCapability::Cast(obj)->DumpForSnapshot(vec);
4060 return;
4061 case JSType::PROMISE_ITERATOR_RECORD:
4062 PromiseIteratorRecord::Cast(obj)->DumpForSnapshot(vec);
4063 return;
4064 case JSType::PROMISE_RECORD:
4065 PromiseRecord::Cast(obj)->DumpForSnapshot(vec);
4066 return;
4067 case JSType::RESOLVING_FUNCTIONS_RECORD:
4068 ResolvingFunctionsRecord::Cast(obj)->DumpForSnapshot(vec);
4069 return;
4070 case JSType::JS_PROMISE:
4071 JSPromise::Cast(obj)->DumpForSnapshot(vec);
4072 return;
4073 case JSType::JS_PROMISE_REACTIONS_FUNCTION:
4074 JSPromiseReactionsFunction::Cast(obj)->DumpForSnapshot(vec);
4075 return;
4076 case JSType::JS_PROMISE_EXECUTOR_FUNCTION:
4077 JSPromiseExecutorFunction::Cast(obj)->DumpForSnapshot(vec);
4078 return;
4079 case JSType::JS_ASYNC_MODULE_FULFILLED_FUNCTION:
4080 JSAsyncModuleFulfilledFunction::Cast(obj)->DumpForSnapshot(vec);
4081 return;
4082 case JSType::JS_ASYNC_MODULE_REJECTED_FUNCTION:
4083 JSAsyncModuleRejectedFunction::Cast(obj)->DumpForSnapshot(vec);
4084 return;
4085 case JSType::ASYNC_GENERATOR_REQUEST:
4086 AsyncGeneratorRequest::Cast(obj)->DumpForSnapshot(vec);
4087 return;
4088 case JSType::ASYNC_ITERATOR_RECORD:
4089 AsyncIteratorRecord::Cast(obj)->DumpForSnapshot(vec);
4090 return;
4091 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR:
4092 JSAsyncFromSyncIterator::Cast(obj)->DumpForSnapshot(vec);
4093 return;
4094 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION:
4095 JSAsyncFromSyncIterUnwarpFunction::Cast(obj)->DumpForSnapshot(vec);
4096 return;
4097 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION:
4098 JSPromiseAllResolveElementFunction::Cast(obj)->DumpForSnapshot(vec);
4099 return;
4100 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION:
4101 JSPromiseAnyRejectElementFunction::Cast(obj)->DumpForSnapshot(vec);
4102 return;
4103 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION:
4104 JSPromiseAllSettledElementFunction::Cast(obj)->DumpForSnapshot(vec);
4105 return;
4106 case JSType::JS_PROMISE_FINALLY_FUNCTION:
4107 JSPromiseFinallyFunction::Cast(obj)->DumpForSnapshot(vec);
4108 return;
4109 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION:
4110 JSPromiseValueThunkOrThrowerFunction::Cast(obj)->DumpForSnapshot(vec);
4111 return;
4112 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN:
4113 JSAsyncGeneratorResNextRetProRstFtn::Cast(obj)->DumpForSnapshot(vec);
4114 return;
4115 case JSType::MICRO_JOB_QUEUE:
4116 MicroJobQueue::Cast(obj)->DumpForSnapshot(vec);
4117 return;
4118 case JSType::PENDING_JOB:
4119 PendingJob::Cast(obj)->DumpForSnapshot(vec);
4120 return;
4121 case JSType::COMPLETION_RECORD:
4122 CompletionRecord::Cast(obj)->DumpForSnapshot(vec);
4123 return;
4124 case JSType::JS_ITERATOR:
4125 case JSType::JS_ASYNCITERATOR:
4126 case JSType::JS_FORIN_ITERATOR:
4127 case JSType::JS_MAP_ITERATOR:
4128 case JSType::JS_SET_ITERATOR:
4129 case JSType::JS_ARRAY_ITERATOR:
4130 case JSType::JS_STRING_ITERATOR:
4131 case JSType::JS_REG_EXP_ITERATOR:
4132 case JSType::JS_ARRAY_BUFFER:
4133 JSArrayBuffer::Cast(obj)->DumpForSnapshot(vec);
4134 return;
4135 case JSType::JS_SHARED_ARRAY_BUFFER:
4136 JSArrayBuffer::Cast(obj)->DumpForSnapshot(vec);
4137 return;
4138 case JSType::JS_PROXY_REVOC_FUNCTION:
4139 JSProxyRevocFunction::Cast(obj)->DumpForSnapshot(vec);
4140 return;
4141 case JSType::JS_ASYNC_FUNCTION:
4142 JSAsyncFunction::Cast(obj)->DumpForSnapshot(vec);
4143 return;
4144 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION:
4145 JSAsyncAwaitStatusFunction::Cast(obj)->DumpForSnapshot(vec);
4146 return;
4147 case JSType::JS_GENERATOR_FUNCTION:
4148 JSGeneratorFunction::Cast(obj)->DumpForSnapshot(vec);
4149 return;
4150 case JSType::JS_ASYNC_GENERATOR_FUNCTION:
4151 JSAsyncGeneratorFunction::Cast(obj)->DumpForSnapshot(vec);
4152 return;
4153 case JSType::JS_INTL_BOUND_FUNCTION:
4154 JSIntlBoundFunction::Cast(obj)->DumpForSnapshot(vec);
4155 return;
4156 case JSType::JS_REALM:
4157 JSRealm::Cast(obj)->DumpForSnapshot(vec);
4158 return;
4159 #ifdef ARK_SUPPORT_INTL
4160 case JSType::JS_INTL:
4161 JSIntl::Cast(obj)->DumpForSnapshot(vec);
4162 return;
4163 case JSType::JS_LOCALE:
4164 JSLocale::Cast(obj)->DumpForSnapshot(vec);
4165 return;
4166 case JSType::JS_DATE_TIME_FORMAT:
4167 JSDateTimeFormat::Cast(obj)->DumpForSnapshot(vec);
4168 return;
4169 case JSType::JS_RELATIVE_TIME_FORMAT:
4170 JSRelativeTimeFormat::Cast(obj)->DumpForSnapshot(vec);
4171 return;
4172 case JSType::JS_NUMBER_FORMAT:
4173 JSNumberFormat::Cast(obj)->DumpForSnapshot(vec);
4174 return;
4175 case JSType::JS_COLLATOR:
4176 JSCollator::Cast(obj)->DumpForSnapshot(vec);
4177 return;
4178 case JSType::JS_PLURAL_RULES:
4179 JSPluralRules::Cast(obj)->DumpForSnapshot(vec);
4180 return;
4181 case JSType::JS_DISPLAYNAMES:
4182 JSDisplayNames::Cast(obj)->DumpForSnapshot(vec);
4183 return;
4184 case JSType::JS_LIST_FORMAT:
4185 JSListFormat::Cast(obj)->DumpForSnapshot(vec);
4186 return;
4187 #else
4188 case JSType::JS_INTL:
4189 case JSType::JS_LOCALE:
4190 case JSType::JS_DATE_TIME_FORMAT:
4191 case JSType::JS_RELATIVE_TIME_FORMAT:
4192 case JSType::JS_NUMBER_FORMAT:
4193 case JSType::JS_COLLATOR:
4194 case JSType::JS_PLURAL_RULES:
4195 case JSType::JS_DISPLAYNAMES:
4196 case JSType::JS_LIST_FORMAT:
4197 return;
4198 #endif
4199 case JSType::JS_CJS_MODULE:
4200 CjsModule::Cast(obj)->DumpForSnapshot(vec);
4201 return;
4202 case JSType::JS_CJS_EXPORTS:
4203 CjsExports::Cast(obj)->DumpForSnapshot(vec);
4204 return;
4205 case JSType::JS_CJS_REQUIRE:
4206 CjsRequire::Cast(obj)->DumpForSnapshot(vec);
4207 return;
4208 case JSType::JS_GENERATOR_OBJECT:
4209 JSGeneratorObject::Cast(obj)->DumpForSnapshot(vec);
4210 return;
4211 case JSType::JS_ASYNC_GENERATOR_OBJECT:
4212 JSAsyncGeneratorObject::Cast(obj)->DumpForSnapshot(vec);
4213 return;
4214 case JSType::JS_ASYNC_FUNC_OBJECT:
4215 JSAsyncFuncObject::Cast(obj)->DumpForSnapshot(vec);
4216 return;
4217 case JSType::JS_GENERATOR_CONTEXT:
4218 GeneratorContext::Cast(obj)->DumpForSnapshot(vec);
4219 return;
4220 case JSType::JS_API_ARRAY_LIST:
4221 JSAPIArrayList::Cast(obj)->DumpForSnapshot(vec);
4222 return;
4223 case JSType::JS_API_ARRAYLIST_ITERATOR:
4224 JSAPIArrayListIterator::Cast(obj)->DumpForSnapshot(vec);
4225 return;
4226 case JSType::LINKED_NODE:
4227 LinkedNode::Cast(obj)->DumpForSnapshot(vec);
4228 return;
4229 case JSType::RB_TREENODE:
4230 return;
4231 case JSType::JS_API_HASH_MAP:
4232 JSAPIHashMap::Cast(obj)->DumpForSnapshot(vec);
4233 return;
4234 case JSType::JS_API_HASH_SET:
4235 JSAPIHashSet::Cast(obj)->DumpForSnapshot(vec);
4236 return;
4237 case JSType::JS_API_HASHMAP_ITERATOR:
4238 JSAPIHashMapIterator::Cast(obj)->DumpForSnapshot(vec);
4239 return;
4240 case JSType::JS_API_HASHSET_ITERATOR:
4241 JSAPIHashSetIterator::Cast(obj)->DumpForSnapshot(vec);
4242 return;
4243 case JSType::JS_API_LIGHT_WEIGHT_MAP:
4244 JSAPILightWeightMap::Cast(obj)->DumpForSnapshot(vec);
4245 return;
4246 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR:
4247 JSAPILightWeightMapIterator::Cast(obj)->DumpForSnapshot(vec);
4248 return;
4249 case JSType::JS_API_LIGHT_WEIGHT_SET:
4250 JSAPILightWeightSet::Cast(obj)->DumpForSnapshot(vec);
4251 return;
4252 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR:
4253 JSAPILightWeightSetIterator::Cast(obj)->DumpForSnapshot(vec);
4254 return;
4255 case JSType::JS_API_TREE_MAP:
4256 JSAPITreeMap::Cast(obj)->DumpForSnapshot(vec);
4257 return;
4258 case JSType::JS_API_TREE_SET:
4259 JSAPITreeSet::Cast(obj)->DumpForSnapshot(vec);
4260 return;
4261 case JSType::JS_API_TREEMAP_ITERATOR:
4262 JSAPITreeMapIterator::Cast(obj)->DumpForSnapshot(vec);
4263 return;
4264 case JSType::JS_API_TREESET_ITERATOR:
4265 JSAPITreeSetIterator::Cast(obj)->DumpForSnapshot(vec);
4266 return;
4267 case JSType::JS_API_VECTOR:
4268 JSAPIVector::Cast(obj)->DumpForSnapshot(vec);
4269 return;
4270 case JSType::JS_API_VECTOR_ITERATOR:
4271 JSAPIVectorIterator::Cast(obj)->DumpForSnapshot(vec);
4272 return;
4273 case JSType::JS_API_QUEUE:
4274 JSAPIQueue::Cast(obj)->DumpForSnapshot(vec);
4275 return;
4276 case JSType::JS_API_QUEUE_ITERATOR:
4277 JSAPIQueueIterator::Cast(obj)->DumpForSnapshot(vec);
4278 return;
4279 case JSType::JS_API_DEQUE:
4280 JSAPIDeque::Cast(obj)->DumpForSnapshot(vec);
4281 return;
4282 case JSType::JS_API_DEQUE_ITERATOR:
4283 JSAPIDequeIterator::Cast(obj)->DumpForSnapshot(vec);
4284 return;
4285 case JSType::JS_API_STACK:
4286 JSAPIStack::Cast(obj)->DumpForSnapshot(vec);
4287 return;
4288 case JSType::JS_API_STACK_ITERATOR:
4289 JSAPIStackIterator::Cast(obj)->DumpForSnapshot(vec);
4290 return;
4291 case JSType::JS_API_LIST:
4292 JSAPIList::Cast(obj)->DumpForSnapshot(vec);
4293 return;
4294 case JSType::JS_API_LINKED_LIST:
4295 JSAPILinkedList::Cast(obj)->DumpForSnapshot(vec);
4296 return;
4297 case JSType::JS_API_LIST_ITERATOR:
4298 JSAPIListIterator::Cast(obj)->DumpForSnapshot(vec);
4299 return;
4300 case JSType::JS_API_LINKED_LIST_ITERATOR:
4301 JSAPILinkedListIterator::Cast(obj)->DumpForSnapshot(vec);
4302 return;
4303 case JSType::SOURCE_TEXT_MODULE_RECORD:
4304 SourceTextModule::Cast(obj)->DumpForSnapshot(vec);
4305 return;
4306 case JSType::IMPORTENTRY_RECORD:
4307 ImportEntry::Cast(obj)->DumpForSnapshot(vec);
4308 return;
4309 case JSType::LOCAL_EXPORTENTRY_RECORD:
4310 LocalExportEntry::Cast(obj)->DumpForSnapshot(vec);
4311 return;
4312 case JSType::INDIRECT_EXPORTENTRY_RECORD:
4313 IndirectExportEntry::Cast(obj)->DumpForSnapshot(vec);
4314 return;
4315 case JSType::STAR_EXPORTENTRY_RECORD:
4316 StarExportEntry::Cast(obj)->DumpForSnapshot(vec);
4317 return;
4318 case JSType::RESOLVEDBINDING_RECORD:
4319 ResolvedBinding::Cast(obj)->DumpForSnapshot(vec);
4320 return;
4321 case JSType::RESOLVEDINDEXBINDING_RECORD:
4322 ResolvedIndexBinding::Cast(obj)->DumpForSnapshot(vec);
4323 return;
4324 case JSType::JS_MODULE_NAMESPACE:
4325 ModuleNamespace::Cast(obj)->DumpForSnapshot(vec);
4326 return;
4327 case JSType::JS_API_PLAIN_ARRAY:
4328 JSAPIPlainArray::Cast(obj)->DumpForSnapshot(vec);
4329 return;
4330 case JSType::JS_API_PLAIN_ARRAY_ITERATOR:
4331 JSAPIPlainArrayIterator::Cast(obj)->DumpForSnapshot(vec);
4332 return;
4333 default:
4334 break;
4335 }
4336 if (isVmMode) {
4337 switch (type) {
4338 case JSType::PROPERTY_BOX:
4339 PropertyBox::Cast(obj)->DumpForSnapshot(vec);
4340 return;
4341 case JSType::TEMPLATE_MAP:
4342 DumpArrayClass(TaggedArray::Cast(obj), vec);
4343 return;
4344 case JSType::GLOBAL_ENV:
4345 GlobalEnv::Cast(obj)->DumpForSnapshot(vec);
4346 return;
4347 case JSType::PROTO_CHANGE_MARKER:
4348 ProtoChangeMarker::Cast(obj)->DumpForSnapshot(vec);
4349 return;
4350 case JSType::MARKER_CELL:
4351 MarkerCell::Cast(obj)->DumpForSnapshot(vec);
4352 return;
4353 case JSType::PROTOTYPE_INFO:
4354 ProtoChangeDetails::Cast(obj)->DumpForSnapshot(vec);
4355 return;
4356 case JSType::TRACK_INFO:
4357 TrackInfo::Cast(obj)->DumpForSnapshot(vec);
4358 return;
4359 case JSType::PROGRAM:
4360 Program::Cast(obj)->DumpForSnapshot(vec);
4361 return;
4362 case JSType::MACHINE_CODE_OBJECT:
4363 MachineCode::Cast(obj)->DumpForSnapshot(vec);
4364 return;
4365 case JSType::TRANSITION_HANDLER:
4366 TransitionHandler::Cast(obj)->DumpForSnapshot(vec);
4367 return;
4368 case JSType::TRANS_WITH_PROTO_HANDLER:
4369 TransWithProtoHandler::Cast(obj)->DumpForSnapshot(vec);
4370 return;
4371 case JSType::STORE_TS_HANDLER:
4372 StoreTSHandler::Cast(obj)->DumpForSnapshot(vec);
4373 return;
4374 case JSType::PROTOTYPE_HANDLER:
4375 PrototypeHandler::Cast(obj)->DumpForSnapshot(vec);
4376 return;
4377 case JSType::CLASS_INFO_EXTRACTOR:
4378 ClassInfoExtractor::Cast(obj)->DumpForSnapshot(vec);
4379 return;
4380 case JSType::TS_OBJECT_TYPE:
4381 TSObjectType::Cast(obj)->DumpForSnapshot(vec);
4382 return;
4383 case JSType::TS_CLASS_TYPE:
4384 TSClassType::Cast(obj)->DumpForSnapshot(vec);
4385 return;
4386 case JSType::TS_INTERFACE_TYPE:
4387 TSInterfaceType::Cast(obj)->DumpForSnapshot(vec);
4388 return;
4389 case JSType::TS_CLASS_INSTANCE_TYPE:
4390 TSClassInstanceType::Cast(obj)->DumpForSnapshot(vec);
4391 return;
4392 case JSType::TS_UNION_TYPE:
4393 TSUnionType::Cast(obj)->DumpForSnapshot(vec);
4394 return;
4395 case JSType::TS_FUNCTION_TYPE:
4396 TSFunctionType::Cast(obj)->DumpForSnapshot(vec);
4397 return;
4398 case JSType::TS_ARRAY_TYPE:
4399 TSArrayType::Cast(obj)->DumpForSnapshot(vec);
4400 return;
4401 case JSType::TS_ITERATOR_INSTANCE_TYPE:
4402 TSIteratorInstanceType::Cast(obj)->DumpForSnapshot(vec);
4403 return;
4404 case JSType::TS_NAMESPACE_TYPE:
4405 TSNamespaceType::Cast(obj)->DumpForSnapshot(vec);
4406 return;
4407 case JSType::METHOD:
4408 Method::Cast(obj)->DumpForSnapshot(vec);
4409 return;
4410 case JSType::CLASS_LITERAL:
4411 ClassLiteral::Cast(obj)->DumpForSnapshot(vec);
4412 return;
4413 default:
4414 LOG_ECMA(FATAL) << "this branch is unreachable";
4415 UNREACHABLE();
4416 break;
4417 }
4418 } else {
4419 vec.pop_back();
4420 }
4421 }
4422
EcmaStringToStd(CString & res,EcmaString * str)4423 static inline void EcmaStringToStd(CString &res, EcmaString *str)
4424 {
4425 if (EcmaStringAccessor(str).GetLength() == 0) {
4426 CString emptyStr = "EmptyString";
4427 res.append(emptyStr);
4428 }
4429
4430 CString string = ConvertToString(str);
4431 res.append(string);
4432 }
4433
KeyToStd(CString & res,JSTaggedValue key)4434 static void KeyToStd(CString &res, JSTaggedValue key)
4435 {
4436 if (key.IsInt()) {
4437 res = std::to_string(key.GetInt());
4438 } else if (key.IsDouble()) {
4439 res = std::to_string(key.GetDouble());
4440 } else if (key.IsBoolean()) {
4441 res = key.IsTrue() ? "true" : "false";
4442 } else if (key.IsHeapObject()) {
4443 if (key.IsWeak()) {
4444 key.RemoveWeakTag();
4445 }
4446 if (key.IsString()) {
4447 EcmaStringToStd(res, EcmaString::Cast(key.GetTaggedObject()));
4448 } else if (key.IsSymbol()) {
4449 JSSymbol *sym = JSSymbol::Cast(key.GetTaggedObject());
4450 JSTaggedValue desc = sym->GetDescription();
4451 if (desc.IsString()) {
4452 EcmaStringToStd(res, EcmaString::Cast(desc.GetTaggedObject()));
4453 }
4454 }
4455 }
4456 }
4457
DumpForSnapshot(std::vector<Reference> & vec) const4458 void JSAPIPlainArray::DumpForSnapshot(std::vector<Reference> &vec) const
4459 {
4460 DISALLOW_GARBAGE_COLLECTION;
4461 TaggedArray *keys = TaggedArray::Cast(GetKeys().GetTaggedObject());
4462 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
4463 uint32_t len = static_cast<uint32_t>(GetLength());
4464 vec.reserve(vec.size() + len);
4465 for (uint32_t i = 0; i < len; i++) {
4466 CString str;
4467 KeyToStd(str, keys->Get(i));
4468 vec.emplace_back(str, values->Get(i));
4469 }
4470 JSObject::DumpForSnapshot(vec);
4471 }
4472
DumpForSnapshot(std::vector<Reference> & vec,bool isVmMode) const4473 void JSTaggedValue::DumpForSnapshot(std::vector<Reference> &vec, bool isVmMode) const
4474 {
4475 if (IsHeapObject()) {
4476 return DumpObject(GetTaggedObject(), vec, isVmMode);
4477 }
4478 LOG_ECMA(FATAL) << "this branch is unreachable";
4479 UNREACHABLE();
4480 }
4481
DumpForSnapshot(std::vector<Reference> & vec) const4482 void NumberDictionary::DumpForSnapshot(std::vector<Reference> &vec) const
4483 {
4484 DISALLOW_GARBAGE_COLLECTION;
4485 int size = Size();
4486 vec.reserve(vec.size() + size);
4487 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
4488 JSTaggedValue key(GetKey(hashIndex));
4489 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4490 JSTaggedValue val(GetValue(hashIndex));
4491 vec.emplace_back(
4492 static_cast<uint32_t>(JSTaggedNumber(key).GetNumber()), val, Reference::ReferenceType::ELEMENT);
4493 }
4494 }
4495 }
4496
DumpForSnapshot(std::vector<Reference> & vec) const4497 void NameDictionary::DumpForSnapshot(std::vector<Reference> &vec) const
4498 {
4499 DISALLOW_GARBAGE_COLLECTION;
4500 int size = Size();
4501 vec.reserve(vec.size() + size);
4502 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
4503 JSTaggedValue key(GetKey(hashIndex));
4504 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4505 JSTaggedValue val(GetValue(hashIndex));
4506 CString str;
4507 KeyToStd(str, key);
4508 vec.emplace_back(str, val);
4509 }
4510 }
4511 }
4512
DumpForSnapshot(std::vector<Reference> & vec) const4513 void GlobalDictionary::DumpForSnapshot(std::vector<Reference> &vec) const
4514 {
4515 DISALLOW_GARBAGE_COLLECTION;
4516 int size = Size();
4517 vec.reserve(vec.size() + size);
4518 for (int hashIndex = 0; hashIndex < size; hashIndex++) {
4519 JSTaggedValue key(GetKey(hashIndex));
4520 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4521 CString str;
4522 KeyToStd(str, key);
4523 JSTaggedValue val = GetValue(hashIndex);
4524 vec.emplace_back(str, val);
4525 }
4526 }
4527 }
4528
DumpForSnapshot(std::vector<Reference> & vec) const4529 void LinkedHashSet::DumpForSnapshot(std::vector<Reference> &vec) const
4530 {
4531 DISALLOW_GARBAGE_COLLECTION;
4532 int capacity = NumberOfElements() + NumberOfDeletedElements();
4533 vec.reserve(vec.size() + capacity);
4534 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
4535 JSTaggedValue key(GetKey(hashIndex));
4536 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4537 CString str;
4538 KeyToStd(str, key);
4539 vec.emplace_back(str, JSTaggedValue::Hole());
4540 }
4541 }
4542 }
4543
DumpForSnapshot(std::vector<Reference> & vec) const4544 void LinkedHashMap::DumpForSnapshot(std::vector<Reference> &vec) const
4545 {
4546 DISALLOW_GARBAGE_COLLECTION;
4547 int capacity = NumberOfElements() + NumberOfDeletedElements();
4548 vec.reserve(vec.size() + capacity);
4549 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
4550 JSTaggedValue key(GetKey(hashIndex));
4551 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4552 JSTaggedValue val = GetValue(hashIndex);
4553 CString str;
4554 KeyToStd(str, key);
4555 vec.emplace_back(str, val);
4556 }
4557 }
4558 }
4559
Dump(std::ostream & os) const4560 void TaggedHashArray::Dump(std::ostream &os) const
4561 {
4562 DumpArrayClass(this, os);
4563 }
4564
DumpForSnapshot(std::vector<Reference> & vec) const4565 void TaggedHashArray::DumpForSnapshot(std::vector<Reference> &vec) const
4566 {
4567 DISALLOW_GARBAGE_COLLECTION;
4568 int capacity = GetLength();
4569 vec.reserve(vec.size() + capacity);
4570 for (int hashIndex = 0; hashIndex < capacity; hashIndex++) {
4571 JSTaggedValue value = Get(hashIndex);
4572 if (!value.IsUndefined() && !value.IsHole() && !value.IsNull()) {
4573 LinkedNode *node = LinkedNode::Cast(value.GetTaggedObject());
4574 node->DumpForSnapshot(vec);
4575 }
4576 }
4577 }
4578
4579 template <typename T>
DumpForSnapshotTaggedTreeEntry(T tree,int index,std::vector<Reference> & vec,bool isMap=false)4580 void DumpForSnapshotTaggedTreeEntry(T tree, int index, std::vector<Reference> &vec, bool isMap = false)
4581 {
4582 DISALLOW_GARBAGE_COLLECTION;
4583 if (isMap) {
4584 vec.emplace_back("key", JSTaggedValue(tree->GetKey(index)));
4585 }
4586 vec.emplace_back("value", JSTaggedValue(tree->GetValue(index)));
4587 vec.emplace_back("parent", JSTaggedValue(tree->GetParent(index)));
4588 vec.emplace_back("color", JSTaggedValue(static_cast<int>(tree->GetColor(index))));
4589 vec.emplace_back("left", tree->GetLeftChild(index));
4590 vec.emplace_back("right", tree->GetRightChild(index));
4591 }
4592
DumpForSnapshot(std::vector<Reference> & vec) const4593 void TaggedTreeMap::DumpForSnapshot(std::vector<Reference> &vec) const
4594 {
4595 DISALLOW_GARBAGE_COLLECTION;
4596 vec.emplace_back("Elements", TaggedArray::Get(NUMBER_OF_ELEMENTS_INDEX));
4597 vec.emplace_back("Delete", TaggedArray::Get(NUMBER_OF_HOLE_ENTRIES_INDEX));
4598 vec.emplace_back("Capacity", TaggedArray::Get(CAPACITY_INDEX));
4599 vec.emplace_back("RootNode", TaggedArray::Get(ROOT_INDEX));
4600 vec.emplace_back("CompareFunction", TaggedArray::Get(COMPARE_FUNCTION_INDEX));
4601 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
4602 vec.reserve(vec.size() + capacity);
4603 for (uint32_t index = 0; index < capacity; index++) {
4604 JSTaggedValue key(GetKey(index));
4605 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4606 JSTaggedValue val = GetValue(index);
4607 CString str;
4608 KeyToStd(str, key);
4609 vec.emplace_back(str, val);
4610 } else {
4611 DumpForSnapshotTaggedTreeEntry(const_cast<TaggedTreeMap *>(this), index, vec, true);
4612 }
4613 }
4614 }
4615
DumpForSnapshot(std::vector<Reference> & vec) const4616 void TaggedTreeSet::DumpForSnapshot(std::vector<Reference> &vec) const
4617 {
4618 DISALLOW_GARBAGE_COLLECTION;
4619 vec.emplace_back("Elements", TaggedArray::Get(NUMBER_OF_ELEMENTS_INDEX));
4620 vec.emplace_back("Delete", TaggedArray::Get(NUMBER_OF_HOLE_ENTRIES_INDEX));
4621 vec.emplace_back("Capacity", TaggedArray::Get(CAPACITY_INDEX));
4622 vec.emplace_back("RootNode", TaggedArray::Get(ROOT_INDEX));
4623 vec.emplace_back("CompareFunction", TaggedArray::Get(COMPARE_FUNCTION_INDEX));
4624 uint32_t capacity = NumberOfElements() + NumberOfDeletedElements();
4625 vec.reserve(vec.size() + capacity);
4626 for (uint32_t index = 0; index < capacity; index++) {
4627 JSTaggedValue key(GetKey(index));
4628 if (!key.IsUndefined() && !key.IsHole() && !key.IsNull()) {
4629 CString str;
4630 KeyToStd(str, key);
4631 vec.emplace_back(str, JSTaggedValue::Hole());
4632 } else {
4633 DumpForSnapshotTaggedTreeEntry(const_cast<TaggedTreeSet *>(this), index, vec, true);
4634 }
4635 }
4636 }
4637
DumpForSnapshot(std::vector<Reference> & vec) const4638 void TaggedDoubleList::DumpForSnapshot(std::vector<Reference> &vec) const
4639 {
4640 DISALLOW_GARBAGE_COLLECTION;
4641 int capacity = NumberOfNodes();
4642 vec.reserve(vec.size() + capacity);
4643 for (int index = 0; index < capacity; index++) {
4644 JSTaggedValue val = GetElement(index);
4645 CString str;
4646 KeyToStd(str, JSTaggedValue(index));
4647 vec.emplace_back(str, val);
4648 }
4649 }
4650
DumpForSnapshot(std::vector<Reference> & vec) const4651 void TaggedSingleList::DumpForSnapshot(std::vector<Reference> &vec) const
4652 {
4653 DISALLOW_GARBAGE_COLLECTION;
4654 int capacity = NumberOfNodes();
4655 vec.reserve(vec.size() + capacity);
4656 for (int index = 0; index < capacity; index++) {
4657 JSTaggedValue val = GetElement(index);
4658 CString str;
4659 KeyToStd(str, JSTaggedValue(index));
4660 vec.emplace_back(str, val);
4661 }
4662 }
4663
DumpForSnapshot(std::vector<Reference> & vec) const4664 void JSObject::DumpForSnapshot(std::vector<Reference> &vec) const
4665 {
4666 DISALLOW_GARBAGE_COLLECTION;
4667 JSHClass *jshclass = GetJSHClass();
4668 vec.emplace_back(CString("__proto__"), jshclass->GetPrototype());
4669
4670 TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject());
4671
4672 vec.emplace_back("(object elements)", JSTaggedValue(elements));
4673 if (elements->GetLength() == 0) {
4674 } else if (!elements->IsDictionaryMode()) {
4675 DumpElementClass(elements, vec);
4676 } else {
4677 NumberDictionary *dict = NumberDictionary::Cast(elements);
4678 dict->DumpForSnapshot(vec);
4679 }
4680
4681 TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject());
4682 if (IsJSGlobalObject()) {
4683 GlobalDictionary *dict = GlobalDictionary::Cast(properties);
4684 dict->DumpForSnapshot(vec);
4685 return;
4686 }
4687 vec.emplace_back("(object properties)", JSTaggedValue(properties));
4688 if (!properties->IsDictionaryMode()) {
4689 JSTaggedValue attrs = jshclass->GetLayout();
4690 if (attrs.IsNull()) {
4691 return;
4692 }
4693
4694 LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject());
4695 int propNumber = static_cast<int>(jshclass->NumberOfProps());
4696 vec.reserve(vec.size() + propNumber);
4697 for (int i = 0; i < propNumber; i++) {
4698 JSTaggedValue key = layoutInfo->GetKey(i);
4699 PropertyAttributes attr = layoutInfo->GetAttr(i);
4700 ASSERT(i == static_cast<int>(attr.GetOffset()));
4701 JSTaggedValue val;
4702 if (attr.IsInlinedProps()) {
4703 val = GetPropertyInlinedPropsWithRep(i, attr);
4704 } else {
4705 val = properties->Get(i - static_cast<int>(jshclass->GetInlinedProperties()));
4706 }
4707
4708 CString str;
4709 KeyToStd(str, key);
4710 vec.emplace_back(str, val);
4711 }
4712 } else {
4713 NameDictionary *dict = NameDictionary::Cast(properties);
4714 dict->DumpForSnapshot(vec);
4715 }
4716 }
4717
DumpForSnapshot(std::vector<Reference> & vec) const4718 void JSHClass::DumpForSnapshot([[maybe_unused]] std::vector<Reference> &vec) const
4719 {
4720 vec.emplace_back(CString("__proto__"), GetPrototype());
4721 vec.emplace_back(CString("Layout"), GetLayout());
4722 vec.emplace_back(CString("Transitions"), GetTransitions());
4723 vec.emplace_back(CString("Parent"), GetParent());
4724 vec.emplace_back(CString("ProtoChangeMarker"), GetProtoChangeMarker());
4725 vec.emplace_back(CString("ProtoChangeDetails"), GetProtoChangeDetails());
4726 vec.emplace_back(CString("EnumCache"), GetEnumCache());
4727 vec.emplace_back(CString("Supers"), GetSupers());
4728 vec.emplace_back(CString("VTable"), GetVTable());
4729 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
4730 vec.emplace_back(CString("BitField1"), JSTaggedValue(GetBitField1()));
4731 }
4732
DumpForSnapshot(std::vector<Reference> & vec) const4733 void JSFunction::DumpForSnapshot(std::vector<Reference> &vec) const
4734 {
4735 vec.emplace_back(CString("ProtoOrHClass"), GetProtoOrHClass());
4736 vec.emplace_back(CString("LexicalEnv"), GetLexicalEnv());
4737 vec.emplace_back(CString("HomeObject"), GetHomeObject());
4738 if ((!GetMethod().IsNull()) && (!GetMethod().IsUndefined())) {
4739 vec.emplace_back(CString("FunctionKind"), JSTaggedValue(static_cast<int>(GetFunctionKind())));
4740 }
4741 vec.emplace_back(CString("FunctionExtraInfo"), GetFunctionExtraInfo());
4742 vec.emplace_back(CString("Method"), GetMethod());
4743 JSObject::DumpForSnapshot(vec);
4744 }
4745
DumpForSnapshot(std::vector<Reference> & vec) const4746 void Method::DumpForSnapshot(std::vector<Reference> &vec) const
4747 {
4748 vec.emplace_back(CString("MethodName"), JSTaggedValue(GetMethodName()));
4749 vec.emplace_back(CString("ConstantPool"), GetConstantPool());
4750 vec.emplace_back(CString("ProfileTypeInfo"), GetProfileTypeInfo());
4751 vec.emplace_back(CString("Module"), GetModule());
4752 vec.emplace_back(CString("MachineCode"), GetMachineCode());
4753 }
4754
DumpForSnapshot(std::vector<Reference> & vec) const4755 void Program::DumpForSnapshot(std::vector<Reference> &vec) const
4756 {
4757 vec.emplace_back(CString("MainFunction"), GetMainFunction());
4758 }
4759
DumpForSnapshot(std::vector<Reference> & vec) const4760 void LinkedNode::DumpForSnapshot(std::vector<Reference> &vec) const
4761 {
4762 JSTaggedValue next = GetNext();
4763 if (next.IsUndefined() && !next.IsHole() && !next.IsNull()) {
4764 LinkedNode *nextNode = LinkedNode::Cast(next.GetTaggedObject());
4765 nextNode->DumpForSnapshot(vec);
4766 }
4767 JSTaggedValue key = GetKey();
4768 CString str;
4769 KeyToStd(str, key);
4770 vec.emplace_back(str, GetValue());
4771 }
4772
DumpForSnapshot(std::vector<Reference> & vec) const4773 void ConstantPool::DumpForSnapshot(std::vector<Reference> &vec) const
4774 {
4775 DumpArrayClass(this, vec);
4776 }
4777
DumpForSnapshot(std::vector<Reference> & vec) const4778 void VTable::DumpForSnapshot(std::vector<Reference> &vec) const
4779 {
4780 DumpArrayClass(this, vec);
4781 }
4782
DumpForSnapshot(std::vector<Reference> & vec) const4783 void ProfileTypeInfo::DumpForSnapshot(std::vector<Reference> &vec) const
4784 {
4785 DISALLOW_GARBAGE_COLLECTION;
4786 uint32_t len = GetCacheLength();
4787 vec.reserve(vec.size() + len);
4788 for (uint32_t i = 0; i < len; i++) {
4789 JSTaggedValue val(Get(i));
4790 CString str = ToCString(i);
4791 vec.emplace_back(str, val);
4792 }
4793 }
4794
DumpForSnapshot(std::vector<Reference> & vec) const4795 void COWTaggedArray::DumpForSnapshot(std::vector<Reference> &vec) const
4796 {
4797 DumpArrayClass(this, vec);
4798 }
4799
DumpForSnapshot(std::vector<Reference> & vec) const4800 void MutantTaggedArray::DumpForSnapshot(std::vector<Reference> &vec) const
4801 {
4802 DumpMutantTaggedArrayClass(this, vec);
4803 }
4804
DumpForSnapshot(std::vector<Reference> & vec) const4805 void COWMutantTaggedArray::DumpForSnapshot(std::vector<Reference> &vec) const
4806 {
4807 DumpCOWMutantTaggedArrayClass(this, vec);
4808 }
4809
DumpForSnapshot(std::vector<Reference> & vec) const4810 void JSBoundFunction::DumpForSnapshot(std::vector<Reference> &vec) const
4811 {
4812 JSObject::DumpForSnapshot(vec);
4813
4814 vec.emplace_back(CString("BoundTarget"), GetBoundTarget());
4815 vec.emplace_back(CString("BoundThis"), GetBoundThis());
4816 vec.emplace_back(CString("BoundArguments"), GetBoundArguments());
4817 }
4818
DumpForSnapshot(std::vector<Reference> & vec) const4819 void JSPrimitiveRef::DumpForSnapshot(std::vector<Reference> &vec) const
4820 {
4821 vec.emplace_back(CString("subValue"), GetValue());
4822 JSObject::DumpForSnapshot(vec);
4823 }
4824
DumpForSnapshot(std::vector<Reference> & vec) const4825 void BigInt::DumpForSnapshot(std::vector<Reference> &vec) const
4826 {
4827 vec.emplace_back(CString("Length"), JSTaggedValue(GetLength()));
4828 vec.emplace_back(CString("Sign"), JSTaggedValue(GetSign()));
4829 }
4830
DumpForSnapshot(std::vector<Reference> & vec) const4831 void JSDate::DumpForSnapshot(std::vector<Reference> &vec) const
4832 {
4833 vec.emplace_back(CString("time"), GetTime());
4834 vec.emplace_back(CString("localOffset"), GetLocalOffset());
4835
4836 JSObject::DumpForSnapshot(vec);
4837 }
4838
DumpForSnapshot(std::vector<Reference> & vec) const4839 void JSMap::DumpForSnapshot(std::vector<Reference> &vec) const
4840 {
4841 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
4842 vec.emplace_back("linkedmap", GetLinkedMap());
4843 map->DumpForSnapshot(vec);
4844
4845 JSObject::DumpForSnapshot(vec);
4846 }
4847
DumpForSnapshot(std::vector<Reference> & vec) const4848 void JSForInIterator::DumpForSnapshot(std::vector<Reference> &vec) const
4849 {
4850 vec.emplace_back(CString("Object"), GetObject());
4851 vec.emplace_back(CString("CachedHclass"), GetCachedHclass());
4852 vec.emplace_back(CString("Keys"), GetKeys());
4853 vec.emplace_back(CString("Index"), JSTaggedValue(GetIndex()));
4854 vec.emplace_back(CString("Length"), JSTaggedValue(GetLength()));
4855 JSObject::DumpForSnapshot(vec);
4856 }
4857
DumpForSnapshot(std::vector<Reference> & vec) const4858 void JSMapIterator::DumpForSnapshot(std::vector<Reference> &vec) const
4859 {
4860 LinkedHashMap *map = LinkedHashMap::Cast(GetIteratedMap().GetTaggedObject());
4861 vec.emplace_back("iteratedmap", GetIteratedMap());
4862 map->DumpForSnapshot(vec);
4863 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
4864 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
4865 JSObject::DumpForSnapshot(vec);
4866 }
4867
DumpForSnapshot(std::vector<Reference> & vec) const4868 void JSSet::DumpForSnapshot(std::vector<Reference> &vec) const
4869 {
4870 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
4871 vec.emplace_back("linkedset", GetLinkedSet());
4872 set->DumpForSnapshot(vec);
4873
4874 JSObject::DumpForSnapshot(vec);
4875 }
4876
DumpForSnapshot(std::vector<Reference> & vec) const4877 void JSWeakMap::DumpForSnapshot(std::vector<Reference> &vec) const
4878 {
4879 LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject());
4880 vec.emplace_back("linkedmap", GetLinkedMap());
4881 map->DumpForSnapshot(vec);
4882
4883 JSObject::DumpForSnapshot(vec);
4884 }
4885
DumpForSnapshot(std::vector<Reference> & vec) const4886 void JSWeakSet::DumpForSnapshot(std::vector<Reference> &vec) const
4887 {
4888 LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject());
4889 vec.emplace_back("linkeset", GetLinkedSet());
4890 set->DumpForSnapshot(vec);
4891
4892 JSObject::DumpForSnapshot(vec);
4893 }
4894
DumpForSnapshot(std::vector<Reference> & vec) const4895 void JSWeakRef::DumpForSnapshot(std::vector<Reference> &vec) const
4896 {
4897 vec.emplace_back(CString("WeakObject"), GetWeakObject());
4898 JSObject::DumpForSnapshot(vec);
4899 }
4900
DumpForSnapshot(std::vector<Reference> & vec) const4901 void JSFinalizationRegistry::DumpForSnapshot(std::vector<Reference> &vec) const
4902 {
4903 vec.emplace_back(CString("CleanupCallback"), GetCleanupCallback());
4904 LinkedHashMap *map = LinkedHashMap::Cast(GetMaybeUnregister().GetTaggedObject());
4905 map->DumpForSnapshot(vec);
4906 vec.emplace_back(CString("MaybeUnregister"), GetMaybeUnregister());
4907 vec.emplace_back(CString("Next"), GetNext());
4908 vec.emplace_back(CString("Prev"), GetPrev());
4909 JSObject::DumpForSnapshot(vec);
4910 }
4911
DumpForSnapshot(std::vector<Reference> & vec) const4912 void CellRecord::DumpForSnapshot(std::vector<Reference> &vec) const
4913 {
4914 vec.emplace_back(CString("WeakRefTarget"), GetWeakRefTarget());
4915 vec.emplace_back(CString("HeldValue"), GetHeldValue());
4916 }
4917
DumpForSnapshot(std::vector<Reference> & vec) const4918 void JSSetIterator::DumpForSnapshot(std::vector<Reference> &vec) const
4919 {
4920 LinkedHashSet *set = LinkedHashSet::Cast(GetIteratedSet().GetTaggedObject());
4921 vec.emplace_back("iteratedset", GetIteratedSet());
4922 set->DumpForSnapshot(vec);
4923 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
4924 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
4925 JSObject::DumpForSnapshot(vec);
4926 }
4927
DumpForSnapshot(std::vector<Reference> & vec) const4928 void JSArray::DumpForSnapshot(std::vector<Reference> &vec) const
4929 {
4930 vec.emplace_back(CString("Length"), JSTaggedValue(GetLength()));
4931 JSObject::DumpForSnapshot(vec);
4932 }
4933
DumpForSnapshot(std::vector<Reference> & vec) const4934 void JSAPIArrayList::DumpForSnapshot(std::vector<Reference> &vec) const
4935 {
4936 vec.emplace_back(CString("Length"), JSTaggedValue(GetLength()));
4937 JSObject::DumpForSnapshot(vec);
4938 }
4939
DumpForSnapshot(std::vector<Reference> & vec) const4940 void JSAPIArrayListIterator::DumpForSnapshot(std::vector<Reference> &vec) const
4941 {
4942 if (!(GetIteratedArrayList().IsInvalidValue())) {
4943 JSAPIArrayList *arraylist = JSAPIArrayList::Cast(GetIteratedArrayList().GetTaggedObject());
4944 vec.emplace_back("iteratedlist", GetIteratedArrayList());
4945 arraylist->DumpForSnapshot(vec);
4946 }
4947 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
4948 JSObject::DumpForSnapshot(vec);
4949 }
4950
DumpForSnapshot(std::vector<Reference> & vec) const4951 void JSAPILightWeightMap::DumpForSnapshot(std::vector<Reference> &vec) const
4952 {
4953 DISALLOW_GARBAGE_COLLECTION;
4954 vec.emplace_back("Hashes", GetHashes());
4955 TaggedArray *keys = TaggedArray::Cast(GetKeys().GetTaggedObject());
4956 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
4957 uint32_t len = static_cast<uint32_t>(GetLength());
4958 vec.reserve(vec.size() + len);
4959 for (uint32_t i = 0; i < len; i++) {
4960 CString str;
4961 KeyToStd(str, keys->Get(i));
4962 vec.emplace_back(str, values->Get(i));
4963 }
4964 JSObject::DumpForSnapshot(vec);
4965 }
4966
DumpForSnapshot(std::vector<Reference> & vec) const4967 void JSAPILightWeightMapIterator::DumpForSnapshot(std::vector<Reference> &vec) const
4968 {
4969 JSAPILightWeightMap *map =
4970 JSAPILightWeightMap::Cast(GetIteratedLightWeightMap().GetTaggedObject());
4971 vec.emplace_back("iteratedmap", GetIteratedLightWeightMap());
4972 map->DumpForSnapshot(vec);
4973 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
4974 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
4975 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
4976 JSObject::DumpForSnapshot(vec);
4977 }
4978
DumpForSnapshot(std::vector<Reference> & vec) const4979 void JSAPIQueue::DumpForSnapshot(std::vector<Reference> &vec) const
4980 {
4981 vec.emplace_back(CString("Length"), JSTaggedValue(GetLength()));
4982 JSObject::DumpForSnapshot(vec);
4983 }
4984
DumpForSnapshot(std::vector<Reference> & vec) const4985 void JSAPIQueueIterator::DumpForSnapshot(std::vector<Reference> &vec) const
4986 {
4987 JSAPIQueue *queue = JSAPIQueue::Cast(GetIteratedQueue().GetTaggedObject());
4988 vec.emplace_back("iteratedqueue", GetIteratedQueue());
4989 queue->DumpForSnapshot(vec);
4990 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
4991 JSObject::DumpForSnapshot(vec);
4992 }
4993
DumpForSnapshot(std::vector<Reference> & vec) const4994 void JSAPIDeque::DumpForSnapshot(std::vector<Reference> &vec) const
4995 {
4996 JSObject::DumpForSnapshot(vec);
4997 }
4998
DumpForSnapshot(std::vector<Reference> & vec) const4999 void JSAPIDequeIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5000 {
5001 JSAPIDeque *deque = JSAPIDeque::Cast(GetIteratedDeque().GetTaggedObject());
5002 vec.emplace_back("iterateddeque", GetIteratedDeque());
5003 deque->DumpForSnapshot(vec);
5004 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
5005 JSObject::DumpForSnapshot(vec);
5006 }
5007
DumpForSnapshot(std::vector<Reference> & vec) const5008 void JSAPILightWeightSet::DumpForSnapshot(std::vector<Reference> &vec) const
5009 {
5010 DISALLOW_GARBAGE_COLLECTION;
5011 TaggedArray *hashes = TaggedArray::Cast(GetHashes().GetTaggedObject());
5012 TaggedArray *values = TaggedArray::Cast(GetValues().GetTaggedObject());
5013 uint32_t len = GetLength();
5014 vec.reserve(vec.size() + len);
5015 for (uint32_t i = 0; i < len; i++) {
5016 CString str;
5017 KeyToStd(str, hashes->Get(i));
5018 vec.emplace_back(str, values->Get(i));
5019 }
5020 JSObject::DumpForSnapshot(vec);
5021 }
5022
DumpForSnapshot(std::vector<Reference> & vec) const5023 void JSAPILightWeightSetIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5024 {
5025 JSAPILightWeightSet *set =
5026 JSAPILightWeightSet::Cast(GetIteratedLightWeightSet().GetTaggedObject());
5027 vec.emplace_back("iteratedset", GetIteratedLightWeightSet());
5028 set->DumpForSnapshot(vec);
5029 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
5030 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
5031 JSObject::DumpForSnapshot(vec);
5032 }
5033
DumpForSnapshot(std::vector<Reference> & vec) const5034 void JSAPIStack::DumpForSnapshot(std::vector<Reference> &vec) const
5035 {
5036 JSObject::DumpForSnapshot(vec);
5037 }
5038
DumpForSnapshot(std::vector<Reference> & vec) const5039 void JSAPIStackIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5040 {
5041 JSAPIStack *stack = JSAPIStack::Cast(GetIteratedStack().GetTaggedObject());
5042 vec.emplace_back("iteratedstack", GetIteratedStack());
5043 stack->DumpForSnapshot(vec);
5044 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
5045 JSObject::DumpForSnapshot(vec);
5046 }
5047
DumpForSnapshot(std::vector<Reference> & vec) const5048 void JSArrayIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5049 {
5050 JSArray *array = JSArray::Cast(GetIteratedArray().GetTaggedObject());
5051 vec.emplace_back("iteratedarray", GetIteratedArray());
5052 array->DumpForSnapshot(vec);
5053 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
5054 vec.emplace_back(CString("IterationKind"), JSTaggedValue(static_cast<int>(GetIterationKind())));
5055 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
5056 JSObject::DumpForSnapshot(vec);
5057 }
5058
DumpForSnapshot(std::vector<Reference> & vec) const5059 void JSAPIVector::DumpForSnapshot(std::vector<Reference> &vec) const
5060 {
5061 JSObject::DumpForSnapshot(vec);
5062 }
5063
DumpForSnapshot(std::vector<Reference> & vec) const5064 void JSAPIVectorIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5065 {
5066 JSAPIVector *vector = JSAPIVector::Cast(GetIteratedVector().GetTaggedObject());
5067 vec.emplace_back("iteratedvector", GetIteratedVector());
5068 vector->DumpForSnapshot(vec);
5069 vec.emplace_back(CString("NextIndex"), JSTaggedValue(GetNextIndex()));
5070 JSObject::DumpForSnapshot(vec);
5071 }
5072
DumpForSnapshot(std::vector<Reference> & vec) const5073 void JSStringIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5074 {
5075 vec.emplace_back(CString("IteratedString"), GetIteratedString());
5076 vec.emplace_back(CString("StringIteratorNextIndex"), JSTaggedValue(GetStringIteratorNextIndex()));
5077 JSObject::DumpForSnapshot(vec);
5078 }
5079
DumpForSnapshot(std::vector<Reference> & vec) const5080 void JSTypedArray::DumpForSnapshot(std::vector<Reference> &vec) const
5081 {
5082 // please update the NUM_OF_ITEMS if you change the items below
5083 constexpr int16_t NUM_OF_ITEMS = 5;
5084 vec.reserve(vec.size() + NUM_OF_ITEMS);
5085 vec.emplace_back(CString("viewed-array-buffer"), GetViewedArrayBufferOrByteArray());
5086 vec.emplace_back(CString("typed-array-name"), GetTypedArrayName());
5087 vec.emplace_back(CString("byte-length"), JSTaggedValue(GetByteLength()));
5088 vec.emplace_back(CString("byte-offset"), JSTaggedValue(GetByteOffset()));
5089 vec.emplace_back(CString("array-length"), JSTaggedValue(GetArrayLength()));
5090 JSObject::DumpForSnapshot(vec);
5091 }
5092
DumpForSnapshot(std::vector<Reference> & vec) const5093 void ByteArray::DumpForSnapshot(std::vector<Reference> &vec) const
5094 {
5095 vec.emplace_back(CString("array-length"), JSTaggedValue(GetArrayLength()));
5096 vec.emplace_back(CString("byte-length"), JSTaggedValue(GetByteLength()));
5097 }
5098
DumpForSnapshot(std::vector<Reference> & vec) const5099 void JSRegExp::DumpForSnapshot(std::vector<Reference> &vec) const
5100 {
5101 vec.emplace_back(CString("ByteCodeBuffer"), GetByteCodeBuffer());
5102 vec.emplace_back(CString("originalSource"), GetOriginalSource());
5103 vec.emplace_back(CString("originalFlags"), GetOriginalFlags());
5104 vec.emplace_back(CString("groupName"), GetGroupName());
5105 JSObject::DumpForSnapshot(vec);
5106 }
5107
DumpForSnapshot(std::vector<Reference> & vec) const5108 void JSRegExpIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5109 {
5110 vec.emplace_back(CString("IteratingRegExp"), GetIteratingRegExp());
5111 vec.emplace_back(CString("IteratedString"), GetIteratedString());
5112 vec.emplace_back(CString("Global"), JSTaggedValue(GetGlobal()));
5113 vec.emplace_back(CString("Unicode"), JSTaggedValue(GetUnicode()));
5114 vec.emplace_back(CString("Done"), JSTaggedValue(GetDone()));
5115 JSObject::DumpForSnapshot(vec);
5116 }
5117
DumpForSnapshot(std::vector<Reference> & vec) const5118 void JSProxy::DumpForSnapshot(std::vector<Reference> &vec) const
5119 {
5120 vec.emplace_back(CString("target"), GetTarget());
5121 vec.emplace_back(CString("handler"), GetHandler());
5122 vec.emplace_back(CString("Method"), GetMethod());
5123 vec.emplace_back(CString("PrivateField"), GetPrivateField());
5124 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
5125 }
5126
DumpForSnapshot(std::vector<Reference> & vec) const5127 void JSSymbol::DumpForSnapshot(std::vector<Reference> &vec) const
5128 {
5129 vec.emplace_back(CString("hash-field"), JSTaggedValue(GetHashField()));
5130 vec.emplace_back(CString("flags"), JSTaggedValue(GetFlags()));
5131 vec.emplace_back(CString("description"), GetDescription());
5132 }
5133
DumpForSnapshot(std::vector<Reference> & vec) const5134 void AccessorData::DumpForSnapshot(std::vector<Reference> &vec) const
5135 {
5136 vec.emplace_back(CString("getter"), GetGetter());
5137 vec.emplace_back(CString("setter"), GetSetter());
5138 }
5139
DumpForSnapshot(std::vector<Reference> & vec) const5140 void LexicalEnv::DumpForSnapshot(std::vector<Reference> &vec) const
5141 {
5142 DumpArrayClass(this, vec);
5143 }
5144
DumpForSnapshot(std::vector<Reference> & vec) const5145 void GlobalEnv::DumpForSnapshot(std::vector<Reference> &vec) const
5146 {
5147 auto globalConst = GetJSThread()->GlobalConstants();
5148 // please update the NUM_OF_ITEMS if you change the items below
5149 constexpr int16_t NUM_OF_ITEMS = 137;
5150 vec.reserve(vec.size() + NUM_OF_ITEMS);
5151 vec.emplace_back(CString("ObjectFunction"), GetObjectFunction().GetTaggedValue());
5152 vec.emplace_back(CString("FunctionFunction"), GetFunctionFunction().GetTaggedValue());
5153 vec.emplace_back(CString("NumberFunction"), GetNumberFunction().GetTaggedValue());
5154 vec.emplace_back(CString("BigIntFunction"), GetBigIntFunction().GetTaggedValue());
5155 vec.emplace_back(CString("DateFunction"), GetDateFunction().GetTaggedValue());
5156 vec.emplace_back(CString("BooleanFunction"), GetBooleanFunction().GetTaggedValue());
5157 vec.emplace_back(CString("ErrorFunction"), GetErrorFunction().GetTaggedValue());
5158 vec.emplace_back(CString("ArrayFunction"), GetArrayFunction().GetTaggedValue());
5159 vec.emplace_back(CString("TypedArrayFunction"), GetTypedArrayFunction().GetTaggedValue());
5160 vec.emplace_back(CString("Int8ArrayFunction"), GetInt8ArrayFunction().GetTaggedValue());
5161 vec.emplace_back(CString("Uint8ArrayFunction"), GetUint8ArrayFunction().GetTaggedValue());
5162 vec.emplace_back(CString("Uint8ClampedArrayFunction"), GetUint8ClampedArrayFunction().GetTaggedValue());
5163 vec.emplace_back(CString("Int16ArrayFunction"), GetInt16ArrayFunction().GetTaggedValue());
5164 vec.emplace_back(CString("Uint16ArrayFunction"), GetUint16ArrayFunction().GetTaggedValue());
5165 vec.emplace_back(CString("Int32ArrayFunction"), GetInt32ArrayFunction().GetTaggedValue());
5166 vec.emplace_back(CString("Uint32ArrayFunction"), GetUint32ArrayFunction().GetTaggedValue());
5167 vec.emplace_back(CString("Float32ArrayFunction"), GetFloat32ArrayFunction().GetTaggedValue());
5168 vec.emplace_back(CString("Float64ArrayFunction"), GetFloat64ArrayFunction().GetTaggedValue());
5169 vec.emplace_back(CString("ArrayBufferFunction"), GetArrayBufferFunction().GetTaggedValue());
5170 vec.emplace_back(CString("SharedArrayBufferFunction"), GetSharedArrayBufferFunction().GetTaggedValue());
5171 vec.emplace_back(CString("SymbolFunction"), GetSymbolFunction().GetTaggedValue());
5172 vec.emplace_back(CString("RangeErrorFunction"), GetRangeErrorFunction().GetTaggedValue());
5173 vec.emplace_back(CString("ReferenceErrorFunction"), GetReferenceErrorFunction().GetTaggedValue());
5174 vec.emplace_back(CString("TypeErrorFunction"), GetTypeErrorFunction().GetTaggedValue());
5175 vec.emplace_back(CString("AggregateErrorFunction"), GetAggregateErrorFunction().GetTaggedValue());
5176 vec.emplace_back(CString("URIErrorFunction"), GetURIErrorFunction().GetTaggedValue());
5177 vec.emplace_back(CString("SyntaxErrorFunction"), GetSyntaxErrorFunction().GetTaggedValue());
5178 vec.emplace_back(CString("EvalErrorFunction"), GetEvalErrorFunction().GetTaggedValue());
5179 vec.emplace_back(CString("OOMErrorFunction"), GetOOMErrorFunction().GetTaggedValue());
5180 vec.emplace_back(CString("TerminationErrorFunction"), GetTerminationErrorFunction().GetTaggedValue());
5181 vec.emplace_back(CString("RegExpFunction"), GetRegExpFunction().GetTaggedValue());
5182 vec.emplace_back(CString("BuiltinsSetFunction"), GetBuiltinsSetFunction().GetTaggedValue());
5183 vec.emplace_back(CString("BuiltinsMapFunction"), GetBuiltinsMapFunction().GetTaggedValue());
5184 vec.emplace_back(CString("BuiltinsWeakSetFunction"), GetBuiltinsWeakSetFunction().GetTaggedValue());
5185 vec.emplace_back(CString("BuiltinsWeakMapFunction"), GetBuiltinsWeakMapFunction().GetTaggedValue());
5186 vec.emplace_back(CString("BuiltinsWeakRefFunction"), GetBuiltinsWeakRefFunction().GetTaggedValue());
5187 vec.emplace_back(CString("BuiltinsFinalizationRegistryFunction"),
5188 GetBuiltinsFinalizationRegistryFunction().GetTaggedValue());
5189 vec.emplace_back(CString("MathFunction"), GetMathFunction().GetTaggedValue());
5190 vec.emplace_back(CString("AtomicsFunction"), GetAtomicsFunction().GetTaggedValue());
5191 vec.emplace_back(CString("JsonFunction"), GetJsonFunction().GetTaggedValue());
5192 vec.emplace_back(CString("StringFunction"), GetStringFunction().GetTaggedValue());
5193 vec.emplace_back(CString("ProxyFunction"), GetProxyFunction().GetTaggedValue());
5194 vec.emplace_back(CString("ReflectFunction"), GetReflectFunction().GetTaggedValue());
5195 vec.emplace_back(CString("AsyncFunction"), GetAsyncFunction().GetTaggedValue());
5196 vec.emplace_back(CString("AsyncFunctionPrototype"), GetAsyncFunctionPrototype().GetTaggedValue());
5197 vec.emplace_back(CString("JSGlobalObject"), GetJSGlobalObject().GetTaggedValue());
5198 vec.emplace_back(CString("EmptyArray"), globalConst->GetEmptyArray());
5199 vec.emplace_back(CString("EmptyString"), globalConst->GetEmptyString());
5200 vec.emplace_back(CString("EmptyTaggedQueue"), globalConst->GetEmptyTaggedQueue());
5201 vec.emplace_back(CString("PrototypeString"), globalConst->GetPrototypeString());
5202 vec.emplace_back(CString("HasInstanceSymbol"), GetHasInstanceSymbol().GetTaggedValue());
5203 vec.emplace_back(CString("IsConcatSpreadableSymbol"), GetIsConcatSpreadableSymbol().GetTaggedValue());
5204 vec.emplace_back(CString("ToStringTagSymbol"), GetToStringTagSymbol().GetTaggedValue());
5205 vec.emplace_back(CString("IteratorSymbol"), GetIteratorSymbol().GetTaggedValue());
5206 vec.emplace_back(CString("AsyncIteratorSymbol"), GetAsyncIteratorSymbol().GetTaggedValue());
5207 vec.emplace_back(CString("MatchSymbol"), GetMatchSymbol().GetTaggedValue());
5208 vec.emplace_back(CString("MatchAllSymbol"), GetMatchAllSymbol().GetTaggedValue());
5209 vec.emplace_back(CString("ReplaceSymbol"), GetReplaceSymbol().GetTaggedValue());
5210 vec.emplace_back(CString("SearchSymbol"), GetSearchSymbol().GetTaggedValue());
5211 vec.emplace_back(CString("SpeciesSymbol"), GetSpeciesSymbol().GetTaggedValue());
5212 vec.emplace_back(CString("SplitSymbol"), GetSplitSymbol().GetTaggedValue());
5213 vec.emplace_back(CString("ToPrimitiveSymbol"), GetToPrimitiveSymbol().GetTaggedValue());
5214 vec.emplace_back(CString("UnscopablesSymbol"), GetUnscopablesSymbol().GetTaggedValue());
5215 vec.emplace_back(CString("HoleySymbol"), GetHoleySymbol().GetTaggedValue());
5216 vec.emplace_back(CString("NativeBindingSymbol"), GetNativeBindingSymbol().GetTaggedValue());
5217 vec.emplace_back(CString("ConstructorString"), globalConst->GetConstructorString());
5218 vec.emplace_back(CString("IteratorPrototype"), GetIteratorPrototype().GetTaggedValue());
5219 vec.emplace_back(CString("ForinIteratorPrototype"), GetForinIteratorPrototype().GetTaggedValue());
5220 vec.emplace_back(CString("StringIterator"), GetStringIterator().GetTaggedValue());
5221 vec.emplace_back(CString("MapIteratorPrototype"), GetMapIteratorPrototype().GetTaggedValue());
5222 vec.emplace_back(CString("SetIteratorPrototype"), GetSetIteratorPrototype().GetTaggedValue());
5223 vec.emplace_back(CString("RegExpIteratorPrototype"), GetRegExpIteratorPrototype().GetTaggedValue());
5224 vec.emplace_back(CString("ArrayIteratorPrototype"), GetArrayIteratorPrototype().GetTaggedValue());
5225 vec.emplace_back(CString("StringIteratorPrototype"), GetStringIteratorPrototype().GetTaggedValue());
5226 vec.emplace_back(CString("LengthString"), globalConst->GetLengthString());
5227 vec.emplace_back(CString("ValueString"), globalConst->GetValueString());
5228 vec.emplace_back(CString("WritableString"), globalConst->GetWritableString());
5229 vec.emplace_back(CString("GetString"), globalConst->GetGetString());
5230 vec.emplace_back(CString("SetString"), globalConst->GetSetString());
5231 vec.emplace_back(CString("EnumerableString"), globalConst->GetEnumerableString());
5232 vec.emplace_back(CString("ConfigurableString"), globalConst->GetConfigurableString());
5233 vec.emplace_back(CString("NameString"), globalConst->GetNameString());
5234 vec.emplace_back(CString("ValueOfString"), globalConst->GetValueOfString());
5235 vec.emplace_back(CString("ToStringString"), globalConst->GetToStringString());
5236 vec.emplace_back(CString("ToLocaleStringString"), globalConst->GetToLocaleStringString());
5237 vec.emplace_back(CString("UndefinedString"), globalConst->GetUndefinedString());
5238 vec.emplace_back(CString("NullString"), globalConst->GetNullString());
5239 vec.emplace_back(CString("TrueString"), globalConst->GetTrueString());
5240 vec.emplace_back(CString("FalseString"), globalConst->GetFalseString());
5241 vec.emplace_back(CString("RegisterSymbols"), GetRegisterSymbols().GetTaggedValue());
5242 vec.emplace_back(CString("ThrowTypeError"), GetThrowTypeError().GetTaggedValue());
5243 vec.emplace_back(CString("GetPrototypeOfString"), globalConst->GetGetPrototypeOfString());
5244 vec.emplace_back(CString("SetPrototypeOfString"), globalConst->GetSetPrototypeOfString());
5245 vec.emplace_back(CString("IsExtensibleString"), globalConst->GetIsExtensibleString());
5246 vec.emplace_back(CString("PreventExtensionsString"), globalConst->GetPreventExtensionsString());
5247 vec.emplace_back(CString("GetOwnPropertyDescriptorString"), globalConst->GetGetOwnPropertyDescriptorString());
5248 vec.emplace_back(CString("DefinePropertyString"), globalConst->GetDefinePropertyString());
5249 vec.emplace_back(CString("HasString"), globalConst->GetHasString());
5250 vec.emplace_back(CString("DeletePropertyString"), globalConst->GetDeletePropertyString());
5251 vec.emplace_back(CString("EnumerateString"), globalConst->GetEnumerateString());
5252 vec.emplace_back(CString("OwnKeysString"), globalConst->GetOwnKeysString());
5253 vec.emplace_back(CString("ApplyString"), globalConst->GetApplyString());
5254 vec.emplace_back(CString("ProxyString"), globalConst->GetProxyString());
5255 vec.emplace_back(CString("RevokeString"), globalConst->GetRevokeString());
5256 vec.emplace_back(CString("ProxyConstructString"), globalConst->GetProxyConstructString());
5257 vec.emplace_back(CString("ProxyCallString"), globalConst->GetProxyCallString());
5258 vec.emplace_back(CString("DoneString"), globalConst->GetDoneString());
5259 vec.emplace_back(CString("NegativeZeroString"), globalConst->GetNegativeZeroString());
5260 vec.emplace_back(CString("NextString"), globalConst->GetNextString());
5261 vec.emplace_back(CString("PromiseThenString"), globalConst->GetPromiseThenString());
5262 vec.emplace_back(CString("PromiseFunction"), GetPromiseFunction().GetTaggedValue());
5263 vec.emplace_back(CString("PromiseReactionJob"), GetPromiseReactionJob().GetTaggedValue());
5264 vec.emplace_back(CString("PromiseResolveThenableJob"), GetPromiseResolveThenableJob().GetTaggedValue());
5265 vec.emplace_back(CString("DynamicImportJob"), GetDynamicImportJob().GetTaggedValue());
5266 vec.emplace_back(CString("ScriptJobString"), globalConst->GetScriptJobString());
5267 vec.emplace_back(CString("PromiseString"), globalConst->GetPromiseString());
5268 vec.emplace_back(CString("IdentityString"), globalConst->GetIdentityString());
5269 vec.emplace_back(CString("AsyncFunctionString"), globalConst->GetAsyncFunctionString());
5270 vec.emplace_back(CString("ThrowerString"), globalConst->GetThrowerString());
5271 vec.emplace_back(CString("Undefined"), globalConst->GetUndefined());
5272 vec.emplace_back(CString("ArrayListFunction"), globalConst->GetArrayListFunction());
5273 vec.emplace_back(CString("ArrayListIteratorPrototype"), globalConst->GetArrayListIteratorPrototype());
5274 vec.emplace_back(CString("HashMapIteratorPrototype"), globalConst->GetHashMapIteratorPrototype());
5275 vec.emplace_back(CString("HashSetIteratorPrototype"), globalConst->GetHashSetIteratorPrototype());
5276 vec.emplace_back(CString("LightWeightMapIteratorPrototype"), globalConst->GetLightWeightMapIteratorPrototype());
5277 vec.emplace_back(CString("LightWeightSetIteratorPrototype"), globalConst->GetLightWeightSetIteratorPrototype());
5278 vec.emplace_back(CString("TreeMapIteratorPrototype"), globalConst->GetTreeMapIteratorPrototype());
5279 vec.emplace_back(CString("TreeSetIteratorPrototype"), globalConst->GetTreeSetIteratorPrototype());
5280 vec.emplace_back(CString("VectorFunction"), globalConst->GetVectorFunction());
5281 vec.emplace_back(CString("VectorIteratorPrototype"), globalConst->GetVectorIteratorPrototype());
5282 vec.emplace_back(CString("QueueIteratorPrototype"), globalConst->GetQueueIteratorPrototype());
5283 vec.emplace_back(CString("PlainArrayIteratorPrototype"), globalConst->GetPlainArrayIteratorPrototype());
5284 vec.emplace_back(CString("DequeIteratorPrototype"), globalConst->GetDequeIteratorPrototype());
5285 vec.emplace_back(CString("StackIteratorPrototype"), globalConst->GetStackIteratorPrototype());
5286 vec.emplace_back(CString("LinkedListIteratorPrototype"), globalConst->GetLinkedListIteratorPrototype());
5287 vec.emplace_back(CString("ListIteratorPrototype"), globalConst->GetListIteratorPrototype());
5288 vec.emplace_back(CString("GlobalPatch"), GetGlobalPatch().GetTaggedValue());
5289 }
5290
DumpForSnapshot(std::vector<Reference> & vec) const5291 void JSDataView::DumpForSnapshot(std::vector<Reference> &vec) const
5292 {
5293 vec.emplace_back(CString("data-view"), GetDataView());
5294 vec.emplace_back(CString("buffer"), GetViewedArrayBuffer());
5295 vec.emplace_back(CString("byte-length"), JSTaggedValue(GetByteLength()));
5296 vec.emplace_back(CString("byte-offset"), JSTaggedValue(GetByteOffset()));
5297 JSObject::DumpForSnapshot(vec);
5298 }
5299
DumpForSnapshot(std::vector<Reference> & vec) const5300 void JSArrayBuffer::DumpForSnapshot(std::vector<Reference> &vec) const
5301 {
5302 vec.emplace_back(CString("buffer-data"), GetArrayBufferData());
5303 vec.emplace_back(CString("byte-length"), JSTaggedValue(GetArrayBufferByteLength()));
5304 vec.emplace_back(CString("shared"), JSTaggedValue(GetShared()));
5305 JSObject::DumpForSnapshot(vec);
5306 }
5307
DumpForSnapshot(std::vector<Reference> & vec) const5308 void PromiseReaction::DumpForSnapshot(std::vector<Reference> &vec) const
5309 {
5310 vec.emplace_back(CString("promise-capability"), GetPromiseCapability());
5311 vec.emplace_back(CString("handler"), GetHandler());
5312 vec.emplace_back(CString("type"), JSTaggedValue(static_cast<int>(GetType())));
5313 }
5314
DumpForSnapshot(std::vector<Reference> & vec) const5315 void PromiseCapability::DumpForSnapshot(std::vector<Reference> &vec) const
5316 {
5317 vec.emplace_back(CString("promise"), GetPromise());
5318 vec.emplace_back(CString("resolve"), GetResolve());
5319 vec.emplace_back(CString("reject"), GetReject());
5320 }
5321
DumpForSnapshot(std::vector<Reference> & vec) const5322 void PromiseIteratorRecord::DumpForSnapshot(std::vector<Reference> &vec) const
5323 {
5324 vec.emplace_back(CString("iterator"), GetIterator());
5325 vec.emplace_back(CString("done"), JSTaggedValue(GetDone()));
5326 }
5327
DumpForSnapshot(std::vector<Reference> & vec) const5328 void PromiseRecord::DumpForSnapshot(std::vector<Reference> &vec) const
5329 {
5330 vec.emplace_back(CString("value"), GetValue());
5331 }
5332
DumpForSnapshot(std::vector<Reference> & vec) const5333 void ResolvingFunctionsRecord::DumpForSnapshot(std::vector<Reference> &vec) const
5334 {
5335 vec.emplace_back(CString("resolve-function"), GetResolveFunction());
5336 vec.emplace_back(CString("reject-function"), GetRejectFunction());
5337 }
5338
DumpForSnapshot(std::vector<Reference> & vec) const5339 void AsyncGeneratorRequest::DumpForSnapshot(std::vector<Reference> &vec) const
5340 {
5341 vec.emplace_back(CString("completion"), GetCompletion());
5342 vec.emplace_back(CString("capability"), GetCapability());
5343 }
5344
DumpForSnapshot(std::vector<Reference> & vec) const5345 void AsyncIteratorRecord::DumpForSnapshot(std::vector<Reference> &vec) const
5346 {
5347 vec.emplace_back(CString("iterator"), GetIterator());
5348 vec.emplace_back(CString("nextmethod"), GetNextMethod());
5349 vec.emplace_back(CString("done"), JSTaggedValue(GetDone()));
5350 }
5351
DumpForSnapshot(std::vector<Reference> & vec) const5352 void JSAsyncFromSyncIterator::DumpForSnapshot(std::vector<Reference> &vec) const
5353 {
5354 vec.emplace_back(CString("synciteratorrecord"), GetSyncIteratorRecord());
5355 JSObject::DumpForSnapshot(vec);
5356 }
5357
DumpForSnapshot(std::vector<Reference> & vec) const5358 void JSAsyncFromSyncIterUnwarpFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5359 {
5360 vec.emplace_back(CString("done"), JSTaggedValue(GetDone()));
5361 JSFunction::DumpForSnapshot(vec);
5362 }
5363
DumpForSnapshot(std::vector<Reference> & vec) const5364 void JSPromise::DumpForSnapshot(std::vector<Reference> &vec) const
5365 {
5366 vec.emplace_back(CString("promise-state"), JSTaggedValue(static_cast<int>(GetPromiseState())));
5367 vec.emplace_back(CString("promise-result"), GetPromiseResult());
5368 vec.emplace_back(CString("promise-fulfill-reactions"), GetPromiseFulfillReactions());
5369 vec.emplace_back(CString("promise-reject-reactions"), GetPromiseRejectReactions());
5370 vec.emplace_back(CString("promise-is-handled"), JSTaggedValue(GetPromiseIsHandled()));
5371 JSObject::DumpForSnapshot(vec);
5372 }
5373
DumpForSnapshot(std::vector<Reference> & vec) const5374 void JSPromiseReactionsFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5375 {
5376 vec.emplace_back(CString("promise"), GetPromise());
5377 vec.emplace_back(CString("already-resolved"), GetAlreadyResolved());
5378 JSFunction::DumpForSnapshot(vec);
5379 }
5380
DumpForSnapshot(std::vector<Reference> & vec) const5381 void JSAsyncGeneratorResNextRetProRstFtn::DumpForSnapshot(std::vector<Reference> &vec) const
5382 {
5383 vec.emplace_back(CString("async-generator-object"), GetAsyncGeneratorObject());
5384 JSFunction::DumpForSnapshot(vec);
5385 }
5386
DumpForSnapshot(std::vector<Reference> & vec) const5387 void JSPromiseExecutorFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5388 {
5389 vec.emplace_back(CString("capability"), GetCapability());
5390 JSFunction::DumpForSnapshot(vec);
5391 }
5392
DumpForSnapshot(std::vector<Reference> & vec) const5393 void JSAsyncModuleFulfilledFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5394 {
5395 vec.emplace_back(CString("module"), GetModule());
5396 JSFunction::DumpForSnapshot(vec);
5397 }
5398
DumpForSnapshot(std::vector<Reference> & vec) const5399 void JSAsyncModuleRejectedFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5400 {
5401 vec.emplace_back(CString("module"), GetModule());
5402 JSFunction::DumpForSnapshot(vec);
5403 }
5404
DumpForSnapshot(std::vector<Reference> & vec) const5405 void JSPromiseAllResolveElementFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5406 {
5407 vec.emplace_back(CString("index"), GetIndex());
5408 vec.emplace_back(CString("values"), GetValues());
5409 vec.emplace_back(CString("capabilities"), GetCapabilities());
5410 vec.emplace_back(CString("remaining-elements"), GetRemainingElements());
5411 vec.emplace_back(CString("already-called"), GetAlreadyCalled());
5412 JSFunction::DumpForSnapshot(vec);
5413 }
5414
DumpForSnapshot(std::vector<Reference> & vec) const5415 void JSPromiseAnyRejectElementFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5416 {
5417 vec.emplace_back(CString("index"), JSTaggedValue(GetIndex()));
5418 vec.emplace_back(CString("errors"), GetErrors());
5419 vec.emplace_back(CString("capability"), GetCapability());
5420 vec.emplace_back(CString("remaining-elements"), GetRemainingElements());
5421 vec.emplace_back(CString("already-called"), GetAlreadyCalled());
5422 JSFunction::DumpForSnapshot(vec);
5423 }
5424
DumpForSnapshot(std::vector<Reference> & vec) const5425 void JSPromiseAllSettledElementFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5426 {
5427 vec.emplace_back(CString("already-called"), GetAlreadyCalled());
5428 vec.emplace_back(CString("index"), JSTaggedValue(GetIndex()));
5429 vec.emplace_back(CString("values"), GetValues());
5430 vec.emplace_back(CString("capability"), GetCapability());
5431 vec.emplace_back(CString("remaining-elements"), GetRemainingElements());
5432 JSFunction::DumpForSnapshot(vec);
5433 }
5434
DumpForSnapshot(std::vector<Reference> & vec) const5435 void JSPromiseFinallyFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5436 {
5437 vec.emplace_back(CString("constructor"), GetConstructor());
5438 vec.emplace_back(CString("onFinally"), GetOnFinally());
5439 JSFunction::DumpForSnapshot(vec);
5440 }
5441
DumpForSnapshot(std::vector<Reference> & vec) const5442 void JSPromiseValueThunkOrThrowerFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5443 {
5444 vec.emplace_back(CString("result"), GetResult());
5445 JSFunction::DumpForSnapshot(vec);
5446 }
5447
DumpForSnapshot(std::vector<Reference> & vec) const5448 void MicroJobQueue::DumpForSnapshot(std::vector<Reference> &vec) const
5449 {
5450 vec.emplace_back(CString("promise-job-queue"), GetPromiseJobQueue());
5451 vec.emplace_back(CString("script-job-queue"), GetScriptJobQueue());
5452 }
5453
DumpForSnapshot(std::vector<Reference> & vec) const5454 void PendingJob::DumpForSnapshot(std::vector<Reference> &vec) const
5455 {
5456 vec.emplace_back(CString("job"), GetJob());
5457 vec.emplace_back(CString("arguments"), GetArguments());
5458 }
5459
DumpForSnapshot(std::vector<Reference> & vec) const5460 void CompletionRecord::DumpForSnapshot(std::vector<Reference> &vec) const
5461 {
5462 vec.emplace_back(CString("value"), GetValue());
5463 vec.emplace_back(CString("type"), JSTaggedValue(static_cast<int>(GetType())));
5464 }
5465
DumpForSnapshot(std::vector<Reference> & vec) const5466 void JSProxyRevocFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5467 {
5468 vec.emplace_back(CString("RevocableProxy"), GetRevocableProxy());
5469 JSFunction::DumpForSnapshot(vec);
5470 }
5471
DumpForSnapshot(std::vector<Reference> & vec) const5472 void JSAsyncFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5473 {
5474 JSFunction::DumpForSnapshot(vec);
5475 }
5476
DumpForSnapshot(std::vector<Reference> & vec) const5477 void JSAsyncAwaitStatusFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5478 {
5479 vec.emplace_back(CString("AsyncContext"), GetAsyncContext());
5480 JSFunction::DumpForSnapshot(vec);
5481 }
5482
DumpForSnapshot(std::vector<Reference> & vec) const5483 void JSGeneratorFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5484 {
5485 JSFunction::DumpForSnapshot(vec);
5486 }
5487
DumpForSnapshot(std::vector<Reference> & vec) const5488 void JSAsyncGeneratorFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5489 {
5490 JSFunction::DumpForSnapshot(vec);
5491 }
5492
DumpForSnapshot(std::vector<Reference> & vec) const5493 void JSIntlBoundFunction::DumpForSnapshot(std::vector<Reference> &vec) const
5494 {
5495 vec.emplace_back(CString("NumberFormat"), GetNumberFormat());
5496 vec.emplace_back(CString("DateTimeFormat"), GetDateTimeFormat());
5497 vec.emplace_back(CString("Collator"), GetCollator());
5498 JSFunction::DumpForSnapshot(vec);
5499 }
5500
DumpForSnapshot(std::vector<Reference> & vec) const5501 void PropertyBox::DumpForSnapshot(std::vector<Reference> &vec) const
5502 {
5503 vec.emplace_back(CString("Value"), GetValue());
5504 }
5505
DumpForSnapshot(std::vector<Reference> & vec) const5506 void PrototypeHandler::DumpForSnapshot(std::vector<Reference> &vec) const
5507 {
5508 vec.emplace_back(CString("HandlerInfo"), GetHandlerInfo());
5509 vec.emplace_back(CString("ProtoCell"), GetProtoCell());
5510 vec.emplace_back(CString("Holder"), GetHolder());
5511 }
5512
DumpForSnapshot(std::vector<Reference> & vec) const5513 void TransitionHandler::DumpForSnapshot(std::vector<Reference> &vec) const
5514 {
5515 vec.emplace_back(CString("HandlerInfo"), GetHandlerInfo());
5516 vec.emplace_back(CString("TransitionHClass"), GetTransitionHClass());
5517 }
5518
DumpForSnapshot(std::vector<Reference> & vec) const5519 void TransWithProtoHandler::DumpForSnapshot(std::vector<Reference> &vec) const
5520 {
5521 vec.emplace_back(CString("HandlerInfo"), GetHandlerInfo());
5522 vec.emplace_back(CString("TransitionHClass"), GetTransitionHClass());
5523 vec.emplace_back(CString("ProtoCell"), GetProtoCell());
5524 }
5525
DumpForSnapshot(std::vector<Reference> & vec) const5526 void StoreTSHandler::DumpForSnapshot(std::vector<Reference> &vec) const
5527 {
5528 vec.emplace_back(CString("HandlerInfo"), GetHandlerInfo());
5529 vec.emplace_back(CString("ProtoCell"), GetProtoCell());
5530 vec.emplace_back(CString("Holder"), GetHolder());
5531 }
5532
DumpForSnapshot(std::vector<Reference> & vec) const5533 void JSRealm::DumpForSnapshot(std::vector<Reference> &vec) const
5534 {
5535 vec.emplace_back(CString("Value"), GetValue());
5536 vec.emplace_back(CString("GLobalEnv"), GetGlobalEnv());
5537 JSObject::DumpForSnapshot(vec);
5538 }
5539 #ifdef ARK_SUPPORT_INTL
DumpForSnapshot(std::vector<Reference> & vec) const5540 void JSIntl::DumpForSnapshot(std::vector<Reference> &vec) const
5541 {
5542 vec.emplace_back(CString("FallbackSymbol"), GetFallbackSymbol());
5543 JSObject::DumpForSnapshot(vec);
5544 }
5545
DumpForSnapshot(std::vector<Reference> & vec) const5546 void JSLocale::DumpForSnapshot(std::vector<Reference> &vec) const
5547 {
5548 vec.emplace_back(CString("IcuField"), GetIcuField());
5549 JSObject::DumpForSnapshot(vec);
5550 }
5551
DumpForSnapshot(std::vector<Reference> & vec) const5552 void JSDateTimeFormat::DumpForSnapshot(std::vector<Reference> &vec) const
5553 {
5554 // please update the NUM_OF_ITEMS if you change the items below
5555 constexpr int16_t NUM_OF_ITEMS = 11;
5556 vec.reserve(vec.size() + NUM_OF_ITEMS);
5557 vec.emplace_back(CString("Locale"), GetLocale());
5558 vec.emplace_back(CString("Calendar"), GetCalendar());
5559 vec.emplace_back(CString("NumberingSystem"), GetNumberingSystem());
5560 vec.emplace_back(CString("TimeZone"), GetTimeZone());
5561 vec.emplace_back(CString("HourCycle"), JSTaggedValue(static_cast<int>(GetHourCycle())));
5562 vec.emplace_back(CString("LocaleIcu"), GetLocaleIcu());
5563 vec.emplace_back(CString("SimpleDateTimeFormatIcu"), GetSimpleDateTimeFormatIcu());
5564 vec.emplace_back(CString("Iso8601"), GetIso8601());
5565 vec.emplace_back(CString("DateStyle"), JSTaggedValue(static_cast<int>(GetDateStyle())));
5566 vec.emplace_back(CString("TimeStyle"), JSTaggedValue(static_cast<int>(GetTimeStyle())));
5567 vec.emplace_back(CString("BoundFormat"), GetBoundFormat());
5568 JSObject::DumpForSnapshot(vec);
5569 }
5570
DumpForSnapshot(std::vector<Reference> & vec) const5571 void JSRelativeTimeFormat::DumpForSnapshot(std::vector<Reference> &vec) const
5572 {
5573 vec.emplace_back(CString("Locale"), GetLocale());
5574 vec.emplace_back(CString("NumberingSystem"), GetNumberingSystem());
5575 vec.emplace_back(CString("Style"), JSTaggedValue(static_cast<int>(GetStyle())));
5576 vec.emplace_back(CString("Numeric"), JSTaggedValue(static_cast<int>(GetNumeric())));
5577 vec.emplace_back(CString("IcuField"), GetIcuField());
5578 JSObject::DumpForSnapshot(vec);
5579 }
5580
DumpForSnapshot(std::vector<Reference> & vec) const5581 void JSNumberFormat::DumpForSnapshot(std::vector<Reference> &vec) const
5582 {
5583 // please update the NUM_OF_ITEMS if you change the items below
5584 constexpr int16_t NUM_OF_ITEMS = 20;
5585 vec.reserve(vec.size() + NUM_OF_ITEMS);
5586 vec.emplace_back(CString("Locale"), GetLocale());
5587 vec.emplace_back(CString("NumberingSystem"), GetNumberingSystem());
5588 vec.emplace_back(CString("Style"), JSTaggedValue(static_cast<int>(GetStyle())));
5589 vec.emplace_back(CString("Currency"), GetCurrency());
5590 vec.emplace_back(CString("CurrencyDisplay"), JSTaggedValue(static_cast<int>(GetCurrencyDisplay())));
5591 vec.emplace_back(CString("CurrencySign"), JSTaggedValue(static_cast<int>(GetCurrencySign())));
5592 vec.emplace_back(CString("Unit"), GetUnit());
5593 vec.emplace_back(CString("UnitDisplay"), JSTaggedValue(static_cast<int>(GetUnitDisplay())));
5594 vec.emplace_back(CString("MinimumIntegerDigits"), GetMinimumIntegerDigits());
5595 vec.emplace_back(CString("MinimumFractionDigits"), GetMinimumFractionDigits());
5596 vec.emplace_back(CString("MaximumFractionDigits"), GetMaximumFractionDigits());
5597 vec.emplace_back(CString("MinimumSignificantDigits"), GetMinimumSignificantDigits());
5598 vec.emplace_back(CString("MaximumSignificantDigits"), GetMaximumSignificantDigits());
5599 vec.emplace_back(CString("UseGrouping"), GetUseGrouping());
5600 vec.emplace_back(CString("RoundingType"), JSTaggedValue(static_cast<int>(GetRoundingType())));
5601 vec.emplace_back(CString("Notation"), JSTaggedValue(static_cast<int>(GetNotation())));
5602 vec.emplace_back(CString("CompactDisplay"), JSTaggedValue(static_cast<int>(GetCompactDisplay())));
5603 vec.emplace_back(CString("SignDisplay"), JSTaggedValue(static_cast<int>(GetSignDisplay())));
5604 vec.emplace_back(CString("BoundFormat"), GetBoundFormat());
5605 vec.emplace_back(CString("IcuField"), GetIcuField());
5606 JSObject::DumpForSnapshot(vec);
5607 }
5608
DumpForSnapshot(std::vector<Reference> & vec) const5609 void JSCollator::DumpForSnapshot(std::vector<Reference> &vec) const
5610 {
5611 // please update the NUM_OF_ITEMS if you change the items below
5612 constexpr int16_t NUM_OF_ITEMS = 9;
5613 vec.reserve(vec.size() + NUM_OF_ITEMS);
5614 vec.emplace_back(CString("IcuField"), GetIcuField());
5615 vec.emplace_back(CString("Locale"), GetLocale());
5616 vec.emplace_back(CString("Collation"), GetCollation());
5617 vec.emplace_back(CString("BoundCompare"), GetBoundCompare());
5618 vec.emplace_back(CString("CaseFirst"), JSTaggedValue(static_cast<int>(GetCaseFirst())));
5619 vec.emplace_back(CString("Usage"), JSTaggedValue(static_cast<int>(GetUsage())));
5620 vec.emplace_back(CString("Sensitivity"), JSTaggedValue(static_cast<int>(GetSensitivity())));
5621 vec.emplace_back(CString("IgnorePunctuation"), JSTaggedValue(GetIgnorePunctuation()));
5622 vec.emplace_back(CString("Numeric"), JSTaggedValue(GetNumeric()));
5623 JSObject::DumpForSnapshot(vec);
5624 }
5625
DumpForSnapshot(std::vector<Reference> & vec) const5626 void JSPluralRules::DumpForSnapshot(std::vector<Reference> &vec) const
5627 {
5628 // please update the NUM_OF_ITEMS if you change the items below
5629 constexpr int16_t NUM_OF_ITEMS = 10;
5630 vec.reserve(vec.size() + NUM_OF_ITEMS);
5631 vec.emplace_back(CString("Locale"), GetLocale());
5632 vec.emplace_back(CString("MinimumIntegerDigits"), GetMinimumIntegerDigits());
5633 vec.emplace_back(CString("MinimumFractionDigits"), GetMinimumFractionDigits());
5634 vec.emplace_back(CString("MaximumFractionDigits"), GetMaximumFractionDigits());
5635 vec.emplace_back(CString("MinimumSignificantDigits"), GetMinimumSignificantDigits());
5636 vec.emplace_back(CString("MaximumSignificantDigits"), GetMaximumSignificantDigits());
5637 vec.emplace_back(CString("RoundingType"), JSTaggedValue(static_cast<int>(GetRoundingType())));
5638 vec.emplace_back(CString("IcuPR"), GetIcuPR());
5639 vec.emplace_back(CString("IcuNF"), GetIcuNF());
5640 vec.emplace_back(CString("Type"), JSTaggedValue(static_cast<int>(GetType())));
5641 JSObject::DumpForSnapshot(vec);
5642 }
5643
DumpForSnapshot(std::vector<Reference> & vec) const5644 void JSDisplayNames::DumpForSnapshot(std::vector<Reference> &vec) const
5645 {
5646 vec.emplace_back(CString("Locale"), GetLocale());
5647 vec.emplace_back(CString("Type"), JSTaggedValue(static_cast<int>(GetType())));
5648 vec.emplace_back(CString("Style"), JSTaggedValue(static_cast<int>(GetStyle())));
5649 vec.emplace_back(CString("Fallback"), JSTaggedValue(static_cast<int>(GetFallback())));
5650 vec.emplace_back(CString("IcuLDN"), GetIcuLDN());
5651 JSObject::DumpForSnapshot(vec);
5652 }
5653
DumpForSnapshot(std::vector<Reference> & vec) const5654 void JSListFormat::DumpForSnapshot(std::vector<Reference> &vec) const
5655 {
5656 vec.emplace_back(CString("Locale"), GetLocale());
5657 vec.emplace_back(CString("Type"), JSTaggedValue(static_cast<int>(GetType())));
5658 vec.emplace_back(CString("Style"), JSTaggedValue(static_cast<int>(GetStyle())));
5659 vec.emplace_back(CString("IcuLF"), GetIcuLF());
5660 JSObject::DumpForSnapshot(vec);
5661 }
5662 #endif
DumpForSnapshot(std::vector<Reference> & vec) const5663 void JSGeneratorObject::DumpForSnapshot(std::vector<Reference> &vec) const
5664 {
5665 vec.emplace_back(CString("GeneratorContext"), GetGeneratorContext());
5666 vec.emplace_back(CString("ResumeResult"), GetResumeResult());
5667 vec.emplace_back(CString("GeneratorState"), JSTaggedValue(static_cast<int>(GetGeneratorState())));
5668 vec.emplace_back(CString("ResumeMode"), JSTaggedValue(static_cast<int>(GetResumeMode())));
5669 JSObject::DumpForSnapshot(vec);
5670 }
5671
DumpForSnapshot(std::vector<Reference> & vec) const5672 void JSAsyncGeneratorObject::DumpForSnapshot(std::vector<Reference> &vec) const
5673 {
5674 vec.emplace_back(CString("GeneratorContext"), GetGeneratorContext());
5675 vec.emplace_back(CString("AsyncGeneratorQueue"), GetAsyncGeneratorQueue());
5676 vec.emplace_back(CString("GeneratorBrand"), GetGeneratorBrand());
5677 vec.emplace_back(CString("ResumeResult"), GetResumeResult());
5678 vec.emplace_back(CString("AsyncGeneratorState"), JSTaggedValue(static_cast<int>(GetAsyncGeneratorState())));
5679 vec.emplace_back(CString("ResumeMode"), JSTaggedValue(static_cast<int>(GetResumeMode())));
5680 JSObject::DumpForSnapshot(vec);
5681 }
5682
DumpForSnapshot(std::vector<Reference> & vec) const5683 void JSAsyncFuncObject::DumpForSnapshot(std::vector<Reference> &vec) const
5684 {
5685 vec.emplace_back(CString("Promise"), GetPromise());
5686 JSObject::DumpForSnapshot(vec);
5687 }
5688
DumpForSnapshot(std::vector<Reference> & vec) const5689 void GeneratorContext::DumpForSnapshot(std::vector<Reference> &vec) const
5690 {
5691 // please update the NUM_OF_ITEMS if you change the items below
5692 constexpr int16_t NUM_OF_ITEMS = 8;
5693 vec.reserve(vec.size() + NUM_OF_ITEMS);
5694 vec.emplace_back(CString("RegsArray"), GetRegsArray());
5695 vec.emplace_back(CString("Method"), GetMethod());
5696 vec.emplace_back(CString("This"), GetThis());
5697 vec.emplace_back(CString("Acc"), GetAcc());
5698 vec.emplace_back(CString("GeneratorObject"), GetGeneratorObject());
5699 vec.emplace_back(CString("LexicalEnv"), GetLexicalEnv());
5700 vec.emplace_back(CString("NRegs"), JSTaggedValue(GetNRegs()));
5701 vec.emplace_back(CString("BCOffset"), JSTaggedValue(GetBCOffset()));
5702 }
5703
DumpForSnapshot(std::vector<Reference> & vec) const5704 void ProtoChangeMarker::DumpForSnapshot(std::vector<Reference> &vec) const
5705 {
5706 vec.emplace_back(CString("Promise"), JSTaggedValue(GetHasChanged()));
5707 }
5708
DumpForSnapshot(std::vector<Reference> & vec) const5709 void MarkerCell::DumpForSnapshot(std::vector<Reference> &vec) const
5710 {
5711 vec.emplace_back(CString("IsDetectorInvalid"), JSTaggedValue(GetIsDetectorInvalid()));
5712 }
5713
DumpForSnapshot(std::vector<Reference> & vec) const5714 void ProtoChangeDetails::DumpForSnapshot(std::vector<Reference> &vec) const
5715 {
5716 vec.emplace_back(CString("ChangeListener"), GetChangeListener());
5717 vec.emplace_back(CString("RegisterIndex"), JSTaggedValue(GetRegisterIndex()));
5718 }
5719
DumpForSnapshot(std::vector<Reference> & vec) const5720 void MachineCode::DumpForSnapshot(std::vector<Reference> &vec) const
5721 {
5722 vec.emplace_back(CString("InstructionSizeInBytes"), JSTaggedValue(GetInstructionSizeInBytes()));
5723 }
5724
DumpForSnapshot(std::vector<Reference> & vec) const5725 void TrackInfo::DumpForSnapshot(std::vector<Reference> &vec) const
5726 {
5727 vec.emplace_back("ElementsKind", JSTaggedValue(static_cast<uint32_t>(GetElementsKind())));
5728
5729 vec.emplace_back(CString("CachedHClass"), GetCachedHClass());
5730 vec.emplace_back(CString("CachedFunc"), GetCachedFunc());
5731 vec.emplace_back(CString("ArrayLength"), JSTaggedValue(GetArrayLength()));
5732 }
5733
DumpForSnapshot(std::vector<Reference> & vec) const5734 void ClassInfoExtractor::DumpForSnapshot(std::vector<Reference> &vec) const
5735 {
5736 // please update the NUM_OF_ITEMS if you change the items below
5737 constexpr int16_t NUM_OF_ITEMS = 6;
5738 vec.reserve(vec.size() + NUM_OF_ITEMS);
5739 vec.emplace_back(CString("NonStaticKeys"), GetNonStaticKeys());
5740 vec.emplace_back(CString("NonStaticProperties"), GetNonStaticProperties());
5741 vec.emplace_back(CString("NonStaticElements"), GetNonStaticElements());
5742 vec.emplace_back(CString("StaticKeys"), GetStaticKeys());
5743 vec.emplace_back(CString("StaticProperties"), GetStaticProperties());
5744 vec.emplace_back(CString("StaticElements"), GetStaticElements());
5745 vec.emplace_back(CString("ConstructorMethod"), GetConstructorMethod());
5746 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
5747 }
5748
DumpForSnapshot(std::vector<Reference> & vec) const5749 void TSObjectType::DumpForSnapshot(std::vector<Reference> &vec) const
5750 {
5751 vec.emplace_back(CString("ObjLayoutInfo"), GetObjLayoutInfo());
5752 vec.emplace_back(CString("IndexSigns"), GetIndexSigns());
5753 }
5754
DumpForSnapshot(std::vector<Reference> & vec) const5755 void TSClassType::DumpForSnapshot(std::vector<Reference> &vec) const
5756 {
5757 // please update the NUM_OF_ITEMS if you change the items below
5758 constexpr int16_t NUM_OF_ITEMS = 5;
5759 vec.reserve(vec.size() + NUM_OF_ITEMS);
5760 vec.emplace_back(CString("InstanceType"), GetInstanceType());
5761 vec.emplace_back(CString("ConstructorType"), GetConstructorType());
5762 vec.emplace_back(CString("PrototypeType"), GetPrototypeType());
5763 vec.emplace_back(CString("ExtensionGT"), JSTaggedValue(GetExtensionGT().GetType()));
5764 vec.emplace_back(CString("HasLinked"), JSTaggedValue(GetHasLinked()));
5765 vec.emplace_back(CString("Name"), JSTaggedValue(GetName()));
5766 if (!GetIndexSigns().IsUndefined()) {
5767 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), vec);
5768 }
5769 }
5770
DumpForSnapshot(std::vector<Reference> & vec) const5771 void TSInterfaceType::DumpForSnapshot(std::vector<Reference> &vec) const
5772 {
5773 vec.emplace_back(CString("Fields"), GetFields());
5774 vec.emplace_back(CString("Extends"), GetExtends());
5775 DumpArrayClass(TaggedArray::Cast(GetExtends().GetTaggedObject()), vec);
5776 if (!GetIndexSigns().IsUndefined()) {
5777 DumpArrayClass(TaggedArray::Cast(GetIndexSigns().GetTaggedObject()), vec);
5778 }
5779 }
5780
DumpForSnapshot(std::vector<Reference> & vec) const5781 void TSClassInstanceType::DumpForSnapshot(std::vector<Reference> &vec) const
5782 {
5783 vec.emplace_back(CString("ClassGT"), JSTaggedValue(GetClassGT().GetType()));
5784 }
5785
DumpForSnapshot(std::vector<Reference> & vec) const5786 void TSUnionType::DumpForSnapshot(std::vector<Reference> &vec) const
5787 {
5788 vec.emplace_back(CString("ComponentTypes"), GetComponents());
5789 DumpArrayClass(TaggedArray::Cast(GetComponents().GetTaggedObject()), vec);
5790 }
5791
DumpForSnapshot(std::vector<Reference> & vec) const5792 void TSFunctionType::DumpForSnapshot(std::vector<Reference> &vec) const
5793 {
5794 // please update the NUM_OF_ITEMS if you change the items below
5795 constexpr int16_t NUM_OF_ITEMS = 5;
5796 vec.reserve(vec.size() + NUM_OF_ITEMS);
5797 vec.emplace_back(CString("Name"), GetName());
5798 vec.emplace_back(CString("ParameterTypes"), GetParameterTypes());
5799 DumpArrayClass(TaggedArray::Cast(GetParameterTypes().GetTaggedObject()), vec);
5800 vec.emplace_back(CString("ReturnGT"), JSTaggedValue(GetReturnGT().GetType()));
5801 vec.emplace_back(CString("ThisGT"), JSTaggedValue(GetThisGT().GetType()));
5802 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
5803 }
5804
DumpForSnapshot(std::vector<Reference> & vec) const5805 void TSArrayType::DumpForSnapshot(std::vector<Reference> &vec) const
5806 {
5807 vec.emplace_back(CString("ParameterTypeRef"), JSTaggedValue(GetElementGT().GetType()));
5808 }
5809
DumpForSnapshot(std::vector<Reference> & vec) const5810 void TSIteratorInstanceType::DumpForSnapshot(std::vector<Reference> &vec) const
5811 {
5812 vec.emplace_back(CString("kindGT"), JSTaggedValue(GetKindGT().GetType()));
5813 vec.emplace_back(CString("elementGT"), JSTaggedValue(GetElementGT().GetType()));
5814 }
5815
DumpForSnapshot(std::vector<Reference> & vec) const5816 void TSNamespaceType::DumpForSnapshot(std::vector<Reference> &vec) const
5817 {
5818 vec.emplace_back(CString("PropertyType"), GetPropertyType());
5819 DumpArrayClass(TaggedArray::Cast(GetPropertyType().GetTaggedObject()), vec);
5820 }
5821
DumpForSnapshot(std::vector<Reference> & vec) const5822 void SourceTextModule::DumpForSnapshot(std::vector<Reference> &vec) const
5823 {
5824 // please update the NUM_OF_ITEMS if you change the items below
5825 constexpr int16_t NUM_OF_ITEMS = 14;
5826 vec.reserve(vec.size() + NUM_OF_ITEMS);
5827 vec.emplace_back(CString("Environment"), GetEnvironment());
5828 vec.emplace_back(CString("Namespace"), GetNamespace());
5829 vec.emplace_back(CString("EcmaModuleFilename"), GetEcmaModuleFilename());
5830 vec.emplace_back(CString("EcmaModuleRecordName"), GetEcmaModuleRecordName());
5831 vec.emplace_back(CString("RequestedModules"), GetRequestedModules());
5832 vec.emplace_back(CString("ImportEntries"), GetImportEntries());
5833 vec.emplace_back(CString("LocalExportEntries"), GetLocalExportEntries());
5834 vec.emplace_back(CString("IndirectExportEntries"), GetIndirectExportEntries());
5835 vec.emplace_back(CString("StarExportEntries"), GetStarExportEntries());
5836 vec.emplace_back(CString("Status"), JSTaggedValue(static_cast<int32_t>(GetStatus())));
5837 vec.emplace_back(CString("EvaluationError"), JSTaggedValue(GetEvaluationError()));
5838 vec.emplace_back(CString("DFSIndex"), JSTaggedValue(GetDFSIndex()));
5839 vec.emplace_back(CString("DFSAncestorIndex"), JSTaggedValue(GetDFSAncestorIndex()));
5840 vec.emplace_back(CString("NameDictionary"), GetNameDictionary());
5841 vec.emplace_back(CString("CycleRoot"), GetCycleRoot());
5842 vec.emplace_back(CString("TopLevelCapability"), GetTopLevelCapability());
5843 vec.emplace_back(CString("AsyncParentModules"), GetAsyncParentModules());
5844 vec.emplace_back(CString("HasTLA"), JSTaggedValue(GetHasTLA()));
5845 vec.emplace_back(CString("AsyncEvaluatingOrdinal"), JSTaggedValue(GetAsyncEvaluatingOrdinal()));
5846 vec.emplace_back(CString("PendingAsyncDependencies"), JSTaggedValue(GetPendingAsyncDependencies()));
5847 }
5848
DumpForSnapshot(std::vector<Reference> & vec) const5849 void ImportEntry::DumpForSnapshot(std::vector<Reference> &vec) const
5850 {
5851 vec.emplace_back(CString("ModuleRequest"), GetModuleRequest());
5852 vec.emplace_back(CString("ImportName"), GetImportName());
5853 vec.emplace_back(CString("LocalName"), GetLocalName());
5854 }
5855
DumpForSnapshot(std::vector<Reference> & vec) const5856 void LocalExportEntry::DumpForSnapshot(std::vector<Reference> &vec) const
5857 {
5858 vec.emplace_back(CString("ExportName"), GetExportName());
5859 vec.emplace_back(CString("LocalName"), GetLocalName());
5860 }
5861
DumpForSnapshot(std::vector<Reference> & vec) const5862 void IndirectExportEntry::DumpForSnapshot(std::vector<Reference> &vec) const
5863 {
5864 vec.emplace_back(CString("ExportName"), GetExportName());
5865 vec.emplace_back(CString("ModuleRequest"), GetModuleRequest());
5866 vec.emplace_back(CString("ImportName"), GetImportName());
5867 }
5868
DumpForSnapshot(std::vector<Reference> & vec) const5869 void StarExportEntry::DumpForSnapshot(std::vector<Reference> &vec) const
5870 {
5871 vec.emplace_back(CString("ModuleRequest"), GetModuleRequest());
5872 }
5873
DumpForSnapshot(std::vector<Reference> & vec) const5874 void ResolvedBinding::DumpForSnapshot(std::vector<Reference> &vec) const
5875 {
5876 vec.emplace_back(CString("Module"), GetModule());
5877 vec.emplace_back(CString("BindingName"), GetBindingName());
5878 }
5879
DumpForSnapshot(std::vector<Reference> & vec) const5880 void ResolvedIndexBinding::DumpForSnapshot(std::vector<Reference> &vec) const
5881 {
5882 vec.emplace_back(CString("Module"), GetModule());
5883 vec.emplace_back(CString("Index"), JSTaggedValue(GetIndex()));
5884 }
5885
DumpForSnapshot(std::vector<Reference> & vec) const5886 void ModuleNamespace::DumpForSnapshot(std::vector<Reference> &vec) const
5887 {
5888 vec.emplace_back(CString("Module"), GetModule());
5889 vec.emplace_back(CString("Exports"), GetExports());
5890 vec.emplace_back(CString("DeregisterProcession"), GetDeregisterProcession());
5891 JSObject::DumpForSnapshot(vec);
5892 }
5893
DumpForSnapshot(std::vector<Reference> & vec) const5894 void CjsModule::DumpForSnapshot(std::vector<Reference> &vec) const
5895 {
5896 vec.emplace_back(CString("Id"), GetId());
5897 vec.emplace_back(CString("Path"), GetPath());
5898 vec.emplace_back(CString("Exports"), GetExports());
5899 vec.emplace_back(CString("Filename"), GetFilename());
5900 vec.emplace_back(CString("BitField"), JSTaggedValue(GetBitField()));
5901 JSObject::DumpForSnapshot(vec);
5902 }
5903
DumpForSnapshot(std::vector<Reference> & vec) const5904 void CjsExports::DumpForSnapshot(std::vector<Reference> &vec) const
5905 {
5906 vec.emplace_back(CString("Exports"), GetExports());
5907 JSObject::DumpForSnapshot(vec);
5908 }
5909
DumpForSnapshot(std::vector<Reference> & vec) const5910 void CjsRequire::DumpForSnapshot(std::vector<Reference> &vec) const
5911 {
5912 vec.emplace_back(CString("Cache"), GetCache());
5913 vec.emplace_back(CString("Parent"), GetParent());
5914 JSObject::DumpForSnapshot(vec);
5915 }
5916
DumpForSnapshot(std::vector<Reference> & vec) const5917 void ClassLiteral::DumpForSnapshot(std::vector<Reference> &vec) const
5918 {
5919 vec.emplace_back(CString("Array"), GetArray());
5920 vec.emplace_back(CString("IsAOTUsed"), JSTaggedValue(GetIsAOTUsed()));
5921 if (!GetArray().IsUndefined()) {
5922 DumpArrayClass(TaggedArray::Cast(GetArray().GetTaggedObject()), vec);
5923 }
5924 }
5925 } // namespace panda::ecmascript
5926