Commit 0f6092a4 authored by ishell's avatar ishell Committed by Commit bot

Objects printing improved a bit.

Review URL: https://codereview.chromium.org/1410023013

Cr-Commit-Position: refs/heads/master@{#31744}
parent 678a5583
...@@ -95,9 +95,11 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT ...@@ -95,9 +95,11 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
case JS_CONTEXT_EXTENSION_OBJECT_TYPE: case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case JS_ARRAY_TYPE: case JS_ARRAY_TYPE:
case JS_GENERATOR_OBJECT_TYPE: case JS_GENERATOR_OBJECT_TYPE:
case JS_REGEXP_TYPE:
JSObject::cast(this)->JSObjectPrint(os); JSObject::cast(this)->JSObjectPrint(os);
break; break;
case JS_REGEXP_TYPE:
JSRegExp::cast(this)->JSRegExpPrint(os);
break;
case ODDBALL_TYPE: case ODDBALL_TYPE:
Oddball::cast(this)->to_string()->Print(os); Oddball::cast(this)->to_string()->Print(os);
break; break;
...@@ -269,7 +271,7 @@ void JSObject::PrintProperties(std::ostream& os) { // NOLINT ...@@ -269,7 +271,7 @@ void JSObject::PrintProperties(std::ostream& os) { // NOLINT
if (HasFastProperties()) { if (HasFastProperties()) {
DescriptorArray* descs = map()->instance_descriptors(); DescriptorArray* descs = map()->instance_descriptors();
for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
os << " "; os << "\n ";
descs->GetKey(i)->NamePrint(os); descs->GetKey(i)->NamePrint(os);
os << ": "; os << ": ";
switch (descs->GetType(i)) { switch (descs->GetType(i)) {
...@@ -280,20 +282,19 @@ void JSObject::PrintProperties(std::ostream& os) { // NOLINT ...@@ -280,20 +282,19 @@ void JSObject::PrintProperties(std::ostream& os) { // NOLINT
} else { } else {
os << Brief(RawFastPropertyAt(index)); os << Brief(RawFastPropertyAt(index));
} }
os << " (data field at offset " << index.property_index() << ")\n"; os << " (data field at offset " << index.property_index() << ")";
break; break;
} }
case ACCESSOR: { case ACCESSOR: {
FieldIndex index = FieldIndex::ForDescriptor(map(), i); FieldIndex index = FieldIndex::ForDescriptor(map(), i);
os << " (accessor field at offset " << index.property_index() os << " (accessor field at offset " << index.property_index() << ")";
<< ")\n";
break; break;
} }
case DATA_CONSTANT: case DATA_CONSTANT:
os << Brief(descs->GetConstant(i)) << " (data constant)\n"; os << Brief(descs->GetConstant(i)) << " (data constant)";
break; break;
case ACCESSOR_CONSTANT: case ACCESSOR_CONSTANT:
os << Brief(descs->GetCallbacksObject(i)) << " (accessor constant)\n"; os << Brief(descs->GetCallbacksObject(i)) << " (accessor constant)";
break; break;
} }
} }
...@@ -309,7 +310,7 @@ template <class T> ...@@ -309,7 +310,7 @@ template <class T>
static void DoPrintElements(std::ostream& os, Object* object) { // NOLINT static void DoPrintElements(std::ostream& os, Object* object) { // NOLINT
T* p = T::cast(object); T* p = T::cast(object);
for (int i = 0; i < p->length(); i++) { for (int i = 0; i < p->length(); i++) {
os << " " << i << ": " << p->get_scalar(i) << "\n"; os << "\n " << i << ": " << p->get_scalar(i);
} }
} }
...@@ -325,7 +326,7 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT ...@@ -325,7 +326,7 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
// Print in array notation for non-sparse arrays. // Print in array notation for non-sparse arrays.
FixedArray* p = FixedArray::cast(elements()); FixedArray* p = FixedArray::cast(elements());
for (int i = 0; i < p->length(); i++) { for (int i = 0; i < p->length(); i++) {
os << " " << i << ": " << Brief(p->get(i)) << "\n"; os << "\n " << i << ": " << Brief(p->get(i));
} }
break; break;
} }
...@@ -335,13 +336,12 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT ...@@ -335,13 +336,12 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
if (elements()->length() > 0) { if (elements()->length() > 0) {
FixedDoubleArray* p = FixedDoubleArray::cast(elements()); FixedDoubleArray* p = FixedDoubleArray::cast(elements());
for (int i = 0; i < p->length(); i++) { for (int i = 0; i < p->length(); i++) {
os << " " << i << ": "; os << "\n " << i << ": ";
if (p->is_the_hole(i)) { if (p->is_the_hole(i)) {
os << "<the hole>"; os << "<the hole>";
} else { } else {
os << p->get_scalar(i); os << p->get_scalar(i);
} }
os << "\n";
} }
} }
break; break;
...@@ -372,12 +372,12 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT ...@@ -372,12 +372,12 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
case FAST_SLOPPY_ARGUMENTS_ELEMENTS: case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: {
FixedArray* p = FixedArray::cast(elements()); FixedArray* p = FixedArray::cast(elements());
os << " parameter map:"; os << "\n parameter map:";
for (int i = 2; i < p->length(); i++) { for (int i = 2; i < p->length(); i++) {
os << " " << (i - 2) << ":" << Brief(p->get(i)); os << " " << (i - 2) << ":" << Brief(p->get(i));
} }
os << "\n context: " << Brief(p->get(0)) os << "\n context: " << Brief(p->get(0))
<< "\n arguments: " << Brief(p->get(1)) << "\n"; << "\n arguments: " << Brief(p->get(1));
break; break;
} }
} }
...@@ -396,12 +396,13 @@ static void JSObjectPrintHeader(std::ostream& os, JSObject* obj, ...@@ -396,12 +396,13 @@ static void JSObjectPrintHeader(std::ostream& os, JSObject* obj,
} }
static void JSObjectPrintBody(std::ostream& os, JSObject* obj) { // NOLINT static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT
os << "\n {\n"; bool print_elements = true) {
os << "\n {";
obj->PrintProperties(os); obj->PrintProperties(os);
obj->PrintTransitions(os); obj->PrintTransitions(os);
obj->PrintElements(os); if (print_elements) obj->PrintElements(os);
os << " }\n"; os << "\n }\n";
} }
...@@ -411,16 +412,18 @@ void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT ...@@ -411,16 +412,18 @@ void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
} }
void JSRegExp::JSRegExpPrint(std::ostream& os) { // NOLINT
JSObjectPrintHeader(os, this, "JSRegExp");
os << "\n - data = " << Brief(data());
JSObjectPrintBody(os, this);
}
void JSModule::JSModulePrint(std::ostream& os) { // NOLINT void JSModule::JSModulePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSModule"); JSObjectPrintHeader(os, this, "JSModule");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n" os << "\n - context = " << Brief(context());
<< " - context = "; os << " - scope_info = " << Brief(scope_info());
context()->Print(os); JSObjectPrintBody(os, this);
os << " - scope_info = " << Brief(scope_info())
<< ElementsKindToString(this->map()->elements_kind()) << " {\n";
PrintProperties(os);
PrintElements(os);
os << " }\n";
} }
...@@ -481,9 +484,11 @@ void Map::MapPrint(std::ostream& os) { // NOLINT ...@@ -481,9 +484,11 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
if (FLAG_unbox_double_fields) { if (FLAG_unbox_double_fields) {
os << "\n - layout descriptor: " << Brief(layout_descriptor()); os << "\n - layout descriptor: " << Brief(layout_descriptor());
} }
if (TransitionArray::NumberOfTransitions(raw_transitions()) > 0) { int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions());
os << "\n - transitions: "; if (nof_transitions > 0) {
TransitionArray::PrintTransitions(os, raw_transitions()); os << "\n - transitions #" << nof_transitions << ": "
<< Brief(raw_transitions());
TransitionArray::PrintTransitions(os, raw_transitions(), false);
} }
os << "\n - prototype: " << Brief(prototype()); os << "\n - prototype: " << Brief(prototype());
os << "\n - constructor: " << Brief(GetConstructor()); os << "\n - constructor: " << Brief(GetConstructor());
...@@ -704,17 +709,15 @@ static const char* const weekdays[] = { ...@@ -704,17 +709,15 @@ static const char* const weekdays[] = {
void JSDate::JSDatePrint(std::ostream& os) { // NOLINT void JSDate::JSDatePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSDate"); JSObjectPrintHeader(os, this, "JSDate");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - value = " << Brief(value());
os << " - value = ";
value()->Print(os);
if (!year()->IsSmi()) { if (!year()->IsSmi()) {
os << " - time = NaN\n"; os << "\n - time = NaN\n";
} else { } else {
// TODO(svenpanne) Add some basic formatting to our streams. // TODO(svenpanne) Add some basic formatting to our streams.
ScopedVector<char> buf(100); ScopedVector<char> buf(100);
SNPrintF( SNPrintF(
buf, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n", buf, "\n - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
year()->IsSmi() ? Smi::cast(year())->value() : -1, year()->IsSmi() ? Smi::cast(year())->value() : -1,
month()->IsSmi() ? Smi::cast(month())->value() : -1, month()->IsSmi() ? Smi::cast(month())->value() : -1,
...@@ -724,6 +727,7 @@ void JSDate::JSDatePrint(std::ostream& os) { // NOLINT ...@@ -724,6 +727,7 @@ void JSDate::JSDatePrint(std::ostream& os) { // NOLINT
sec()->IsSmi() ? Smi::cast(sec())->value() : -1); sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
os << buf.start(); os << buf.start();
} }
JSObjectPrintBody(os, this);
} }
...@@ -752,18 +756,16 @@ void JSFunctionProxy::JSFunctionProxyPrint(std::ostream& os) { // NOLINT ...@@ -752,18 +756,16 @@ void JSFunctionProxy::JSFunctionProxyPrint(std::ostream& os) { // NOLINT
void JSSet::JSSetPrint(std::ostream& os) { // NOLINT void JSSet::JSSetPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSSet"); JSObjectPrintHeader(os, this, "JSSet");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table()); os << " - table = " << Brief(table());
os << "\n"; JSObjectPrintBody(os, this);
} }
void JSMap::JSMapPrint(std::ostream& os) { // NOLINT void JSMap::JSMapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSMap"); JSObjectPrintHeader(os, this, "JSMap");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table()); os << " - table = " << Brief(table());
os << "\n"; JSObjectPrintBody(os, this);
} }
...@@ -771,8 +773,7 @@ template <class Derived, class TableType> ...@@ -771,8 +773,7 @@ template <class Derived, class TableType>
void void
OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIteratorPrint( OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIteratorPrint(
std::ostream& os) { // NOLINT std::ostream& os) { // NOLINT
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - table = " << Brief(table());
os << " - table = " << Brief(table());
os << "\n - index = " << Brief(index()); os << "\n - index = " << Brief(index());
os << "\n - kind = " << Brief(kind()); os << "\n - kind = " << Brief(kind());
os << "\n"; os << "\n";
...@@ -790,80 +791,72 @@ template void OrderedHashTableIterator< ...@@ -790,80 +791,72 @@ template void OrderedHashTableIterator<
void JSSetIterator::JSSetIteratorPrint(std::ostream& os) { // NOLINT void JSSetIterator::JSSetIteratorPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSSetIterator"); JSObjectPrintHeader(os, this, "JSSetIterator");
OrderedHashTableIteratorPrint(os); OrderedHashTableIteratorPrint(os);
} }
void JSMapIterator::JSMapIteratorPrint(std::ostream& os) { // NOLINT void JSMapIterator::JSMapIteratorPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSMapIterator"); JSObjectPrintHeader(os, this, "JSMapIterator");
OrderedHashTableIteratorPrint(os); OrderedHashTableIteratorPrint(os);
} }
void JSIteratorResult::JSIteratorResultPrint(std::ostream& os) { // NOLINT void JSIteratorResult::JSIteratorResultPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSIteratorResult"); JSObjectPrintHeader(os, this, "JSIteratorResult");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - done = " << Brief(done());
os << " - done = " << Brief(done()) << "\n"; os << "\n - value = " << Brief(value());
os << " - value = " << Brief(value()) << "\n";
os << "\n"; os << "\n";
} }
void JSWeakMap::JSWeakMapPrint(std::ostream& os) { // NOLINT void JSWeakMap::JSWeakMapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSWeakMap"); JSObjectPrintHeader(os, this, "JSWeakMap");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - table = " << Brief(table());
os << " - table = " << Brief(table()); JSObjectPrintBody(os, this);
os << "\n";
} }
void JSWeakSet::JSWeakSetPrint(std::ostream& os) { // NOLINT void JSWeakSet::JSWeakSetPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSWeakSet"); JSObjectPrintHeader(os, this, "JSWeakSet");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - table = " << Brief(table());
os << " - table = " << Brief(table()); JSObjectPrintBody(os, this);
os << "\n";
} }
void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) { // NOLINT void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSArrayBuffer"); JSObjectPrintHeader(os, this, "JSArrayBuffer");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - backing_store = " << backing_store();
os << " - backing_store = " << backing_store() << "\n"; os << "\n - byte_length = " << Brief(byte_length());
os << " - byte_length = " << Brief(byte_length());
if (was_neutered()) os << " - neutered\n"; if (was_neutered()) os << " - neutered\n";
os << "\n"; JSObjectPrintBody(os, this, !was_neutered());
} }
void JSTypedArray::JSTypedArrayPrint(std::ostream& os) { // NOLINT void JSTypedArray::JSTypedArrayPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSTypedArray"); JSObjectPrintHeader(os, this, "JSTypedArray");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - buffer = " << Brief(buffer());
os << " - buffer = " << Brief(buffer());
os << "\n - byte_offset = " << Brief(byte_offset()); os << "\n - byte_offset = " << Brief(byte_offset());
os << "\n - byte_length = " << Brief(byte_length()); os << "\n - byte_length = " << Brief(byte_length());
os << "\n - length = " << Brief(length()); os << "\n - length = " << Brief(length());
if (WasNeutered()) os << " - neutered\n"; if (WasNeutered()) os << " - neutered\n";
os << "\n"; JSObjectPrintBody(os, this, !WasNeutered());
if (!WasNeutered()) PrintElements(os);
} }
void JSDataView::JSDataViewPrint(std::ostream& os) { // NOLINT void JSDataView::JSDataViewPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSDataView"); JSObjectPrintHeader(os, this, "JSDataView");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - buffer =" << Brief(buffer());
os << " - buffer =" << Brief(buffer());
os << "\n - byte_offset = " << Brief(byte_offset()); os << "\n - byte_offset = " << Brief(byte_offset());
os << "\n - byte_length = " << Brief(byte_length()); os << "\n - byte_length = " << Brief(byte_length());
if (WasNeutered()) os << " - neutered\n"; if (WasNeutered()) os << " - neutered\n";
os << "\n"; JSObjectPrintBody(os, this, !WasNeutered());
} }
void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Function"); JSObjectPrintHeader(os, this, "Function");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; os << "\n - initial_map = ";
os << " - initial_map = ";
if (has_initial_map()) os << Brief(initial_map()); if (has_initial_map()) os << Brief(initial_map());
os << "\n - shared_info = " << Brief(shared()); os << "\n - shared_info = " << Brief(shared());
os << "\n - name = " << Brief(shared()->name()); os << "\n - name = " << Brief(shared()->name());
...@@ -874,10 +867,7 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT ...@@ -874,10 +867,7 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
os << "\n - literals = " << Brief(literals()); os << "\n - literals = " << Brief(literals());
} }
os << "\n - code = " << Brief(code()); os << "\n - code = " << Brief(code());
os << "\n"; JSObjectPrintBody(os, this);
PrintProperties(os);
PrintElements(os);
os << "\n";
} }
...@@ -935,11 +925,16 @@ void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT ...@@ -935,11 +925,16 @@ void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT
void Cell::CellPrint(std::ostream& os) { // NOLINT void Cell::CellPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Cell"); HeapObject::PrintHeader(os, "Cell");
os << " - value: " << Brief(value());
os << "\n";
} }
void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PropertyCell"); HeapObject::PrintHeader(os, "PropertyCell");
os << " - value: " << Brief(value());
os << "\n - details: " << property_details();
os << "\n";
} }
...@@ -950,6 +945,7 @@ void WeakCell::WeakCellPrint(std::ostream& os) { // NOLINT ...@@ -950,6 +945,7 @@ void WeakCell::WeakCellPrint(std::ostream& os) { // NOLINT
} else { } else {
os << "\n - value: " << Brief(value()); os << "\n - value: " << Brief(value());
} }
os << "\n";
} }
...@@ -965,6 +961,7 @@ void Code::CodePrint(std::ostream& os) { // NOLINT ...@@ -965,6 +961,7 @@ void Code::CodePrint(std::ostream& os) { // NOLINT
void Foreign::ForeignPrint(std::ostream& os) { // NOLINT void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
os << "foreign address : " << foreign_address(); os << "foreign address : " << foreign_address();
os << "\n";
} }
...@@ -1261,11 +1258,11 @@ void DescriptorArray::Print() { ...@@ -1261,11 +1258,11 @@ void DescriptorArray::Print() {
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
HandleScope scope(GetIsolate()); HandleScope scope(GetIsolate());
os << "Descriptor array " << number_of_descriptors() << "\n"; os << "Descriptor array #" << number_of_descriptors();
for (int i = 0; i < number_of_descriptors(); i++) { for (int i = 0; i < number_of_descriptors(); i++) {
Descriptor desc; Descriptor desc;
Get(i, &desc); Get(i, &desc);
os << " " << i << ": " << desc << "\n"; os << "\n " << i << ": " << desc;
} }
os << "\n"; os << "\n";
} }
...@@ -1274,7 +1271,7 @@ void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT ...@@ -1274,7 +1271,7 @@ void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
void TransitionArray::Print() { void TransitionArray::Print() {
OFStream os(stdout); OFStream os(stdout);
TransitionArray::PrintTransitions(os, this); TransitionArray::PrintTransitions(os, this);
os << std::flush; os << "\n" << std::flush;
} }
...@@ -1282,12 +1279,12 @@ void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions, ...@@ -1282,12 +1279,12 @@ void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions,
bool print_header) { // NOLINT bool print_header) { // NOLINT
int num_transitions = NumberOfTransitions(transitions); int num_transitions = NumberOfTransitions(transitions);
if (print_header) { if (print_header) {
os << "Transition array " << num_transitions << "\n"; os << "Transition array #" << num_transitions << ":";
} }
for (int i = 0; i < num_transitions; i++) { for (int i = 0; i < num_transitions; i++) {
Name* key = GetKey(transitions, i); Name* key = GetKey(transitions, i);
Map* target = GetTarget(transitions, i); Map* target = GetTarget(transitions, i);
os << " "; os << "\n ";
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
key->NamePrint(os); key->NamePrint(os);
#else #else
...@@ -1296,19 +1293,19 @@ void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions, ...@@ -1296,19 +1293,19 @@ void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions,
os << ": "; os << ": ";
Heap* heap = key->GetHeap(); Heap* heap = key->GetHeap();
if (key == heap->nonextensible_symbol()) { if (key == heap->nonextensible_symbol()) {
os << " (transition to non-extensible)"; os << "(transition to non-extensible)";
} else if (key == heap->sealed_symbol()) { } else if (key == heap->sealed_symbol()) {
os << " (transition to sealed)"; os << "(transition to sealed)";
} else if (key == heap->frozen_symbol()) { } else if (key == heap->frozen_symbol()) {
os << " (transition to frozen)"; os << "(transition to frozen)";
} else if (key == heap->elements_transition_symbol()) { } else if (key == heap->elements_transition_symbol()) {
os << " (transition to " << ElementsKindToString(target->elements_kind()) os << "(transition to " << ElementsKindToString(target->elements_kind())
<< ")"; << ")";
} else if (key == heap->observed_symbol()) { } else if (key == heap->observed_symbol()) {
os << " (transition to Object.observe)"; os << " (transition to Object.observe)";
} else { } else {
PropertyDetails details = GetTargetDetails(key, target); PropertyDetails details = GetTargetDetails(key, target);
os << " (transition to "; os << "(transition to ";
if (details.location() == kDescriptor) { if (details.location() == kDescriptor) {
os << "immutable "; os << "immutable ";
} }
...@@ -1320,13 +1317,17 @@ void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions, ...@@ -1320,13 +1317,17 @@ void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions,
} }
os << "), attrs: " << details.attributes(); os << "), attrs: " << details.attributes();
} }
os << " -> " << Brief(target) << "\n"; os << " -> " << Brief(target);
} }
} }
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
TransitionArray::PrintTransitions(os, map()->raw_transitions()); Object* transitions = map()->raw_transitions();
int num_transitions = TransitionArray::NumberOfTransitions(transitions);
if (num_transitions == 0) return;
os << "\n - transitions";
TransitionArray::PrintTransitions(os, transitions, false);
} }
#endif // defined(DEBUG) || defined(OBJECT_PRINT) #endif // defined(DEBUG) || defined(OBJECT_PRINT)
} // namespace internal } // namespace internal
......
...@@ -1945,7 +1945,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT ...@@ -1945,7 +1945,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
StringStream accumulator(&allocator); StringStream accumulator(&allocator);
PropertyCell* cell = PropertyCell::cast(this); PropertyCell* cell = PropertyCell::cast(this);
cell->value()->ShortPrint(&accumulator); cell->value()->ShortPrint(&accumulator);
os << accumulator.ToCString().get() << " " << cell->property_details(); os << accumulator.ToCString().get();
break; break;
} }
case WEAK_CELL_TYPE: { case WEAK_CELL_TYPE: {
...@@ -14707,14 +14707,13 @@ void Dictionary<Derived, Shape, Key>::Print(std::ostream& os) { // NOLINT ...@@ -14707,14 +14707,13 @@ void Dictionary<Derived, Shape, Key>::Print(std::ostream& os) { // NOLINT
for (int i = 0; i < capacity; i++) { for (int i = 0; i < capacity; i++) {
Object* k = this->KeyAt(i); Object* k = this->KeyAt(i);
if (this->IsKey(k)) { if (this->IsKey(k)) {
os << " "; os << "\n ";
if (k->IsString()) { if (k->IsString()) {
String::cast(k)->StringPrint(os); String::cast(k)->StringPrint(os);
} else { } else {
os << Brief(k); os << Brief(k);
} }
os << ": " << Brief(this->ValueAt(i)) << " " << this->DetailsAt(i) os << ": " << Brief(this->ValueAt(i)) << " " << this->DetailsAt(i);
<< "\n";
} }
} }
} }
......
...@@ -7732,6 +7732,7 @@ class JSRegExp: public JSObject { ...@@ -7732,6 +7732,7 @@ class JSRegExp: public JSObject {
DECLARE_CAST(JSRegExp) DECLARE_CAST(JSRegExp)
// Dispatched behavior. // Dispatched behavior.
DECLARE_PRINTER(JSRegExp)
DECLARE_VERIFIER(JSRegExp) DECLARE_VERIFIER(JSRegExp)
static const int kDataOffset = JSObject::kHeaderSize; static const int kDataOffset = JSObject::kHeaderSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment