Commit 3fdf554c authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[printing] Improve Map printing

- Only show ElementsKind for JSObject Maps
- Display non-variable instance-size for non-JSObject Maps

Change-Id: I224b6ca2985f9c51635cc44ab5faa4cb977695ba
Reviewed-on: https://chromium-review.googlesource.com/946489
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51744}
parent bca72425
......@@ -591,7 +591,12 @@ void Symbol::SymbolPrint(std::ostream& os) { // NOLINT
void Map::MapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Map");
os << "\n - type: " << instance_type();
os << "\n - instance size: " << instance_size();
os << "\n - instance size: ";
if (instance_size() == kVariableSizeSentinel) {
os << "variable";
} else {
os << instance_size();
}
if (IsJSObjectMap()) {
os << "\n - inobject properties: " << GetInObjectProperties();
}
......
......@@ -3246,10 +3246,16 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
return;
}
switch (map()->instance_type()) {
case MAP_TYPE:
os << "<Map(" << ElementsKindToString(Map::cast(this)->elements_kind())
<< ")>";
break;
case MAP_TYPE: {
os << "<Map";
Map* mapInstance = Map::cast(this);
if (mapInstance->IsJSObjectMap()) {
os << "(" << ElementsKindToString(mapInstance->elements_kind()) << ")";
} else if (mapInstance->instance_size() != kVariableSizeSentinel) {
os << "[" << mapInstance->instance_size() << "]";
}
os << ">";
} break;
case HASH_TABLE_TYPE:
os << "<HashTable[" << FixedArray::cast(this)->length() << "]>";
break;
......
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