5 #include "src/objects.h" 10 #include "src/bootstrapper.h" 11 #include "src/disasm.h" 12 #include "src/disassembler.h" 13 #include "src/interpreter/bytecodes.h" 14 #include "src/objects-inl.h" 15 #include "src/objects/arguments-inl.h" 16 #include "src/objects/data-handler-inl.h" 17 #include "src/objects/debug-objects-inl.h" 18 #include "src/objects/embedder-data-array-inl.h" 19 #include "src/objects/embedder-data-slot-inl.h" 20 #include "src/objects/hash-table-inl.h" 21 #include "src/objects/js-array-buffer-inl.h" 22 #include "src/objects/js-array-inl.h" 23 #include "src/snapshot/embedded-data.h" 24 #ifdef V8_INTL_SUPPORT 25 #include "src/objects/js-break-iterator-inl.h" 26 #include "src/objects/js-collator-inl.h" 27 #endif // V8_INTL_SUPPORT 28 #include "src/objects/js-collection-inl.h" 29 #ifdef V8_INTL_SUPPORT 30 #include "src/objects/js-date-time-format-inl.h" 31 #endif // V8_INTL_SUPPORT 32 #include "src/objects/js-generator-inl.h" 33 #ifdef V8_INTL_SUPPORT 34 #include "src/objects/js-list-format-inl.h" 35 #include "src/objects/js-locale-inl.h" 36 #include "src/objects/js-number-format-inl.h" 37 #include "src/objects/js-plural-rules-inl.h" 38 #endif // V8_INTL_SUPPORT 39 #include "src/objects/js-regexp-inl.h" 40 #include "src/objects/js-regexp-string-iterator-inl.h" 41 #ifdef V8_INTL_SUPPORT 42 #include "src/objects/js-relative-time-format-inl.h" 43 #include "src/objects/js-segment-iterator-inl.h" 44 #include "src/objects/js-segmenter-inl.h" 45 #endif // V8_INTL_SUPPORT 46 #include "src/objects/js-weak-refs-inl.h" 47 #include "src/objects/literal-objects-inl.h" 48 #include "src/objects/microtask-inl.h" 49 #include "src/objects/module-inl.h" 50 #include "src/objects/promise-inl.h" 51 #include "src/objects/stack-frame-info-inl.h" 52 #include "src/ostreams.h" 53 #include "src/regexp/jsregexp.h" 54 #include "src/transitions-inl.h" 55 #include "src/wasm/wasm-code-manager.h" 56 #include "src/wasm/wasm-engine.h" 57 #include "src/wasm/wasm-objects-inl.h" 64 void Object::Print() {
70 void Object::Print(std::ostream& os) {
72 os <<
"Smi: " << std::hex <<
"0x" << Smi::ToInt(
this);
73 os << std::dec <<
" (" << Smi::ToInt(
this) <<
")\n";
75 HeapObject::cast(
this)->HeapObjectPrint(os);
79 void HeapObject::PrintHeader(std::ostream& os,
const char*
id) {
80 os << reinterpret_cast<void*>(
this) <<
": [";
84 os << map()->instance_type();
87 MemoryChunk* chunk = MemoryChunk::FromAddress(
88 reinterpret_cast<Address>(const_cast<HeapObject*>(
this)));
89 if (chunk->owner()->identity() == OLD_SPACE) os <<
" in OldSpace";
90 if (!IsMap()) os <<
"\n - map: " << Brief(map());
93 void HeapObjectPtr::PrintHeader(std::ostream& os,
const char*
id) {
94 os << reinterpret_cast<void*>(ptr()) <<
": [";
98 os << map()->instance_type();
101 MemoryChunk* chunk = MemoryChunk::FromAddress(ptr());
102 if (chunk->owner()->identity() == OLD_SPACE) os <<
" in OldSpace";
103 if (!IsMap()) os <<
"\n - map: " << Brief(map());
106 void HeapObject::HeapObjectPrint(std::ostream& os) {
107 InstanceType instance_type = map()->instance_type();
109 if (instance_type < FIRST_NONSTRING_TYPE) {
110 String::cast(
this)->StringPrint(os);
115 switch (instance_type) {
117 Symbol::cast(
this)->SymbolPrint(os);
120 Map::cast(
this)->MapPrint(os);
122 case HEAP_NUMBER_TYPE:
123 HeapNumber::cast(
this)->HeapNumberPrint(os);
126 case MUTABLE_HEAP_NUMBER_TYPE:
128 MutableHeapNumber::cast(
this)->MutableHeapNumberPrint(os);
132 BigInt::cast(
this)->BigIntPrint(os);
135 case EMBEDDER_DATA_ARRAY_TYPE:
136 EmbedderDataArray::cast(
this)->EmbedderDataArrayPrint(os);
138 case FIXED_DOUBLE_ARRAY_TYPE:
139 FixedDoubleArray::cast(
this)->FixedDoubleArrayPrint(os);
141 case FIXED_ARRAY_TYPE:
142 FixedArray::cast(
this)->FixedArrayPrint(os);
144 case AWAIT_CONTEXT_TYPE:
145 case BLOCK_CONTEXT_TYPE:
146 case CATCH_CONTEXT_TYPE:
147 case DEBUG_EVALUATE_CONTEXT_TYPE:
148 case EVAL_CONTEXT_TYPE:
149 case FUNCTION_CONTEXT_TYPE:
150 case MODULE_CONTEXT_TYPE:
151 case SCRIPT_CONTEXT_TYPE:
152 case WITH_CONTEXT_TYPE:
153 case SCRIPT_CONTEXT_TABLE_TYPE:
154 Context::cast(
this)->ContextPrint(os);
156 case NATIVE_CONTEXT_TYPE:
157 NativeContext::cast(
this)->NativeContextPrint(os);
159 case HASH_TABLE_TYPE:
160 case ORDERED_HASH_MAP_TYPE:
161 case ORDERED_HASH_SET_TYPE:
162 case ORDERED_NAME_DICTIONARY_TYPE:
163 case NAME_DICTIONARY_TYPE:
164 case GLOBAL_DICTIONARY_TYPE:
165 case SIMPLE_NUMBER_DICTIONARY_TYPE:
166 case STRING_TABLE_TYPE:
167 ObjectHashTable::cast(
this)->ObjectHashTablePrint(os);
169 case NUMBER_DICTIONARY_TYPE:
170 NumberDictionary::cast(
this)->NumberDictionaryPrint(os);
172 case EPHEMERON_HASH_TABLE_TYPE:
173 EphemeronHashTable::cast(
this)->EphemeronHashTablePrint(os);
175 case OBJECT_BOILERPLATE_DESCRIPTION_TYPE:
176 ObjectBoilerplateDescription::cast(
this)
177 ->ObjectBoilerplateDescriptionPrint(os);
179 case PROPERTY_ARRAY_TYPE:
180 PropertyArray::cast(
this)->PropertyArrayPrint(os);
182 case BYTE_ARRAY_TYPE:
183 ByteArray::cast(
this)->ByteArrayPrint(os);
185 case BYTECODE_ARRAY_TYPE:
186 BytecodeArray::cast(
this)->BytecodeArrayPrint(os);
188 case DESCRIPTOR_ARRAY_TYPE:
189 DescriptorArray::cast(
this)->DescriptorArrayPrint(os);
191 case TRANSITION_ARRAY_TYPE:
192 TransitionArray::cast(
this)->TransitionArrayPrint(os);
194 case FEEDBACK_CELL_TYPE:
195 FeedbackCell::cast(
this)->FeedbackCellPrint(os);
197 case FEEDBACK_VECTOR_TYPE:
198 FeedbackVector::cast(
this)->FeedbackVectorPrint(os);
200 case FREE_SPACE_TYPE:
201 FreeSpace::cast(
this)->FreeSpacePrint(os);
204 #define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype) \ 205 case Fixed##Type##Array::kInstanceType: \ 206 Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(os); \ 209 TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY)
210 #undef PRINT_FIXED_TYPED_ARRAY 216 case JS_API_OBJECT_TYPE:
217 case JS_SPECIAL_API_OBJECT_TYPE:
218 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
219 case JS_ASYNC_FUNCTION_OBJECT_TYPE:
220 case JS_ASYNC_GENERATOR_OBJECT_TYPE:
221 case JS_ARGUMENTS_TYPE:
224 case WASM_EXCEPTION_TYPE:
225 case WASM_GLOBAL_TYPE:
226 case WASM_MEMORY_TYPE:
227 case WASM_TABLE_TYPE:
228 JSObject::cast(
this)->JSObjectPrint(os);
230 case WASM_MODULE_TYPE:
231 WasmModuleObject::cast(
this)->WasmModuleObjectPrint(os);
233 case WASM_INSTANCE_TYPE:
234 WasmInstanceObject::cast(
this)->WasmInstanceObjectPrint(os);
236 case JS_GENERATOR_OBJECT_TYPE:
237 JSGeneratorObject::cast(
this)->JSGeneratorObjectPrint(os);
239 case JS_PROMISE_TYPE:
240 JSPromise::cast(
this)->JSPromisePrint(os);
243 JSArray::cast(
this)->JSArrayPrint(os);
246 JSRegExp::cast(
this)->JSRegExpPrint(os);
248 case JS_REGEXP_STRING_ITERATOR_TYPE:
249 JSRegExpStringIterator::cast(
this)->JSRegExpStringIteratorPrint(os);
252 Oddball::cast(
this)->to_string()->Print(os);
254 case JS_BOUND_FUNCTION_TYPE:
255 JSBoundFunction::cast(
this)->JSBoundFunctionPrint(os);
257 case JS_FUNCTION_TYPE:
258 JSFunction::cast(
this)->JSFunctionPrint(os);
260 case JS_GLOBAL_PROXY_TYPE:
261 JSGlobalProxy::cast(
this)->JSGlobalProxyPrint(os);
263 case JS_GLOBAL_OBJECT_TYPE:
264 JSGlobalObject::cast(
this)->JSGlobalObjectPrint(os);
267 JSValue::cast(
this)->JSValuePrint(os);
270 JSDate::cast(
this)->JSDatePrint(os);
273 Code::cast(
this)->CodePrint(os);
275 case CODE_DATA_CONTAINER_TYPE:
276 CodeDataContainer::cast(
this)->CodeDataContainerPrint(os);
279 JSProxy::cast(
this)->JSProxyPrint(os);
282 JSSet::cast(
this)->JSSetPrint(os);
285 JSMap::cast(
this)->JSMapPrint(os);
287 case JS_SET_KEY_VALUE_ITERATOR_TYPE:
288 case JS_SET_VALUE_ITERATOR_TYPE:
289 JSSetIterator::cast(
this)->JSSetIteratorPrint(os);
291 case JS_MAP_KEY_ITERATOR_TYPE:
292 case JS_MAP_KEY_VALUE_ITERATOR_TYPE:
293 case JS_MAP_VALUE_ITERATOR_TYPE:
294 JSMapIterator::cast(
this)->JSMapIteratorPrint(os);
296 case JS_WEAK_CELL_TYPE:
297 case JS_WEAK_REF_TYPE:
298 JSWeakCell::cast(
this)->JSWeakCellPrint(os);
300 case JS_WEAK_FACTORY_TYPE:
301 JSWeakFactory::cast(
this)->JSWeakFactoryPrint(os);
303 case JS_WEAK_FACTORY_CLEANUP_ITERATOR_TYPE:
304 JSWeakFactoryCleanupIterator::cast(
this)
305 ->JSWeakFactoryCleanupIteratorPrint(os);
307 case JS_WEAK_MAP_TYPE:
308 JSWeakMap::cast(
this)->JSWeakMapPrint(os);
310 case JS_WEAK_SET_TYPE:
311 JSWeakSet::cast(
this)->JSWeakSetPrint(os);
313 case JS_MODULE_NAMESPACE_TYPE:
314 JSModuleNamespace::cast(
this)->JSModuleNamespacePrint(os);
317 Foreign::cast(
this)->ForeignPrint(os);
319 case CALL_HANDLER_INFO_TYPE:
320 CallHandlerInfo::cast(
this)->CallHandlerInfoPrint(os);
322 case PRE_PARSED_SCOPE_DATA_TYPE:
323 PreParsedScopeData::cast(
this)->PreParsedScopeDataPrint(os);
325 case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE:
326 UncompiledDataWithoutPreParsedScope::cast(
this)
327 ->UncompiledDataWithoutPreParsedScopePrint(os);
329 case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE:
330 UncompiledDataWithPreParsedScope::cast(
this)
331 ->UncompiledDataWithPreParsedScopePrint(os);
333 case SHARED_FUNCTION_INFO_TYPE:
334 SharedFunctionInfo::cast(
this)->SharedFunctionInfoPrint(os);
336 case JS_MESSAGE_OBJECT_TYPE:
337 JSMessageObject::cast(
this)->JSMessageObjectPrint(os);
340 Cell::cast(
this)->CellPrint(os);
342 case PROPERTY_CELL_TYPE:
343 PropertyCell::cast(
this)->PropertyCellPrint(os);
345 case JS_ARRAY_BUFFER_TYPE:
346 JSArrayBuffer::cast(
this)->JSArrayBufferPrint(os);
348 case JS_ARRAY_ITERATOR_TYPE:
349 JSArrayIterator::cast(
this)->JSArrayIteratorPrint(os);
351 case JS_TYPED_ARRAY_TYPE:
352 JSTypedArray::cast(
this)->JSTypedArrayPrint(os);
354 case JS_DATA_VIEW_TYPE:
355 JSDataView::cast(
this)->JSDataViewPrint(os);
357 #ifdef V8_INTL_SUPPORT 358 case JS_INTL_V8_BREAK_ITERATOR_TYPE:
359 JSV8BreakIterator::cast(
this)->JSV8BreakIteratorPrint(os);
361 case JS_INTL_COLLATOR_TYPE:
362 JSCollator::cast(
this)->JSCollatorPrint(os);
364 case JS_INTL_DATE_TIME_FORMAT_TYPE:
365 JSDateTimeFormat::cast(
this)->JSDateTimeFormatPrint(os);
367 case JS_INTL_LIST_FORMAT_TYPE:
368 JSListFormat::cast(
this)->JSListFormatPrint(os);
370 case JS_INTL_LOCALE_TYPE:
371 JSLocale::cast(
this)->JSLocalePrint(os);
373 case JS_INTL_NUMBER_FORMAT_TYPE:
374 JSNumberFormat::cast(
this)->JSNumberFormatPrint(os);
376 case JS_INTL_PLURAL_RULES_TYPE:
377 JSPluralRules::cast(
this)->JSPluralRulesPrint(os);
379 case JS_INTL_RELATIVE_TIME_FORMAT_TYPE:
380 JSRelativeTimeFormat::cast(
this)->JSRelativeTimeFormatPrint(os);
382 case JS_INTL_SEGMENT_ITERATOR_TYPE:
383 JSSegmentIterator::cast(
this)->JSSegmentIteratorPrint(os);
385 case JS_INTL_SEGMENTER_TYPE:
386 JSSegmenter::cast(
this)->JSSegmenterPrint(os);
388 #endif // V8_INTL_SUPPORT 389 #define MAKE_STRUCT_CASE(TYPE, Name, name) \ 391 Name::cast(this)->Name##Print(os); \ 393 STRUCT_LIST(MAKE_STRUCT_CASE)
394 #undef MAKE_STRUCT_CASE 396 case ALLOCATION_SITE_TYPE:
397 AllocationSite::cast(
this)->AllocationSitePrint(os);
399 case LOAD_HANDLER_TYPE:
400 LoadHandler::cast(
this)->LoadHandlerPrint(os);
402 case STORE_HANDLER_TYPE:
403 StoreHandler::cast(
this)->StoreHandlerPrint(os);
405 case SCOPE_INFO_TYPE:
406 ScopeInfo::cast(
this)->ScopeInfoPrint(os);
408 case FEEDBACK_METADATA_TYPE:
409 FeedbackMetadata::cast(
this)->FeedbackMetadataPrint(os);
411 case WEAK_FIXED_ARRAY_TYPE:
412 WeakFixedArray::cast(
this)->WeakFixedArrayPrint(os);
414 case WEAK_ARRAY_LIST_TYPE:
415 WeakArrayList::cast(
this)->WeakArrayListPrint(os);
417 case INTERNALIZED_STRING_TYPE:
418 case EXTERNAL_INTERNALIZED_STRING_TYPE:
419 case ONE_BYTE_INTERNALIZED_STRING_TYPE:
420 case EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE:
421 case EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
422 case UNCACHED_EXTERNAL_INTERNALIZED_STRING_TYPE:
423 case UNCACHED_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE:
424 case UNCACHED_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
426 case CONS_STRING_TYPE:
427 case EXTERNAL_STRING_TYPE:
428 case SLICED_STRING_TYPE:
429 case THIN_STRING_TYPE:
430 case ONE_BYTE_STRING_TYPE:
431 case CONS_ONE_BYTE_STRING_TYPE:
432 case EXTERNAL_ONE_BYTE_STRING_TYPE:
433 case SLICED_ONE_BYTE_STRING_TYPE:
434 case THIN_ONE_BYTE_STRING_TYPE:
435 case EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
436 case UNCACHED_EXTERNAL_STRING_TYPE:
437 case UNCACHED_EXTERNAL_ONE_BYTE_STRING_TYPE:
438 case UNCACHED_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
439 case SMALL_ORDERED_HASH_MAP_TYPE:
440 case SMALL_ORDERED_HASH_SET_TYPE:
441 case SMALL_ORDERED_NAME_DICTIONARY_TYPE:
442 case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE:
443 case JS_STRING_ITERATOR_TYPE:
445 os <<
"UNKNOWN TYPE " << map()->instance_type();
451 void ByteArray::ByteArrayPrint(std::ostream& os) {
452 os <<
"byte array, data starts at " 453 <<
static_cast<void*
>(GetDataStartAddress());
456 void BytecodeArray::BytecodeArrayPrint(std::ostream& os) {
457 PrintHeader(os,
"BytecodeArray");
462 void FreeSpace::FreeSpacePrint(std::ostream& os) {
463 os <<
"free space, size " << Size();
467 template <
class Traits>
468 void FixedTypedArray<Traits>::FixedTypedArrayPrint(
470 os <<
"fixed " << Traits::Designator();
473 bool JSObject::PrintProperties(std::ostream& os) {
474 if (HasFastProperties()) {
475 DescriptorArray* descs = map()->instance_descriptors();
476 int nof_inobject_properties = map()->GetInObjectProperties();
478 for (;
i < map()->NumberOfOwnDescriptors();
i++) {
480 descs->GetKey(
i)->NamePrint(os);
482 PropertyDetails details = descs->GetDetails(
i);
483 switch (details.location()) {
485 FieldIndex field_index = FieldIndex::ForDescriptor(map(),
i);
486 if (IsUnboxedDoubleField(field_index)) {
487 os <<
"<unboxed double> " << RawFastDoublePropertyAt(field_index);
489 os << Brief(RawFastPropertyAt(field_index));
494 os << Brief(descs->GetStrongValue(
i));
498 details.PrintAsFastTo(os, PropertyDetails::kForProperties);
499 if (details.location() != kField)
continue;
500 int field_index = details.field_index();
501 if (nof_inobject_properties <= field_index) {
502 field_index -= nof_inobject_properties;
503 os <<
" properties[" << field_index <<
"]";
507 }
else if (IsJSGlobalObject()) {
508 JSGlobalObject::cast(
this)->global_dictionary()->Print(os);
510 property_dictionary()->Print(os);
518 bool IsTheHoleAt(T array,
int index) {
523 bool IsTheHoleAt(FixedDoubleArray array,
int index) {
524 return array->is_the_hole(index);
528 double GetScalarElement(T array,
int index) {
529 if (IsTheHoleAt(array, index)) {
530 return std::numeric_limits<double>::quiet_NaN();
532 return array->get_scalar(index);
536 void DoPrintElements(std::ostream& os, Object*
object) {
537 const bool print_the_hole = std::is_same<T, FixedDoubleArray>::value;
538 T array = T::cast(
object);
539 if (array->length() == 0)
return;
540 int previous_index = 0;
541 double previous_value = GetScalarElement(array, 0);
544 for (
i = 1;
i <= array->length();
i++) {
545 if (i < array->length()) value = GetScalarElement(array,
i);
546 bool values_are_nan = std::isnan(previous_value) && std::isnan(value);
547 if (
i != array->length() && (previous_value == value || values_are_nan) &&
548 IsTheHoleAt(array,
i - 1) == IsTheHoleAt(array,
i)) {
552 std::stringstream ss;
553 ss << previous_index;
554 if (previous_index !=
i - 1) {
555 ss <<
'-' << (
i - 1);
557 os << std::setw(12) << ss.str() <<
": ";
558 if (print_the_hole && IsTheHoleAt(array,
i - 1)) {
561 os << previous_value;
564 previous_value = value;
568 template <
typename T>
569 void PrintFixedArrayElements(std::ostream& os, T array) {
571 Object* previous_value = array->length() > 0 ? array->get(0) :
nullptr;
572 Object* value =
nullptr;
573 int previous_index = 0;
575 for (
i = 1;
i <= array->length();
i++) {
576 if (i < array->length()) value = array->get(
i);
577 if (previous_value == value &&
i != array->length()) {
581 std::stringstream ss;
582 ss << previous_index;
583 if (previous_index !=
i - 1) {
584 ss <<
'-' << (
i - 1);
586 os << std::setw(12) << ss.str() <<
": " << Brief(previous_value);
588 previous_value = value;
592 void PrintDictionaryElements(std::ostream& os, FixedArrayBase elements) {
594 NumberDictionary dict = NumberDictionary::cast(elements);
595 if (dict->requires_slow_elements()) {
596 os <<
"\n - requires_slow_elements";
598 os <<
"\n - max_number_key: " << dict->max_number_key();
603 void PrintSloppyArgumentElements(std::ostream& os, ElementsKind kind,
604 SloppyArgumentsElements elements) {
605 FixedArray arguments_store = elements->arguments();
606 os <<
"\n 0: context: " << Brief(elements->context())
607 <<
"\n 1: arguments_store: " << Brief(arguments_store)
608 <<
"\n parameter to context slot map:";
609 for (
uint32_t i = 0;
i < elements->parameter_map_length();
i++) {
610 uint32_t raw_index =
i + SloppyArgumentsElements::kParameterMapStart;
611 Object* mapped_entry = elements->get_mapped_entry(
i);
612 os <<
"\n " << raw_index <<
": param(" <<
i 613 <<
"): " << Brief(mapped_entry);
614 if (mapped_entry->IsTheHole()) {
615 os <<
" in the arguments_store[" <<
i <<
"]";
617 os <<
" in the context";
620 if (arguments_store->length() == 0)
return;
622 <<
"\n - arguments_store: " << Brief(arguments_store) <<
" " 623 << ElementsKindToString(arguments_store->map()->elements_kind()) <<
" {";
624 if (kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS) {
625 PrintFixedArrayElements(os, arguments_store);
627 DCHECK_EQ(kind, SLOW_SLOPPY_ARGUMENTS_ELEMENTS);
628 PrintDictionaryElements(os, arguments_store);
632 void PrintEmbedderData(std::ostream& os, EmbedderDataSlot slot) {
633 DisallowHeapAllocation no_gc;
634 Object* value = slot.load_tagged();
637 if (slot.ToAlignedPointer(&raw_pointer)) {
638 os <<
", aligned pointer: " << raw_pointer;
644 void JSObject::PrintElements(std::ostream& os) {
647 os <<
" - elements: " << Brief(elements()) <<
" {";
648 if (elements()->length() == 0) {
652 switch (map()->elements_kind()) {
653 case HOLEY_SMI_ELEMENTS:
654 case PACKED_SMI_ELEMENTS:
656 case PACKED_ELEMENTS:
657 case FAST_STRING_WRAPPER_ELEMENTS: {
658 PrintFixedArrayElements(os, FixedArray::cast(elements()));
661 case HOLEY_DOUBLE_ELEMENTS:
662 case PACKED_DOUBLE_ELEMENTS: {
663 DoPrintElements<FixedDoubleArray>(os, elements());
667 #define PRINT_ELEMENTS(Type, type, TYPE, elementType) \ 668 case TYPE##_ELEMENTS: { \ 669 DoPrintElements<Fixed##Type##Array>(os, elements()); \ 672 TYPED_ARRAYS(PRINT_ELEMENTS)
673 #undef PRINT_ELEMENTS 675 case DICTIONARY_ELEMENTS:
676 case SLOW_STRING_WRAPPER_ELEMENTS:
677 PrintDictionaryElements(os, elements());
679 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
680 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
681 PrintSloppyArgumentElements(os, map()->elements_kind(),
682 SloppyArgumentsElements::cast(elements()));
690 static void JSObjectPrintHeader(std::ostream& os, JSObject* obj,
692 Isolate* isolate = obj->GetIsolate();
693 obj->PrintHeader(os,
id);
697 if (obj->HasFastProperties()) {
698 os <<
"FastProperties";
700 os <<
"DictionaryProperties";
702 PrototypeIterator iter(isolate, obj);
703 os <<
"]\n - prototype: " << Brief(iter.GetCurrent());
704 os <<
"\n - elements: " << Brief(obj->elements()) <<
" [" 705 << ElementsKindToString(obj->map()->elements_kind());
706 if (obj->elements()->IsCowArray()) os <<
" (COW)";
708 Object* hash = obj->GetHash();
710 os <<
"\n - hash: " << Brief(hash);
712 if (obj->GetEmbedderFieldCount() > 0) {
713 os <<
"\n - embedder fields: " << obj->GetEmbedderFieldCount();
717 static void JSObjectPrintBody(std::ostream& os,
719 bool print_elements =
true) {
720 os <<
"\n - properties: ";
721 Object* properties_or_hash = obj->raw_properties_or_hash();
722 if (!properties_or_hash->IsSmi()) {
723 os << Brief(properties_or_hash);
726 if (obj->PrintProperties(os)) os <<
"\n ";
728 if (print_elements && obj->elements()->length() > 0) {
729 obj->PrintElements(os);
731 int embedder_fields = obj->GetEmbedderFieldCount();
732 if (embedder_fields > 0) {
733 os <<
" - embedder fields = {";
734 for (
int i = 0;
i < embedder_fields;
i++) {
736 PrintEmbedderData(os, EmbedderDataSlot(obj,
i));
742 void JSObject::JSObjectPrint(std::ostream& os) {
743 JSObjectPrintHeader(os,
this,
nullptr);
744 JSObjectPrintBody(os,
this);
747 void JSGeneratorObject::JSGeneratorObjectPrint(std::ostream& os) {
748 JSObjectPrintHeader(os,
this,
"JSGeneratorObject");
749 os <<
"\n - function: " << Brief(
function());
750 os <<
"\n - context: " << Brief(context());
751 os <<
"\n - receiver: " << Brief(receiver());
752 if (is_executing() || is_closed()) {
753 os <<
"\n - input: " << Brief(input_or_debug_pos());
755 DCHECK(is_suspended());
756 os <<
"\n - debug pos: " << Brief(input_or_debug_pos());
758 const char* mode =
"(invalid)";
759 switch (resume_mode()) {
770 os <<
"\n - resume mode: " << mode;
771 os <<
"\n - continuation: " << continuation();
772 if (is_closed()) os <<
" (closed)";
773 if (is_executing()) os <<
" (executing)";
774 if (is_suspended()) os <<
" (suspended)";
775 if (is_suspended()) {
776 DisallowHeapAllocation no_gc;
777 SharedFunctionInfo* fun_info =
function()->shared();
778 if (fun_info->HasSourceCode()) {
779 Script* script = Script::cast(fun_info->script());
780 int lin = script->GetLineNumber(source_position()) + 1;
781 int col = script->GetColumnNumber(source_position()) + 1;
782 String script_name = script->name()->IsString()
783 ? String::cast(script->name())
784 : GetReadOnlyRoots().empty_string();
785 os <<
"\n - source position: " << source_position();
787 script_name->PrintUC16(os);
788 os <<
", lin " << lin;
789 os <<
", col " << col;
793 os <<
"\n - register file: " << Brief(parameters_and_registers());
794 JSObjectPrintBody(os,
this);
797 void JSArray::JSArrayPrint(std::ostream& os) {
798 JSObjectPrintHeader(os,
this,
"JSArray");
799 os <<
"\n - length: " << Brief(this->length());
800 JSObjectPrintBody(os,
this);
803 void JSPromise::JSPromisePrint(std::ostream& os) {
804 JSObjectPrintHeader(os,
this,
"JSPromise");
805 os <<
"\n - status: " << JSPromise::Status(status());
806 if (status() == Promise::kPending) {
807 os <<
"\n - reactions: " << Brief(reactions());
809 os <<
"\n - result: " << Brief(result());
811 os <<
"\n - has_handler: " << has_handler();
812 JSObjectPrintBody(os,
this);
815 void JSRegExp::JSRegExpPrint(std::ostream& os) {
816 JSObjectPrintHeader(os,
this,
"JSRegExp");
817 os <<
"\n - data: " << Brief(data());
818 os <<
"\n - source: " << Brief(source());
819 JSObjectPrintBody(os,
this);
822 void JSRegExpStringIterator::JSRegExpStringIteratorPrint(
824 JSObjectPrintHeader(os,
this,
"JSRegExpStringIterator");
825 os <<
"\n - regex: " << Brief(iterating_regexp());
826 os <<
"\n - string: " << Brief(iterating_string());
827 os <<
"\n - done: " << done();
828 os <<
"\n - global: " << global();
829 os <<
"\n - unicode: " << unicode();
830 JSObjectPrintBody(os,
this);
833 void Symbol::SymbolPrint(std::ostream& os) {
834 PrintHeader(os,
"Symbol");
835 os <<
"\n - hash: " << Hash();
836 os <<
"\n - name: " << Brief(name());
837 if (name()->IsUndefined()) {
838 os <<
" (" << PrivateSymbolToName() <<
")";
840 os <<
"\n - private: " << is_private();
843 void Map::MapPrint(std::ostream& os) {
844 PrintHeader(os,
"Map");
845 os <<
"\n - type: " << instance_type();
846 os <<
"\n - instance size: ";
847 if (instance_size() == kVariableSizeSentinel) {
850 os << instance_size();
852 if (IsJSObjectMap()) {
853 os <<
"\n - inobject properties: " << GetInObjectProperties();
855 os <<
"\n - elements kind: " << ElementsKindToString(elements_kind());
856 os <<
"\n - unused property fields: " << UnusedPropertyFields();
857 os <<
"\n - enum length: ";
858 if (EnumLength() == kInvalidEnumCacheSentinel) {
863 if (is_deprecated()) os <<
"\n - deprecated_map";
864 if (is_stable()) os <<
"\n - stable_map";
865 if (is_migration_target()) os <<
"\n - migration_target";
866 if (is_dictionary_map()) os <<
"\n - dictionary_map";
867 if (has_hidden_prototype()) os <<
"\n - has_hidden_prototype";
868 if (has_named_interceptor()) os <<
"\n - named_interceptor";
869 if (has_indexed_interceptor()) os <<
"\n - indexed_interceptor";
870 if (may_have_interesting_symbols()) os <<
"\n - may_have_interesting_symbols";
871 if (is_undetectable()) os <<
"\n - undetectable";
872 if (is_callable()) os <<
"\n - callable";
873 if (is_constructor()) os <<
"\n - constructor";
874 if (has_prototype_slot()) {
875 os <<
"\n - has_prototype_slot";
876 if (has_non_instance_prototype()) os <<
" (non-instance prototype)";
878 if (is_access_check_needed()) os <<
"\n - access_check_needed";
879 if (!is_extensible()) os <<
"\n - non-extensible";
880 if (is_prototype_map()) {
881 os <<
"\n - prototype_map";
882 os <<
"\n - prototype info: " << Brief(prototype_info());
884 os <<
"\n - back pointer: " << Brief(GetBackPointer());
886 os <<
"\n - prototype_validity cell: " << Brief(prototype_validity_cell());
887 os <<
"\n - instance descriptors " << (owns_descriptors() ?
"(own) " :
"")
888 <<
"#" << NumberOfOwnDescriptors() <<
": " 889 << Brief(instance_descriptors());
890 if (FLAG_unbox_double_fields) {
891 os <<
"\n - layout descriptor: ";
892 layout_descriptor()->ShortPrint(os);
898 if (Isolate::FromWritableHeapObject(reinterpret_cast<HeapObject*>(ptr()),
900 DisallowHeapAllocation no_gc;
901 TransitionsAccessor transitions(isolate, *
this, &no_gc);
902 int nof_transitions = transitions.NumberOfTransitions();
903 if (nof_transitions > 0) {
904 os <<
"\n - transitions #" << nof_transitions <<
": ";
905 HeapObject* heap_object;
907 if (raw_transitions()->ToSmi(&smi)) {
909 }
else if (raw_transitions()->GetHeapObject(&heap_object)) {
910 os << Brief(heap_object);
912 transitions.PrintTransitions(os);
915 os <<
"\n - prototype: " << Brief(prototype());
916 os <<
"\n - constructor: " << Brief(GetConstructor());
917 os <<
"\n - dependent code: " << Brief(dependent_code());
918 os <<
"\n - construction counter: " << construction_counter();
922 void DescriptorArray::DescriptorArrayPrint(std::ostream& os) {
923 HeapObject::PrintHeader(os,
"DescriptorArray");
924 os <<
"\n - enum_cache: ";
925 if (enum_cache()->keys()->length() == 0) {
928 os << enum_cache()->keys()->length();
929 os <<
"\n - keys: " << Brief(enum_cache()->keys());
930 os <<
"\n - indices: " << Brief(enum_cache()->indices());
932 os <<
"\n - nof slack descriptors: " << number_of_slack_descriptors();
933 os <<
"\n - nof descriptors: " << number_of_descriptors();
934 PrintDescriptors(os);
937 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(
939 HeapObject::PrintHeader(os,
"AliasedArgumentsEntry");
940 os <<
"\n - aliased_context_slot: " << aliased_context_slot();
944 void PrintFixedArrayWithHeader(std::ostream& os, FixedArray array,
946 array->PrintHeader(os, type);
947 os <<
"\n - length: " << array->length();
948 PrintFixedArrayElements(os, array);
952 template <
typename T>
953 void PrintHashTableWithHeader(std::ostream& os, T table,
const char* type) {
954 table->PrintHeader(os, type);
955 os <<
"\n - length: " << table->length();
956 os <<
"\n - elements: " << table->NumberOfElements();
957 os <<
"\n - deleted: " << table->NumberOfDeletedElements();
958 os <<
"\n - capacity: " << table->Capacity();
960 os <<
"\n - elements: {";
961 for (
int i = 0;
i < table->Capacity();
i++) {
963 << std::setw(12) <<
i <<
": " << Brief(table->KeyAt(
i)) <<
" -> " 964 << Brief(table->ValueAt(
i));
969 template <
typename T>
970 void PrintWeakArrayElements(std::ostream& os, T* array) {
972 MaybeObject previous_value =
973 array->length() > 0 ? array->Get(0) : MaybeObject(kNullAddress);
975 int previous_index = 0;
977 for (
i = 1;
i <= array->length();
i++) {
978 if (i < array->length()) value = array->Get(
i);
979 if (previous_value == value &&
i != array->length()) {
983 std::stringstream ss;
984 ss << previous_index;
985 if (previous_index !=
i - 1) {
986 ss <<
'-' << (
i - 1);
988 os << std::setw(12) << ss.str() <<
": " << Brief(previous_value);
990 previous_value = value;
996 void EmbedderDataArray::EmbedderDataArrayPrint(std::ostream& os) {
997 PrintHeader(os,
"EmbedderDataArray");
998 os <<
"\n - length: " << length();
999 EmbedderDataSlot start(*
this, 0);
1000 EmbedderDataSlot end(*
this, length());
1001 for (EmbedderDataSlot slot = start; slot < end; ++slot) {
1003 PrintEmbedderData(os, slot);
1008 void FixedArray::FixedArrayPrint(std::ostream& os) {
1009 PrintFixedArrayWithHeader(os, *
this,
"FixedArray");
1013 void PrintContextWithHeader(std::ostream& os, Context context,
1015 context->PrintHeader(os, type);
1016 os <<
"\n - length: " << context->length();
1017 os <<
"\n - scope_info: " << Brief(context->scope_info());
1018 os <<
"\n - previous: " << Brief(context->previous());
1019 os <<
"\n - extension_object: " << Brief(context->extension_object());
1020 os <<
"\n - native_context: " << Brief(context->native_context());
1021 PrintFixedArrayElements(os, context);
1026 void Context::ContextPrint(std::ostream& os) {
1027 PrintContextWithHeader(os, *
this,
"Context");
1030 void NativeContext::NativeContextPrint(std::ostream& os) {
1031 PrintContextWithHeader(os, *
this,
"NativeContext");
1032 os <<
" - microtask_queue: " << microtask_queue() <<
"\n";
1035 void ObjectHashTable::ObjectHashTablePrint(std::ostream& os) {
1036 PrintHashTableWithHeader(os, *
this,
"ObjectHashTable");
1039 void NumberDictionary::NumberDictionaryPrint(std::ostream& os) {
1040 PrintHashTableWithHeader(os, *
this,
"NumberDictionary");
1043 void EphemeronHashTable::EphemeronHashTablePrint(std::ostream& os) {
1044 PrintHashTableWithHeader(os, *
this,
"EphemeronHashTable");
1047 void ObjectBoilerplateDescription::ObjectBoilerplateDescriptionPrint(
1049 PrintFixedArrayWithHeader(os, *
this,
"ObjectBoilerplateDescription");
1052 void PropertyArray::PropertyArrayPrint(std::ostream& os) {
1053 PrintHeader(os,
"PropertyArray");
1054 os <<
"\n - length: " << length();
1055 os <<
"\n - hash: " << Hash();
1056 PrintFixedArrayElements(os, *
this);
1060 void FixedDoubleArray::FixedDoubleArrayPrint(std::ostream& os) {
1061 PrintHeader(os,
"FixedDoubleArray");
1062 os <<
"\n - length: " << length();
1063 DoPrintElements<FixedDoubleArray>(os, *
this);
1067 void WeakFixedArray::WeakFixedArrayPrint(std::ostream& os) {
1068 PrintHeader(os,
"WeakFixedArray");
1069 os <<
"\n - length: " << length() <<
"\n";
1070 PrintWeakArrayElements(os,
this);
1074 void WeakArrayList::WeakArrayListPrint(std::ostream& os) {
1075 PrintHeader(os,
"WeakArrayList");
1076 os <<
"\n - capacity: " << capacity();
1077 os <<
"\n - length: " << length() <<
"\n";
1078 PrintWeakArrayElements(os,
this);
1082 void TransitionArray::TransitionArrayPrint(std::ostream& os) {
1083 HeapObject::PrintHeader(os,
"TransitionArray");
1087 void FeedbackCell::FeedbackCellPrint(std::ostream& os) {
1088 HeapObject::PrintHeader(os,
"FeedbackCell");
1089 ReadOnlyRoots roots = GetReadOnlyRoots();
1090 if (map() == roots.no_closures_cell_map()) {
1091 os <<
"\n - no closures";
1092 }
else if (map() == roots.one_closure_cell_map()) {
1093 os <<
"\n - one closure";
1094 }
else if (map() == roots.many_closures_cell_map()) {
1095 os <<
"\n - many closures";
1097 os <<
"\n - Invalid FeedbackCell map";
1099 os <<
" - value: " << Brief(value());
1103 void FeedbackVectorSpec::Print() {
1106 FeedbackVectorSpecPrint(os);
1111 void FeedbackVectorSpec::FeedbackVectorSpecPrint(std::ostream& os) {
1112 int slot_count = slots();
1113 os <<
" - slot_count: " << slot_count;
1114 if (slot_count == 0) {
1119 for (
int slot = 0; slot < slot_count;) {
1120 FeedbackSlotKind kind = GetKind(FeedbackSlot(slot));
1121 int entry_size = FeedbackMetadata::GetSlotSize(kind);
1122 DCHECK_LT(0, entry_size);
1123 os <<
"\n Slot #" << slot <<
" " << kind;
1129 void FeedbackMetadata::FeedbackMetadataPrint(std::ostream& os) {
1130 HeapObject::PrintHeader(os,
"FeedbackMetadata");
1131 os <<
"\n - slot_count: " << slot_count();
1133 FeedbackMetadataIterator iter(
this);
1134 while (iter.HasNext()) {
1135 FeedbackSlot slot = iter.Next();
1136 FeedbackSlotKind kind = iter.kind();
1137 os <<
"\n Slot " << slot <<
" " << kind;
1142 void FeedbackVector::FeedbackVectorPrint(std::ostream& os) {
1143 HeapObject::PrintHeader(os,
"FeedbackVector");
1144 os <<
"\n - length: " << length();
1145 if (length() == 0) {
1150 os <<
"\n - shared function info: " << Brief(shared_function_info());
1151 os <<
"\n - optimized code/marker: ";
1152 if (has_optimized_code()) {
1153 os << Brief(optimized_code());
1155 os << optimization_marker();
1157 os <<
"\n - invocation count: " << invocation_count();
1158 os <<
"\n - profiler ticks: " << profiler_ticks();
1160 FeedbackMetadataIterator iter(metadata());
1161 while (iter.HasNext()) {
1162 FeedbackSlot slot = iter.Next();
1163 FeedbackSlotKind kind = iter.kind();
1165 os <<
"\n - slot " << slot <<
" " << kind <<
" ";
1166 FeedbackSlotPrint(os, slot);
1168 int entry_size = iter.entry_size();
1169 if (entry_size > 0) os <<
" {";
1170 for (
int i = 0;
i < entry_size;
i++) {
1171 int index = GetIndex(slot) +
i;
1172 os <<
"\n [" << index <<
"]: " << Brief(
get(index));
1174 if (entry_size > 0) os <<
"\n }";
1179 void FeedbackVector::FeedbackSlotPrint(std::ostream& os,
1180 FeedbackSlot slot) {
1181 FeedbackNexus nexus(
this, slot);
1185 void FeedbackNexus::Print(std::ostream& os) {
1187 case FeedbackSlotKind::kCall:
1188 case FeedbackSlotKind::kLoadProperty:
1189 case FeedbackSlotKind::kLoadKeyed:
1190 case FeedbackSlotKind::kLoadGlobalInsideTypeof:
1191 case FeedbackSlotKind::kLoadGlobalNotInsideTypeof:
1192 case FeedbackSlotKind::kStoreNamedSloppy:
1193 case FeedbackSlotKind::kStoreNamedStrict:
1194 case FeedbackSlotKind::kStoreOwnNamed:
1195 case FeedbackSlotKind::kStoreGlobalSloppy:
1196 case FeedbackSlotKind::kStoreGlobalStrict:
1197 case FeedbackSlotKind::kStoreKeyedSloppy:
1198 case FeedbackSlotKind::kInstanceOf:
1199 case FeedbackSlotKind::kStoreDataPropertyInLiteral:
1200 case FeedbackSlotKind::kStoreKeyedStrict:
1201 case FeedbackSlotKind::kStoreInArrayLiteral:
1202 case FeedbackSlotKind::kCloneObject: {
1203 os << InlineCacheState2String(StateFromFeedback());
1206 case FeedbackSlotKind::kBinaryOp: {
1207 os <<
"BinaryOp:" << GetBinaryOperationFeedback();
1210 case FeedbackSlotKind::kCompareOp: {
1211 os <<
"CompareOp:" << GetCompareOperationFeedback();
1214 case FeedbackSlotKind::kForIn: {
1215 os <<
"ForIn:" << GetForInFeedback();
1218 case FeedbackSlotKind::kCreateClosure:
1219 case FeedbackSlotKind::kLiteral:
1220 case FeedbackSlotKind::kTypeProfile:
1222 case FeedbackSlotKind::kInvalid:
1223 case FeedbackSlotKind::kKindsNumber:
1229 void JSValue::JSValuePrint(std::ostream& os) {
1230 JSObjectPrintHeader(os,
this,
"JSValue");
1231 os <<
"\n - value: " << Brief(value());
1232 JSObjectPrintBody(os,
this);
1235 void JSMessageObject::JSMessageObjectPrint(std::ostream& os) {
1236 JSObjectPrintHeader(os,
this,
"JSMessageObject");
1237 os <<
"\n - type: " <<
static_cast<int>(type());
1238 os <<
"\n - arguments: " << Brief(argument());
1239 os <<
"\n - start_position: " << start_position();
1240 os <<
"\n - end_position: " << end_position();
1241 os <<
"\n - script: " << Brief(script());
1242 os <<
"\n - stack_frames: " << Brief(stack_frames());
1243 JSObjectPrintBody(os,
this);
1247 void String::StringPrint(std::ostream& os) {
1248 if (!HasOnlyOneByteChars()) {
1251 if (StringShape(*this).IsInternalized()) {
1253 }
else if (StringShape(*this).IsCons()) {
1255 }
else if (StringShape(*this).IsThin()) {
1261 const char truncated_epilogue[] =
"...<truncated>";
1263 if (!FLAG_use_verbose_printer) {
1265 len = 100 -
sizeof(truncated_epilogue);
1268 for (
int i = 0;
i < len;
i++) {
1269 os << AsUC16(Get(
i));
1271 if (len != length()) {
1272 os << truncated_epilogue;
1275 if (!StringShape(*this).IsInternalized()) os <<
"\"";
1279 void Name::NamePrint(std::ostream& os) {
1281 String::cast(*this)->StringPrint(os);
1288 static const char*
const weekdays[] = {
1289 "???",
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat" 1292 void JSDate::JSDatePrint(std::ostream& os) {
1293 JSObjectPrintHeader(os,
this,
"JSDate");
1294 os <<
"\n - value: " << Brief(value());
1295 if (!year()->IsSmi()) {
1296 os <<
"\n - time = NaN\n";
1299 ScopedVector<char> buf(100);
1300 SNPrintF(buf,
"\n - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
1301 weekdays[weekday()->IsSmi() ? Smi::ToInt(weekday()) + 1 : 0],
1302 year()->IsSmi() ? Smi::ToInt(year()) : -1,
1303 month()->IsSmi() ? Smi::ToInt(month()) : -1,
1304 day()->IsSmi() ? Smi::ToInt(day()) : -1,
1305 hour()->IsSmi() ? Smi::ToInt(hour()) : -1,
1306 min()->IsSmi() ? Smi::ToInt(min()) : -1,
1307 sec()->IsSmi() ? Smi::ToInt(sec()) : -1);
1310 JSObjectPrintBody(os,
this);
1314 void JSProxy::JSProxyPrint(std::ostream& os) {
1315 HeapObject::PrintHeader(os,
"JSProxy");
1316 os <<
"\n - target: ";
1317 target()->ShortPrint(os);
1318 os <<
"\n - handler: ";
1319 handler()->ShortPrint(os);
1323 void JSSet::JSSetPrint(std::ostream& os) {
1324 JSObjectPrintHeader(os,
this,
"JSSet");
1325 os <<
" - table: " << Brief(table());
1326 JSObjectPrintBody(os,
this);
1329 void JSMap::JSMapPrint(std::ostream& os) {
1330 JSObjectPrintHeader(os,
this,
"JSMap");
1331 os <<
" - table: " << Brief(table());
1332 JSObjectPrintBody(os,
this);
1335 void JSCollectionIterator::JSCollectionIteratorPrint(
1336 std::ostream& os,
const char* name) {
1337 JSObjectPrintHeader(os,
this, name);
1338 os <<
"\n - table: " << Brief(table());
1339 os <<
"\n - index: " << Brief(index());
1340 JSObjectPrintBody(os,
this);
1343 void JSSetIterator::JSSetIteratorPrint(std::ostream& os) {
1344 JSCollectionIteratorPrint(os,
"JSSetIterator");
1347 void JSMapIterator::JSMapIteratorPrint(std::ostream& os) {
1348 JSCollectionIteratorPrint(os,
"JSMapIterator");
1351 void JSWeakCell::JSWeakCellPrint(std::ostream& os) {
1352 JSObjectPrintHeader(os,
this,
"JSWeakCell");
1353 os <<
"\n - factory: " << Brief(factory());
1354 os <<
"\n - target: " << Brief(target());
1355 os <<
"\n - holdings: " << Brief(holdings());
1356 os <<
"\n - prev: " << Brief(prev());
1357 os <<
"\n - next: " << Brief(next());
1358 JSObjectPrintBody(os,
this);
1361 void JSWeakFactory::JSWeakFactoryPrint(std::ostream& os) {
1362 JSObjectPrintHeader(os,
this,
"JSWeakFactory");
1363 os <<
"\n - native_context: " << Brief(native_context());
1364 os <<
"\n - cleanup: " << Brief(cleanup());
1365 os <<
"\n - active_cells: " << Brief(active_cells());
1366 os <<
"\n - cleared_cells: " << Brief(cleared_cells());
1367 JSObjectPrintBody(os,
this);
1370 void JSWeakFactoryCleanupIterator::JSWeakFactoryCleanupIteratorPrint(
1372 JSObjectPrintHeader(os,
this,
"JSWeakFactoryCleanupIterator");
1373 os <<
"\n - factory: " << Brief(factory());
1374 JSObjectPrintBody(os,
this);
1377 void WeakFactoryCleanupJobTask::WeakFactoryCleanupJobTaskPrint(
1379 HeapObject::PrintHeader(os,
"WeakFactoryCleanupJobTask");
1380 os <<
"\n - factory: " << Brief(factory());
1383 void JSWeakMap::JSWeakMapPrint(std::ostream& os) {
1384 JSObjectPrintHeader(os,
this,
"JSWeakMap");
1385 os <<
"\n - table: " << Brief(table());
1386 JSObjectPrintBody(os,
this);
1389 void JSWeakSet::JSWeakSetPrint(std::ostream& os) {
1390 JSObjectPrintHeader(os,
this,
"JSWeakSet");
1391 os <<
"\n - table: " << Brief(table());
1392 JSObjectPrintBody(os,
this);
1395 void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) {
1396 JSObjectPrintHeader(os,
this,
"JSArrayBuffer");
1397 os <<
"\n - backing_store: " << backing_store();
1398 os <<
"\n - byte_length: " << byte_length();
1399 if (is_external()) os <<
"\n - external";
1400 if (is_neuterable()) os <<
"\n - neuterable";
1401 if (was_neutered()) os <<
"\n - neutered";
1402 if (is_shared()) os <<
"\n - shared";
1403 if (is_wasm_memory()) os <<
"\n - is_wasm_memory";
1404 if (is_growable()) os <<
"\n - growable";
1405 JSObjectPrintBody(os,
this, !was_neutered());
1408 void JSTypedArray::JSTypedArrayPrint(std::ostream& os) {
1409 JSObjectPrintHeader(os,
this,
"JSTypedArray");
1410 os <<
"\n - buffer: " << Brief(buffer());
1411 os <<
"\n - byte_offset: " << byte_offset();
1412 os <<
"\n - byte_length: " << byte_length();
1413 os <<
"\n - length: " << Brief(length());
1414 if (WasNeutered()) os <<
"\n - neutered";
1415 JSObjectPrintBody(os,
this, !WasNeutered());
1418 void JSArrayIterator::JSArrayIteratorPrint(std::ostream& os) {
1419 JSObjectPrintHeader(os,
this,
"JSArrayIterator");
1420 os <<
"\n - iterated_object: " << Brief(iterated_object());
1421 os <<
"\n - next_index: " << Brief(next_index());
1422 os <<
"\n - kind: " << kind();
1423 JSObjectPrintBody(os,
this);
1426 void JSDataView::JSDataViewPrint(std::ostream& os) {
1427 JSObjectPrintHeader(os,
this,
"JSDataView");
1428 os <<
"\n - buffer =" << Brief(buffer());
1429 os <<
"\n - byte_offset: " << byte_offset();
1430 os <<
"\n - byte_length: " << byte_length();
1431 if (WasNeutered()) os <<
"\n - neutered";
1432 JSObjectPrintBody(os,
this, !WasNeutered());
1435 void JSBoundFunction::JSBoundFunctionPrint(std::ostream& os) {
1436 JSObjectPrintHeader(os,
this,
"JSBoundFunction");
1437 os <<
"\n - bound_target_function: " << Brief(bound_target_function());
1438 os <<
"\n - bound_this: " << Brief(bound_this());
1439 os <<
"\n - bound_arguments: " << Brief(bound_arguments());
1440 JSObjectPrintBody(os,
this);
1443 void JSFunction::JSFunctionPrint(std::ostream& os) {
1444 Isolate* isolate = GetIsolate();
1445 JSObjectPrintHeader(os,
this,
"Function");
1446 os <<
"\n - function prototype: ";
1447 if (has_prototype_slot()) {
1448 if (has_prototype()) {
1449 os << Brief(prototype());
1450 if (map()->has_non_instance_prototype()) {
1451 os <<
" (non-instance prototype)";
1454 os <<
"\n - initial_map: ";
1455 if (has_initial_map()) os << Brief(initial_map());
1457 os <<
"<no-prototype-slot>";
1459 os <<
"\n - shared_info: " << Brief(shared());
1460 os <<
"\n - name: " << Brief(shared()->Name());
1463 int builtin_index = code()->builtin_index();
1464 if (Builtins::IsBuiltinId(builtin_index) && !IsInterpreted()) {
1465 os <<
"\n - builtin: " << isolate->builtins()->name(builtin_index);
1468 os <<
"\n - formal_parameter_count: " 1469 << shared()->internal_formal_parameter_count();
1470 os <<
"\n - kind: " << shared()->kind();
1471 os <<
"\n - context: " << Brief(context());
1472 os <<
"\n - code: " << Brief(code());
1473 if (IsInterpreted()) {
1474 os <<
"\n - interpreted";
1475 if (shared()->HasBytecodeArray()) {
1476 os <<
"\n - bytecode: " << shared()->GetBytecodeArray();
1479 if (WasmExportedFunction::IsWasmExportedFunction(
this)) {
1480 WasmExportedFunction*
function = WasmExportedFunction::cast(
this);
1481 os <<
"\n - WASM instance " 1482 <<
reinterpret_cast<void*
>(
function->instance());
1483 os <<
"\n - WASM function index " <<
function->function_index();
1485 shared()->PrintSourceCode(os);
1486 JSObjectPrintBody(os,
this);
1487 os <<
"\n - feedback vector: ";
1488 if (!shared()->HasFeedbackMetadata()) {
1489 os <<
"feedback metadata is not available in SFI\n";
1490 }
else if (has_feedback_vector()) {
1491 feedback_vector()->FeedbackVectorPrint(os);
1493 os <<
"not available\n";
1497 void SharedFunctionInfo::PrintSourceCode(std::ostream& os) {
1498 if (HasSourceCode()) {
1499 os <<
"\n - source code: ";
1500 String source = String::cast(Script::cast(script())->source());
1501 int start = StartPosition();
1502 int length = EndPosition() - start;
1503 std::unique_ptr<char[]> source_string = source->ToCString(
1504 DISALLOW_NULLS, FAST_STRING_TRAVERSAL, start, length,
nullptr);
1505 os << source_string.get();
1509 void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) {
1510 HeapObject::PrintHeader(os,
"SharedFunctionInfo");
1511 os <<
"\n - name: ";
1512 if (HasSharedName()) {
1513 os << Brief(Name());
1515 os <<
"<no-shared-name>";
1517 if (HasInferredName()) {
1518 os <<
"\n - inferred name: " << Brief(inferred_name());
1520 os <<
"\n - kind: " << kind();
1521 if (needs_home_object()) {
1522 os <<
"\n - needs_home_object";
1524 os <<
"\n - function_map_index: " << function_map_index();
1525 os <<
"\n - formal_parameter_count: " << internal_formal_parameter_count();
1526 os <<
"\n - expected_nof_properties: " << expected_nof_properties();
1527 os <<
"\n - language_mode: " << language_mode();
1528 os <<
"\n - data: " << Brief(function_data());
1529 os <<
"\n - code (from data): " << Brief(GetCode());
1530 PrintSourceCode(os);
1534 if (is_named_expression()) {
1535 os <<
"\n - named expression";
1536 }
else if (is_anonymous_expression()) {
1537 os <<
"\n - anonymous expression";
1538 }
else if (is_declaration()) {
1539 os <<
"\n - declaration";
1541 os <<
"\n - function token position: " << function_token_position();
1542 os <<
"\n - start position: " << StartPosition();
1543 os <<
"\n - end position: " << EndPosition();
1544 if (HasDebugInfo()) {
1545 os <<
"\n - debug info: " << Brief(GetDebugInfo());
1547 os <<
"\n - no debug info";
1549 os <<
"\n - scope info: " << Brief(scope_info());
1550 if (HasOuterScopeInfo()) {
1551 os <<
"\n - outer scope info: " << Brief(GetOuterScopeInfo());
1553 os <<
"\n - length: " << length();
1554 os <<
"\n - feedback_metadata: ";
1555 if (HasFeedbackMetadata()) {
1556 feedback_metadata()->FeedbackMetadataPrint(os);
1563 void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) {
1564 JSObjectPrintHeader(os,
this,
"JSGlobalProxy");
1565 if (!GetIsolate()->bootstrapper()->IsActive()) {
1566 os <<
"\n - native context: " << Brief(native_context());
1568 JSObjectPrintBody(os,
this);
1571 void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) {
1572 JSObjectPrintHeader(os,
this,
"JSGlobalObject");
1573 if (!GetIsolate()->bootstrapper()->IsActive()) {
1574 os <<
"\n - native context: " << Brief(native_context());
1576 os <<
"\n - global proxy: " << Brief(global_proxy());
1577 JSObjectPrintBody(os,
this);
1580 void Cell::CellPrint(std::ostream& os) {
1581 HeapObject::PrintHeader(os,
"Cell");
1582 os <<
"\n - value: " << Brief(value());
1586 void PropertyCell::PropertyCellPrint(std::ostream& os) {
1587 HeapObject::PrintHeader(os,
"PropertyCell");
1588 os <<
"\n - name: ";
1589 name()->NamePrint(os);
1590 os <<
"\n - value: " << Brief(value());
1591 os <<
"\n - details: ";
1592 property_details().PrintAsSlowTo(os);
1593 PropertyCellType cell_type = property_details().cell_type();
1594 os <<
"\n - cell_type: ";
1595 if (value()->IsTheHole()) {
1596 switch (cell_type) {
1597 case PropertyCellType::kUninitialized:
1598 os <<
"Uninitialized";
1600 case PropertyCellType::kInvalidated:
1601 os <<
"Invalidated";
1604 os <<
"??? " <<
static_cast<int>(cell_type);
1608 switch (cell_type) {
1609 case PropertyCellType::kUndefined:
1612 case PropertyCellType::kConstant:
1615 case PropertyCellType::kConstantType:
1616 os <<
"ConstantType" 1618 switch (GetConstantType()) {
1619 case PropertyCellConstantType::kSmi:
1622 case PropertyCellConstantType::kStableMap:
1628 case PropertyCellType::kMutable:
1636 void Code::CodePrint(std::ostream& os) {
1637 PrintHeader(os,
"Code");
1639 #ifdef ENABLE_DISASSEMBLER 1640 if (FLAG_use_verbose_printer) {
1641 Disassemble(
nullptr, os);
1646 void CodeDataContainer::CodeDataContainerPrint(std::ostream& os) {
1647 HeapObject::PrintHeader(os,
"CodeDataContainer");
1648 os <<
"\n - kind_specific_flags: " << kind_specific_flags();
1652 void Foreign::ForeignPrint(std::ostream& os) {
1653 os <<
"foreign address : " <<
reinterpret_cast<void*
>(foreign_address());
1658 void AccessorInfo::AccessorInfoPrint(std::ostream& os) {
1659 HeapObject::PrintHeader(os,
"AccessorInfo");
1660 os <<
"\n - name: " << Brief(name());
1661 os <<
"\n - flags: " << flags();
1662 os <<
"\n - getter: " << Brief(getter());
1663 os <<
"\n - setter: " << Brief(setter());
1664 os <<
"\n - js_getter: " << Brief(js_getter());
1665 os <<
"\n - data: " << Brief(data());
1669 void CallbackTask::CallbackTaskPrint(std::ostream& os) {
1670 HeapObject::PrintHeader(os,
"CallbackTask");
1671 os <<
"\n - callback: " << Brief(callback());
1672 os <<
"\n - data: " << Brief(data());
1676 void CallableTask::CallableTaskPrint(std::ostream& os) {
1677 HeapObject::PrintHeader(os,
"CallableTask");
1678 os <<
"\n - context: " << Brief(context());
1679 os <<
"\n - callable: " << Brief(callable());
1683 void PromiseFulfillReactionJobTask::PromiseFulfillReactionJobTaskPrint(
1685 HeapObject::PrintHeader(os,
"PromiseFulfillReactionJobTask");
1686 os <<
"\n - argument: " << Brief(argument());
1687 os <<
"\n - context: " << Brief(context());
1688 os <<
"\n - handler: " << Brief(handler());
1689 os <<
"\n - promise_or_capability: " << Brief(promise_or_capability());
1693 void PromiseRejectReactionJobTask::PromiseRejectReactionJobTaskPrint(
1695 HeapObject::PrintHeader(os,
"PromiseRejectReactionJobTask");
1696 os <<
"\n - argument: " << Brief(argument());
1697 os <<
"\n - context: " << Brief(context());
1698 os <<
"\n - handler: " << Brief(handler());
1699 os <<
"\n - promise_or_capability: " << Brief(promise_or_capability());
1703 void PromiseResolveThenableJobTask::PromiseResolveThenableJobTaskPrint(
1705 HeapObject::PrintHeader(os,
"PromiseResolveThenableJobTask");
1706 os <<
"\n - context: " << Brief(context());
1707 os <<
"\n - promise_to_resolve: " << Brief(promise_to_resolve());
1708 os <<
"\n - then: " << Brief(then());
1709 os <<
"\n - thenable: " << Brief(thenable());
1713 void PromiseCapability::PromiseCapabilityPrint(std::ostream& os) {
1714 HeapObject::PrintHeader(os,
"PromiseCapability");
1715 os <<
"\n - promise: " << Brief(promise());
1716 os <<
"\n - resolve: " << Brief(resolve());
1717 os <<
"\n - reject: " << Brief(reject());
1721 void PromiseReaction::PromiseReactionPrint(std::ostream& os) {
1722 HeapObject::PrintHeader(os,
"PromiseReaction");
1723 os <<
"\n - next: " << Brief(next());
1724 os <<
"\n - reject_handler: " << Brief(reject_handler());
1725 os <<
"\n - fulfill_handler: " << Brief(fulfill_handler());
1726 os <<
"\n - promise_or_capability: " << Brief(promise_or_capability());
1730 void AsyncGeneratorRequest::AsyncGeneratorRequestPrint(
1732 HeapObject::PrintHeader(os,
"AsyncGeneratorRequest");
1733 const char* mode =
"Invalid!";
1734 switch (resume_mode()) {
1735 case JSGeneratorObject::kNext:
1738 case JSGeneratorObject::kReturn:
1741 case JSGeneratorObject::kThrow:
1745 os <<
"\n - resume mode: " << mode;
1746 os <<
"\n - value: " << Brief(value());
1747 os <<
"\n - next: " << Brief(next());
1751 void ModuleInfoEntry::ModuleInfoEntryPrint(std::ostream& os) {
1752 HeapObject::PrintHeader(os,
"ModuleInfoEntry");
1753 os <<
"\n - export_name: " << Brief(export_name());
1754 os <<
"\n - local_name: " << Brief(local_name());
1755 os <<
"\n - import_name: " << Brief(import_name());
1756 os <<
"\n - module_request: " << module_request();
1757 os <<
"\n - cell_index: " << cell_index();
1758 os <<
"\n - beg_pos: " << beg_pos();
1759 os <<
"\n - end_pos: " << end_pos();
1763 void Module::ModulePrint(std::ostream& os) {
1764 HeapObject::PrintHeader(os,
"Module");
1765 os <<
"\n - origin: " << Brief(script()->GetNameOrSourceURL());
1766 os <<
"\n - code: " << Brief(code());
1767 os <<
"\n - exports: " << Brief(exports());
1768 os <<
"\n - requested_modules: " << Brief(requested_modules());
1769 os <<
"\n - script: " << Brief(script());
1770 os <<
"\n - import_meta: " << Brief(import_meta());
1771 os <<
"\n - status: " << status();
1772 os <<
"\n - exception: " << Brief(exception());
1776 void JSModuleNamespace::JSModuleNamespacePrint(std::ostream& os) {
1777 JSObjectPrintHeader(os,
this,
"JSModuleNamespace");
1778 os <<
"\n - module: " << Brief(module());
1779 JSObjectPrintBody(os,
this);
1782 void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) {
1783 HeapObject::PrintHeader(os,
"PrototypeInfo");
1784 os <<
"\n - module namespace: " << Brief(module_namespace());
1785 os <<
"\n - prototype users: " << Brief(prototype_users());
1786 os <<
"\n - registry slot: " << registry_slot();
1787 os <<
"\n - object create map: " << Brief(object_create_map());
1788 os <<
"\n - should_be_fast_map: " << should_be_fast_map();
1792 void Tuple2::Tuple2Print(std::ostream& os) {
1793 HeapObject::PrintHeader(os,
"Tuple2");
1794 os <<
"\n - value1: " << Brief(value1());
1795 os <<
"\n - value2: " << Brief(value2());
1799 void Tuple3::Tuple3Print(std::ostream& os) {
1800 HeapObject::PrintHeader(os,
"Tuple3");
1801 os <<
"\n - value1: " << Brief(value1());
1802 os <<
"\n - value2: " << Brief(value2());
1803 os <<
"\n - value3: " << Brief(value3());
1807 void ArrayBoilerplateDescription::ArrayBoilerplateDescriptionPrint(
1809 HeapObject::PrintHeader(os,
"ArrayBoilerplateDescription");
1810 os <<
"\n - elements kind: " << elements_kind();
1811 os <<
"\n - constant elements: " << Brief(constant_elements());
1815 void AsmWasmData::AsmWasmDataPrint(std::ostream& os) {
1816 HeapObject::PrintHeader(os,
"AsmWasmData");
1817 os <<
"\n - native module: " << Brief(managed_native_module());
1818 os <<
"\n - export_wrappers: " << Brief(export_wrappers());
1819 os <<
"\n - offset table: " << Brief(asm_js_offset_table());
1820 os <<
"\n - uses bitset: " << uses_bitset()->value();
1824 void WasmDebugInfo::WasmDebugInfoPrint(std::ostream& os) {
1825 HeapObject::PrintHeader(os,
"WasmDebugInfo");
1826 os <<
"\n - wasm_instance: " << Brief(wasm_instance());
1830 void WasmInstanceObject::WasmInstanceObjectPrint(std::ostream& os) {
1831 HeapObject::PrintHeader(os,
"WasmInstanceObject");
1832 os <<
"\n - module_object: " << Brief(module_object());
1833 os <<
"\n - exports_object: " << Brief(exports_object());
1834 os <<
"\n - native_context: " << Brief(native_context());
1835 if (has_memory_object()) {
1836 os <<
"\n - memory_object: " << Brief(memory_object());
1838 if (has_globals_buffer()) {
1839 os <<
"\n - globals_buffer: " << Brief(globals_buffer());
1841 if (has_imported_mutable_globals_buffers()) {
1842 os <<
"\n - imported_mutable_globals_buffers: " 1843 << Brief(imported_mutable_globals_buffers());
1845 if (has_debug_info()) {
1846 os <<
"\n - debug_info: " << Brief(debug_info());
1848 if (has_table_object()) {
1849 os <<
"\n - table_object: " << Brief(table_object());
1851 os <<
"\n - imported_function_refs: " << Brief(imported_function_refs());
1852 if (has_indirect_function_table_refs()) {
1853 os <<
"\n - indirect_function_table_refs: " 1854 << Brief(indirect_function_table_refs());
1856 if (has_managed_native_allocations()) {
1857 os <<
"\n - managed_native_allocations: " 1858 << Brief(managed_native_allocations());
1860 os <<
"\n - memory_start: " <<
static_cast<void*
>(memory_start());
1861 os <<
"\n - memory_size: " << memory_size();
1862 os <<
"\n - memory_mask: " << AsHex(memory_mask());
1863 os <<
"\n - imported_function_targets: " 1864 <<
static_cast<void*
>(imported_function_targets());
1865 os <<
"\n - globals_start: " <<
static_cast<void*
>(globals_start());
1866 os <<
"\n - imported_mutable_globals: " 1867 <<
static_cast<void*
>(imported_mutable_globals());
1868 os <<
"\n - indirect_function_table_size: " << indirect_function_table_size();
1869 os <<
"\n - indirect_function_table_sig_ids: " 1870 <<
static_cast<void*
>(indirect_function_table_sig_ids());
1871 os <<
"\n - indirect_function_table_targets: " 1872 <<
static_cast<void*
>(indirect_function_table_targets());
1876 void WasmExportedFunctionData::WasmExportedFunctionDataPrint(
1878 HeapObject::PrintHeader(os,
"WasmExportedFunctionData");
1879 os <<
"\n - wrapper_code: " << Brief(wrapper_code());
1880 os <<
"\n - instance: " << Brief(instance());
1881 os <<
"\n - function_index: " << function_index();
1885 void WasmModuleObject::WasmModuleObjectPrint(std::ostream& os) {
1886 HeapObject::PrintHeader(os,
"WasmModuleObject");
1887 os <<
"\n - module: " << module();
1888 os <<
"\n - native module: " << native_module();
1889 os <<
"\n - export wrappers: " << Brief(export_wrappers());
1890 os <<
"\n - script: " << Brief(script());
1891 if (has_asm_js_offset_table()) {
1892 os <<
"\n - asm_js_offset_table: " << Brief(asm_js_offset_table());
1894 if (has_breakpoint_infos()) {
1895 os <<
"\n - breakpoint_infos: " << Brief(breakpoint_infos());
1900 void LoadHandler::LoadHandlerPrint(std::ostream& os) {
1901 HeapObject::PrintHeader(os,
"LoadHandler");
1903 os <<
"\n - handler: " << Brief(smi_handler());
1904 os <<
"\n - validity_cell: " << Brief(validity_cell());
1905 int data_count = data_field_count();
1906 if (data_count >= 1) {
1907 os <<
"\n - data1: " << Brief(data1());
1909 if (data_count >= 2) {
1910 os <<
"\n - data2: " << Brief(data2());
1912 if (data_count >= 3) {
1913 os <<
"\n - data3: " << Brief(data3());
1918 void StoreHandler::StoreHandlerPrint(std::ostream& os) {
1919 HeapObject::PrintHeader(os,
"StoreHandler");
1921 os <<
"\n - handler: " << Brief(smi_handler());
1922 os <<
"\n - validity_cell: " << Brief(validity_cell());
1923 int data_count = data_field_count();
1924 if (data_count >= 1) {
1925 os <<
"\n - data1: " << Brief(data1());
1927 if (data_count >= 2) {
1928 os <<
"\n - data2: " << Brief(data2());
1930 if (data_count >= 3) {
1931 os <<
"\n - data3: " << Brief(data3());
1936 void AccessorPair::AccessorPairPrint(std::ostream& os) {
1937 HeapObject::PrintHeader(os,
"AccessorPair");
1938 os <<
"\n - getter: " << Brief(getter());
1939 os <<
"\n - setter: " << Brief(setter());
1944 void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) {
1945 HeapObject::PrintHeader(os,
"AccessCheckInfo");
1946 os <<
"\n - callback: " << Brief(callback());
1947 os <<
"\n - named_interceptor: " << Brief(named_interceptor());
1948 os <<
"\n - indexed_interceptor: " << Brief(indexed_interceptor());
1949 os <<
"\n - data: " << Brief(data());
1953 void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) {
1954 HeapObject::PrintHeader(os,
"CallHandlerInfo");
1955 os <<
"\n - callback: " << Brief(callback());
1956 os <<
"\n - js_callback: " << Brief(js_callback());
1957 os <<
"\n - data: " << Brief(data());
1958 os <<
"\n - side_effect_free: " 1959 << (IsSideEffectFreeCallHandlerInfo() ?
"true" :
"false");
1963 void InterceptorInfo::InterceptorInfoPrint(std::ostream& os) {
1964 HeapObject::PrintHeader(os,
"InterceptorInfo");
1965 os <<
"\n - getter: " << Brief(getter());
1966 os <<
"\n - setter: " << Brief(setter());
1967 os <<
"\n - query: " << Brief(query());
1968 os <<
"\n - deleter: " << Brief(deleter());
1969 os <<
"\n - enumerator: " << Brief(enumerator());
1970 os <<
"\n - data: " << Brief(data());
1975 void FunctionTemplateInfo::FunctionTemplateInfoPrint(
1977 HeapObject::PrintHeader(os,
"FunctionTemplateInfo");
1978 os <<
"\n - class name: " << Brief(class_name());
1979 os <<
"\n - tag: " << Brief(tag());
1980 os <<
"\n - serial_number: " << Brief(serial_number());
1981 os <<
"\n - property_list: " << Brief(property_list());
1982 os <<
"\n - call_code: " << Brief(call_code());
1983 os <<
"\n - property_accessors: " << Brief(property_accessors());
1984 os <<
"\n - signature: " << Brief(signature());
1985 os <<
"\n - cached_property_name: " << Brief(cached_property_name());
1986 os <<
"\n - hidden_prototype: " << (hidden_prototype() ?
"true" :
"false");
1987 os <<
"\n - undetectable: " << (undetectable() ?
"true" :
"false");
1988 os <<
"\n - need_access_check: " << (needs_access_check() ?
"true" :
"false");
1989 os <<
"\n - instantiated: " << (instantiated() ?
"true" :
"false");
1990 os <<
"\n - rare_data: " << Brief(rare_data());
1994 void FunctionTemplateRareData::FunctionTemplateRareDataPrint(
1996 HeapObject::PrintHeader(os,
"FunctionTemplateRareData");
1997 os <<
"\n - prototype_template: " << Brief(prototype_template());
1998 os <<
"\n - prototype_provider_template: " 1999 << Brief(prototype_provider_template());
2000 os <<
"\n - parent_template: " << Brief(parent_template());
2001 os <<
"\n - named_property_handler: " << Brief(named_property_handler());
2002 os <<
"\n - indexed_property_handler: " << Brief(indexed_property_handler());
2003 os <<
"\n - instance_template: " << Brief(instance_template());
2004 os <<
"\n - instance_call_handler: " << Brief(instance_call_handler());
2005 os <<
"\n - access_check_info: " << Brief(access_check_info());
2009 void ObjectTemplateInfo::ObjectTemplateInfoPrint(std::ostream& os) {
2010 HeapObject::PrintHeader(os,
"ObjectTemplateInfo");
2011 os <<
"\n - tag: " << Brief(tag());
2012 os <<
"\n - serial_number: " << Brief(serial_number());
2013 os <<
"\n - property_list: " << Brief(property_list());
2014 os <<
"\n - property_accessors: " << Brief(property_accessors());
2015 os <<
"\n - constructor: " << Brief(constructor());
2016 os <<
"\n - embedder_field_count: " << embedder_field_count();
2017 os <<
"\n - immutable_proto: " << (immutable_proto() ?
"true" :
"false");
2022 void AllocationSite::AllocationSitePrint(std::ostream& os) {
2023 HeapObject::PrintHeader(os,
"AllocationSite");
2024 if (this->HasWeakNext()) os <<
"\n - weak_next: " << Brief(weak_next());
2025 os <<
"\n - dependent code: " << Brief(dependent_code());
2026 os <<
"\n - nested site: " << Brief(nested_site());
2027 os <<
"\n - memento found count: " 2028 << Brief(Smi::FromInt(memento_found_count()));
2029 os <<
"\n - memento create count: " 2030 << Brief(Smi::FromInt(memento_create_count()));
2031 os <<
"\n - pretenure decision: " 2032 << Brief(Smi::FromInt(pretenure_decision()));
2033 os <<
"\n - transition_info: ";
2034 if (!PointsToLiteral()) {
2035 ElementsKind kind = GetElementsKind();
2036 os <<
"Array allocation with ElementsKind " << ElementsKindToString(kind);
2037 }
else if (boilerplate()->IsJSArray()) {
2038 os <<
"Array literal with boilerplate " << Brief(boilerplate());
2040 os <<
"Object literal with boilerplate " << Brief(boilerplate());
2046 void AllocationMemento::AllocationMementoPrint(std::ostream& os) {
2047 HeapObject::PrintHeader(os,
"AllocationMemento");
2048 os <<
"\n - allocation site: ";
2050 GetAllocationSite()->AllocationSitePrint(os);
2052 os <<
"<invalid>\n";
2057 void Script::ScriptPrint(std::ostream& os) {
2058 HeapObject::PrintHeader(os,
"Script");
2059 os <<
"\n - source: " << Brief(source());
2060 os <<
"\n - name: " << Brief(name());
2061 os <<
"\n - line_offset: " << line_offset();
2062 os <<
"\n - column_offset: " << column_offset();
2063 os <<
"\n - type: " << type();
2064 os <<
"\n - id: " << id();
2065 os <<
"\n - context data: " << Brief(context_data());
2066 os <<
"\n - compilation type: " << compilation_type();
2067 os <<
"\n - line ends: " << Brief(line_ends());
2068 if (has_eval_from_shared()) {
2069 os <<
"\n - eval from shared: " << Brief(eval_from_shared());
2072 os <<
"\n - wrapped arguments: " << Brief(wrapped_arguments());
2074 os <<
"\n - eval from position: " << eval_from_position();
2075 os <<
"\n - shared function infos: " << Brief(shared_function_infos());
2079 #ifdef V8_INTL_SUPPORT 2080 void JSV8BreakIterator::JSV8BreakIteratorPrint(std::ostream& os) {
2081 JSObjectPrintHeader(os,
this,
"JSV8BreakIterator");
2082 os <<
"\n - locale: " << Brief(locale());
2083 os <<
"\n - type: " << TypeAsString();
2084 os <<
"\n - break iterator: " << Brief(break_iterator());
2085 os <<
"\n - unicode string: " << Brief(unicode_string());
2086 os <<
"\n - bound adopt text: " << Brief(bound_adopt_text());
2087 os <<
"\n - bound first: " << Brief(bound_first());
2088 os <<
"\n - bound next: " << Brief(bound_next());
2089 os <<
"\n - bound current: " << Brief(bound_current());
2090 os <<
"\n - bound break type: " << Brief(bound_break_type());
2094 void JSCollator::JSCollatorPrint(std::ostream& os) {
2095 JSObjectPrintHeader(os,
this,
"JSCollator");
2096 os <<
"\n - icu collator: " << Brief(icu_collator());
2097 os <<
"\n - bound compare: " << Brief(bound_compare());
2098 JSObjectPrintBody(os,
this);
2101 void JSDateTimeFormat::JSDateTimeFormatPrint(std::ostream& os) {
2102 JSObjectPrintHeader(os,
this,
"JSDateTimeFormat");
2103 os <<
"\n - icu locale: " << Brief(icu_locale());
2104 os <<
"\n - icu simple date format: " << Brief(icu_simple_date_format());
2105 os <<
"\n - bound format: " << Brief(bound_format());
2106 JSObjectPrintBody(os,
this);
2109 void JSListFormat::JSListFormatPrint(std::ostream& os) {
2110 JSObjectPrintHeader(os,
this,
"JSListFormat");
2111 os <<
"\n - locale: " << Brief(locale());
2112 os <<
"\n - style: " << StyleAsString();
2113 os <<
"\n - type: " << TypeAsString();
2114 os <<
"\n - icu formatter: " << Brief(icu_formatter());
2115 JSObjectPrintBody(os,
this);
2118 void JSLocale::JSLocalePrint(std::ostream& os) {
2119 JSObjectPrintHeader(os,
this,
"JSLocale");
2120 os <<
"\n - language: " << Brief(language());
2121 os <<
"\n - script: " << Brief(script());
2122 os <<
"\n - region: " << Brief(region());
2123 os <<
"\n - baseName: " << Brief(base_name());
2124 os <<
"\n - locale: " << Brief(locale());
2125 os <<
"\n - calendar: " << Brief(calendar());
2126 os <<
"\n - caseFirst: " << CaseFirstAsString();
2127 os <<
"\n - collation: " << Brief(collation());
2128 os <<
"\n - hourCycle: " << HourCycleAsString();
2129 os <<
"\n - numeric: " << NumericAsString();
2130 os <<
"\n - numberingSystem: " << Brief(numbering_system());
2134 void JSNumberFormat::JSNumberFormatPrint(std::ostream& os) {
2135 JSObjectPrintHeader(os,
this,
"JSNumberFormat");
2136 os <<
"\n - locale: " << Brief(locale());
2137 os <<
"\n - icu_number_format: " << Brief(icu_number_format());
2138 os <<
"\n - bound_format: " << Brief(bound_format());
2139 os <<
"\n - style: " << StyleAsString();
2140 os <<
"\n - currency_display: " << CurrencyDisplayAsString();
2141 JSObjectPrintBody(os,
this);
2144 void JSPluralRules::JSPluralRulesPrint(std::ostream& os) {
2145 JSObjectPrintHeader(os,
this,
"JSPluralRules");
2146 os <<
"\n - locale: " << Brief(locale());
2147 os <<
"\n - type: " << TypeAsString();
2148 os <<
"\n - icu plural rules: " << Brief(icu_plural_rules());
2149 os <<
"\n - icu decimal format: " << Brief(icu_decimal_format());
2150 JSObjectPrintBody(os,
this);
2153 void JSRelativeTimeFormat::JSRelativeTimeFormatPrint(
2155 JSObjectPrintHeader(os,
this,
"JSRelativeTimeFormat");
2156 os <<
"\n - locale: " << Brief(locale());
2157 os <<
"\n - style: " << StyleAsString();
2158 os <<
"\n - numeric: " << NumericAsString();
2159 os <<
"\n - icu formatter: " << Brief(icu_formatter());
2163 void JSSegmentIterator::JSSegmentIteratorPrint(std::ostream& os) {
2164 JSObjectPrintHeader(os,
this,
"JSSegmentIterator");
2165 os <<
"\n - icu break iterator: " << Brief(icu_break_iterator());
2166 os <<
"\n - unicode string: " << Brief(unicode_string());
2167 os <<
"\n - granularity: " << GranularityAsString();
2171 void JSSegmenter::JSSegmenterPrint(std::ostream& os) {
2172 JSObjectPrintHeader(os,
this,
"JSSegmenter");
2173 os <<
"\n - locale: " << Brief(locale());
2174 os <<
"\n - granularity: " << GranularityAsString();
2175 os <<
"\n - lineBreakStyle: " << LineBreakStyleAsString();
2176 os <<
"\n - icu break iterator: " << Brief(icu_break_iterator());
2177 JSObjectPrintBody(os,
this);
2179 #endif // V8_INTL_SUPPORT 2182 void PrintScopeInfoList(ScopeInfo scope_info, std::ostream& os,
2183 const char* list_name,
int nof_internal_slots,
2184 int start,
int length) {
2185 if (length <= 0)
return;
2186 int end = start + length;
2187 os <<
"\n - " << list_name;
2188 if (nof_internal_slots > 0) {
2189 os <<
" " << start <<
"-" << end <<
" [internal slots]";
2192 for (
int i = nof_internal_slots; start < end; ++
i, ++start) {
2193 os <<
" - " <<
i <<
": ";
2194 String::cast(scope_info->get(start))->ShortPrint(os);
2201 void ScopeInfo::ScopeInfoPrint(std::ostream& os) {
2202 PrintHeader(os,
"ScopeInfo");
2203 if (length() == 0) {
2204 os <<
"\n - length = 0\n";
2207 int flags = Flags();
2209 os <<
"\n - parameters: " << ParameterCount();
2210 os <<
"\n - context locals : " << ContextLocalCount();
2212 os <<
"\n - scope type: " << scope_type();
2213 if (CallsSloppyEval()) os <<
"\n - sloppy eval";
2214 os <<
"\n - language mode: " << language_mode();
2215 if (is_declaration_scope()) os <<
"\n - declaration scope";
2216 if (HasReceiver()) {
2217 os <<
"\n - receiver: " << ReceiverVariableField::decode(flags);
2219 if (HasNewTarget()) os <<
"\n - needs new target";
2220 if (HasFunctionName()) {
2221 os <<
"\n - function name(" << FunctionVariableField::decode(flags)
2223 FunctionName()->ShortPrint(os);
2225 if (IsAsmModule()) os <<
"\n - asm module";
2226 if (HasSimpleParameters()) os <<
"\n - simple parameters";
2227 os <<
"\n - function kind: " << function_kind();
2228 if (HasOuterScopeInfo()) {
2229 os <<
"\n - outer scope info: " << Brief(OuterScopeInfo());
2231 if (HasFunctionName()) {
2232 os <<
"\n - function name: " << Brief(FunctionName());
2234 if (HasInferredFunctionName()) {
2235 os <<
"\n - inferred function name: " << Brief(InferredFunctionName());
2238 if (HasPositionInfo()) {
2239 os <<
"\n - start position: " << StartPosition();
2240 os <<
"\n - end position: " << EndPosition();
2242 os <<
"\n - length: " << length();
2244 PrintScopeInfoList(*
this, os,
"context slots", Context::MIN_CONTEXT_SLOTS,
2245 ContextLocalNamesIndex(), ContextLocalCount());
2251 void DebugInfo::DebugInfoPrint(std::ostream& os) {
2252 HeapObject::PrintHeader(os,
"DebugInfo");
2253 os <<
"\n - flags: " << flags();
2254 os <<
"\n - debugger_hints: " << debugger_hints();
2255 os <<
"\n - shared: " << Brief(shared());
2256 os <<
"\n - script: " << Brief(script());
2257 os <<
"\n - original bytecode array: " << Brief(original_bytecode_array());
2258 os <<
"\n - debug bytecode array: " << Brief(debug_bytecode_array());
2259 os <<
"\n - break_points: ";
2260 break_points()->FixedArrayPrint(os);
2261 os <<
"\n - coverage_info: " << Brief(coverage_info());
2265 void StackFrameInfo::StackFrameInfoPrint(std::ostream& os) {
2266 HeapObject::PrintHeader(os,
"StackFrame");
2267 os <<
"\n - line_number: " << line_number();
2268 os <<
"\n - column_number: " << column_number();
2269 os <<
"\n - script_id: " << script_id();
2270 os <<
"\n - script_name: " << Brief(script_name());
2271 os <<
"\n - script_name_or_source_url: " 2272 << Brief(script_name_or_source_url());
2273 os <<
"\n - function_name: " << Brief(function_name());
2274 os <<
"\n - is_eval: " << (is_eval() ?
"true" :
"false");
2275 os <<
"\n - is_constructor: " << (is_constructor() ?
"true" :
"false");
2279 static void PrintBitMask(std::ostream& os,
uint32_t value) {
2280 for (
int i = 0;
i < 32;
i++) {
2281 if ((
i & 7) == 0) os <<
" ";
2282 os << (((value & 1) == 0) ?
"_" :
"x");
2287 void LayoutDescriptor::Print() {
2293 void LayoutDescriptor::ShortPrint(std::ostream& os) {
2296 os << reinterpret_cast<void*>(ptr());
2302 void LayoutDescriptor::Print(std::ostream& os) {
2303 os <<
"Layout descriptor: ";
2304 if (IsFastPointerLayout()) {
2305 os <<
"<all tagged>";
2306 }
else if (IsSmi()) {
2308 PrintBitMask(os, static_cast<uint32_t>(Smi::ToInt(*
this)));
2309 }
else if (IsOddball() && IsUninitialized()) {
2310 os <<
"<uninitialized>";
2313 int num_words = number_of_layout_words();
2314 for (
int i = 0;
i < num_words;
i++) {
2315 if (
i > 0) os <<
" |";
2316 PrintBitMask(os, get_layout_word(
i));
2322 void PreParsedScopeData::PreParsedScopeDataPrint(std::ostream& os) {
2323 HeapObject::PrintHeader(os,
"PreParsedScopeData");
2324 os <<
"\n - scope_data: " << Brief(scope_data());
2325 os <<
"\n - length: " << length();
2326 for (
int i = 0;
i < length(); ++
i) {
2327 os <<
"\n - [" <<
i <<
"]: " << Brief(child_data(
i));
2332 void UncompiledDataWithoutPreParsedScope::
2333 UncompiledDataWithoutPreParsedScopePrint(std::ostream& os) {
2334 HeapObject::PrintHeader(os,
"UncompiledDataWithoutPreParsedScope");
2335 os <<
"\n - start position: " << start_position();
2336 os <<
"\n - end position: " << end_position();
2340 void UncompiledDataWithPreParsedScope::UncompiledDataWithPreParsedScopePrint(
2342 HeapObject::PrintHeader(os,
"UncompiledDataWithPreParsedScope");
2343 os <<
"\n - start position: " << start_position();
2344 os <<
"\n - end position: " << end_position();
2345 os <<
"\n - pre_parsed_scope_data: " << Brief(pre_parsed_scope_data());
2349 void InterpreterData::InterpreterDataPrint(std::ostream& os) {
2350 HeapObject::PrintHeader(os,
"InterpreterData");
2351 os <<
"\n - bytecode_array: " << Brief(bytecode_array());
2352 os <<
"\n - interpreter_trampoline: " << Brief(interpreter_trampoline());
2356 void MaybeObject::Print() {
2362 void MaybeObject::Print(std::ostream& os) {
2364 HeapObject* heap_object;
2367 }
else if (IsCleared()) {
2369 }
else if (GetHeapObjectIfWeak(&heap_object)) {
2371 heap_object->HeapObjectPrint(os);
2372 }
else if (GetHeapObjectIfStrong(&heap_object)) {
2373 heap_object->HeapObjectPrint(os);
2379 #endif // OBJECT_PRINT 2381 void HeapNumber::HeapNumberPrint(std::ostream& os) { os << value(); }
2383 void MutableHeapNumber::MutableHeapNumberPrint(std::ostream& os) {
2388 void Name::NameShortPrint() {
2389 if (this->IsString()) {
2390 PrintF(
"%s", String::cast(*this)->ToCString().get());
2392 DCHECK(this->IsSymbol());
2393 Symbol s = Symbol::cast(*
this);
2394 if (s->name()->IsUndefined()) {
2395 PrintF(
"#<%s>", s->PrivateSymbolToName());
2397 PrintF(
"<%s>", String::cast(s->name())->ToCString().get());
2403 int Name::NameShortPrint(Vector<char> str) {
2404 if (this->IsString()) {
2405 return SNPrintF(str,
"%s", String::cast(*this)->ToCString().get());
2407 DCHECK(this->IsSymbol());
2408 Symbol s = Symbol::cast(*
this);
2409 if (s->name()->IsUndefined()) {
2410 return SNPrintF(str,
"#<%s>", s->PrivateSymbolToName());
2412 return SNPrintF(str,
"<%s>", String::cast(s->name())->ToCString().get());
2417 void Map::PrintMapDetails(std::ostream& os) {
2418 DisallowHeapAllocation no_gc;
2422 os <<
"Map=" <<
reinterpret_cast<void*
>(ptr());
2425 instance_descriptors()->PrintDescriptors(os);
2428 void DescriptorArray::PrintDescriptors(std::ostream& os) {
2429 for (
int i = 0;
i < number_of_descriptors();
i++) {
2430 Name key = GetKey(
i);
2431 os <<
"\n [" <<
i <<
"]: ";
2435 key->ShortPrint(os);
2438 PrintDescriptorDetails(os,
i, PropertyDetails::kPrintFull);
2443 void DescriptorArray::PrintDescriptorDetails(std::ostream& os,
int descriptor,
2444 PropertyDetails::PrintMode mode) {
2445 PropertyDetails details = GetDetails(descriptor);
2446 details.PrintAsFastTo(os, mode);
2448 switch (details.location()) {
2450 FieldType field_type = GetFieldType(descriptor);
2451 field_type->PrintTo(os);
2455 Object* value = GetStrongValue(descriptor);
2457 if (value->IsAccessorPair()) {
2458 AccessorPair* pair = AccessorPair::cast(value);
2459 os <<
"(get: " << Brief(pair->getter())
2460 <<
", set: " << Brief(pair->setter()) <<
")";
2466 #if defined(DEBUG) || defined(OBJECT_PRINT) 2470 char* String::ToAsciiArray() {
2473 static char* buffer =
nullptr;
2474 if (buffer !=
nullptr)
delete[] buffer;
2475 buffer =
new char[length() + 1];
2476 WriteToFlat(*
this, reinterpret_cast<uint8_t*>(buffer), 0, length());
2477 buffer[length()] = 0;
2482 void TransitionsAccessor::PrintOneTransition(std::ostream& os, Name key,
2488 key->ShortPrint(os);
2491 ReadOnlyRoots roots = key->GetReadOnlyRoots();
2492 if (key == roots.nonextensible_symbol()) {
2493 os <<
"(transition to non-extensible)";
2494 }
else if (key == roots.sealed_symbol()) {
2495 os <<
"(transition to sealed)";
2496 }
else if (key == roots.frozen_symbol()) {
2497 os <<
"(transition to frozen)";
2498 }
else if (key == roots.elements_transition_symbol()) {
2499 os <<
"(transition to " << ElementsKindToString(target->elements_kind())
2501 }
else if (key == roots.strict_function_transition_symbol()) {
2502 os <<
" (transition to strict function)";
2504 DCHECK(!IsSpecialTransition(roots, key));
2505 os <<
"(transition to ";
2506 int descriptor = target->LastAdded();
2507 DescriptorArray* descriptors = target->instance_descriptors();
2508 descriptors->PrintDescriptorDetails(os, descriptor,
2509 PropertyDetails::kForTransitions);
2512 os <<
" -> " << Brief(target);
2515 void TransitionArray::PrintInternal(std::ostream& os) {
2516 int num_transitions = number_of_transitions();
2517 os <<
"Transition array #" << num_transitions <<
":";
2518 for (
int i = 0;
i < num_transitions;
i++) {
2519 Name key = GetKey(
i);
2520 Map target = GetTarget(
i);
2521 TransitionsAccessor::PrintOneTransition(os, key, target);
2523 os <<
"\n" << std::flush;
2526 void TransitionsAccessor::PrintTransitions(std::ostream& os) {
2527 switch (encoding()) {
2528 case kPrototypeInfo:
2529 case kUninitialized:
2530 case kMigrationTarget:
2533 Map target = Map::cast(raw_transitions_->GetHeapObjectAssumeWeak());
2534 Name key = GetSimpleTransitionKey(target);
2535 PrintOneTransition(os, key, target);
2538 case kFullTransitionArray:
2539 return transitions()->PrintInternal(os);
2543 void TransitionsAccessor::PrintTransitionTree() {
2545 os <<
"map= " << Brief(map_);
2546 DisallowHeapAllocation no_gc;
2547 PrintTransitionTree(os, 0, &no_gc);
2548 os <<
"\n" << std::flush;
2551 void TransitionsAccessor::PrintTransitionTree(std::ostream& os,
int level,
2552 DisallowHeapAllocation* no_gc) {
2553 ReadOnlyRoots roots = ReadOnlyRoots(isolate_);
2554 int num_transitions = NumberOfTransitions();
2555 if (num_transitions == 0)
return;
2556 for (
int i = 0;
i < num_transitions;
i++) {
2557 Name key = GetKey(
i);
2558 Map target = GetTarget(
i);
2560 <<
" " << level <<
"/" <<
i <<
":" << std::setw(level * 2 + 2) <<
" ";
2561 std::stringstream ss;
2562 ss << Brief(target);
2563 os << std::left << std::setw(50) << ss.str() <<
": ";
2565 if (key == roots.nonextensible_symbol()) {
2566 os <<
"to non-extensible";
2567 }
else if (key == roots.sealed_symbol()) {
2569 }
else if (key == roots.frozen_symbol()) {
2571 }
else if (key == roots.elements_transition_symbol()) {
2572 os <<
"to " << ElementsKindToString(target->elements_kind());
2573 }
else if (key == roots.strict_function_transition_symbol()) {
2574 os <<
"to strict function";
2579 key->ShortPrint(os);
2582 DCHECK(!IsSpecialTransition(ReadOnlyRoots(isolate_), key));
2584 int descriptor = target->LastAdded();
2585 DescriptorArray* descriptors = target->instance_descriptors();
2586 descriptors->PrintDescriptorDetails(os, descriptor,
2587 PropertyDetails::kForTransitions);
2589 TransitionsAccessor transitions(isolate_, target, no_gc);
2590 transitions.PrintTransitionTree(os, level + 1, no_gc);
2594 void JSObject::PrintTransitions(std::ostream& os) {
2595 DisallowHeapAllocation no_gc;
2596 TransitionsAccessor ta(GetIsolate(), map(), &no_gc);
2597 if (ta.NumberOfTransitions() == 0)
return;
2598 os <<
"\n - transitions";
2599 ta.PrintTransitions(os);
2602 #endif // defined(DEBUG) || defined(OBJECT_PRINT) 2609 V8_EXPORT_PRIVATE
extern void _v8_internal_Print_Object(
void*
object) {
2610 reinterpret_cast<i::Object*
>(object)->Print();
2613 V8_EXPORT_PRIVATE
extern void _v8_internal_Print_Code(
void*
object) {
2617 i::wasm::WasmCode* wasm_code =
2618 isolate->wasm_engine()->code_manager()->LookupCode(address);
2621 wasm_code->Disassemble(
nullptr, os, address);
2625 if (!isolate->heap()->InSpaceSlow(address, i::CODE_SPACE) &&
2626 !isolate->heap()->InSpaceSlow(address, i::LO_SPACE) &&
2627 !i::InstructionStream::PcIsOffHeap(isolate, address)) {
2629 "%p is not within the current isolate's large object, code or embedded " 2635 i::Code code = isolate->FindCodeObject(address);
2636 if (!code->IsCode()) {
2637 i::PrintF(
"No code object found containing %p\n",
object);
2640 #ifdef ENABLE_DISASSEMBLER 2642 code->Disassemble(
nullptr, os, address);
2643 #else // ENABLE_DISASSEMBLER 2645 #endif // ENABLE_DISASSEMBLER 2648 V8_EXPORT_PRIVATE
extern void _v8_internal_Print_LayoutDescriptor(
2651 if (!o->IsLayoutDescriptor()) {
2652 printf(
"Please provide a layout descriptor\n");
2654 i::LayoutDescriptor::cast(o)->Print();
2658 V8_EXPORT_PRIVATE
extern void _v8_internal_Print_StackTrace() {
2660 isolate->PrintStack(stdout);
2663 V8_EXPORT_PRIVATE
extern void _v8_internal_Print_TransitionTree(
void*
object) {
2666 printf(
"Please provide a valid Map\n");
2668 #if defined(DEBUG) || defined(OBJECT_PRINT) 2670 i::Map map = i::Map::unchecked_cast(o);
2672 transitions.PrintTransitionTree();