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