Commit 46e0a8bf authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[printing] Improve DescriptorArray printing

- display enum cache
- display capacity

Change-Id: I79eed54af36b1fbb5435d96b650c0823be380e20
Reviewed-on: https://chromium-review.googlesource.com/1027874
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52804}
parent bff2672a
...@@ -115,7 +115,7 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT ...@@ -115,7 +115,7 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
BytecodeArray::cast(this)->BytecodeArrayPrint(os); BytecodeArray::cast(this)->BytecodeArrayPrint(os);
break; break;
case DESCRIPTOR_ARRAY_TYPE: case DESCRIPTOR_ARRAY_TYPE:
DescriptorArray::cast(this)->PrintDescriptors(os); DescriptorArray::cast(this)->DescriptorArrayPrint(os);
break; break;
case TRANSITION_ARRAY_TYPE: case TRANSITION_ARRAY_TYPE:
TransitionArray::cast(this)->TransitionArrayPrint(os); TransitionArray::cast(this)->TransitionArrayPrint(os);
...@@ -722,6 +722,21 @@ void Map::MapPrint(std::ostream& os) { // NOLINT ...@@ -722,6 +722,21 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
os << "\n"; os << "\n";
} }
void DescriptorArray::DescriptorArrayPrint(std::ostream& os) {
HeapObject::PrintHeader(os, "DescriptorArray");
os << "\n - capacity: " << length();
EnumCache* enum_cache = GetEnumCache();
os << "\n - enum_cache: ";
if (enum_cache->keys()->length() == 0) {
os << "empty";
} else {
os << enum_cache->keys()->length();
os << "\n - keys: " << Brief(enum_cache->keys());
os << "\n - indices: " << Brief(enum_cache->indices());
}
os << "\n - nof descriptors: " << number_of_descriptors();
PrintDescriptors(os);
}
void AliasedArgumentsEntry::AliasedArgumentsEntryPrint( void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(
std::ostream& os) { // NOLINT std::ostream& os) { // NOLINT
...@@ -1977,9 +1992,7 @@ void Map::PrintMapDetails(std::ostream& os, JSObject* holder) { ...@@ -1977,9 +1992,7 @@ void Map::PrintMapDetails(std::ostream& os, JSObject* holder) {
} }
} }
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT void DescriptorArray::PrintDescriptors(std::ostream& os) {
HandleScope scope(GetIsolate());
os << "Descriptor array #" << number_of_descriptors() << ":";
for (int i = 0; i < number_of_descriptors(); i++) { for (int i = 0; i < number_of_descriptors(); i++) {
Name* key = GetKey(i); Name* key = GetKey(i);
os << "\n [" << i << "]: "; os << "\n [" << i << "]: ";
......
...@@ -143,13 +143,14 @@ class DescriptorArray : public FixedArray { ...@@ -143,13 +143,14 @@ class DescriptorArray : public FixedArray {
static const int kEntrySize = 3; static const int kEntrySize = 3;
// Print all the descriptors. // Print all the descriptors.
void PrintDescriptors(std::ostream& os); // NOLINT void PrintDescriptors(std::ostream& os);
void PrintDescriptorDetails(std::ostream& os, int descriptor, void PrintDescriptorDetails(std::ostream& os, int descriptor,
PropertyDetails::PrintMode mode); PropertyDetails::PrintMode mode);
#if defined(DEBUG) || defined(OBJECT_PRINT) #if defined(DEBUG) || defined(OBJECT_PRINT)
// For our gdb macros, we should perhaps change these in the future. // For our gdb macros, we should perhaps change these in the future.
void Print(); void Print();
void DescriptorArrayPrint(std::ostream& os);
#endif #endif
DECL_VERIFIER(DescriptorArray) DECL_VERIFIER(DescriptorArray)
......
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