[printing] Print properties backing store value and add a gdb macro for printing LayoutDescriptors.

BUG=

Review-Url: https://codereview.chromium.org/2537523002
Cr-Commit-Position: refs/heads/master@{#41326}
This commit is contained in:
ishell 2016-11-28 11:27:52 -08:00 committed by Commit bot
parent 1c1122978f
commit 6fdd480ed4
3 changed files with 33 additions and 5 deletions

View File

@ -83,6 +83,7 @@ class LayoutDescriptor : public FixedTypedArray<Uint32ArrayTraits> {
// For our gdb macros, we should perhaps change these in the future.
void Print();
void ShortPrint(std::ostream& os);
void Print(std::ostream& os); // NOLINT
#endif

View File

@ -511,7 +511,7 @@ static void JSObjectPrintHeader(std::ostream& os, JSObject* obj,
static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT
bool print_elements = true) {
os << "\n - properties = {";
os << "\n - properties = " << Brief(obj->properties()) << " {";
obj->PrintProperties(os);
os << "\n }\n";
if (print_elements && obj->elements()->length() > 0) {
@ -597,7 +597,8 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
<< "#" << NumberOfOwnDescriptors() << ": "
<< Brief(instance_descriptors());
if (FLAG_unbox_double_fields) {
os << "\n - layout descriptor: " << Brief(layout_descriptor());
os << "\n - layout descriptor: ";
layout_descriptor()->ShortPrint(os);
}
int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions());
if (nof_transitions > 0) {
@ -1449,16 +1450,24 @@ void LayoutDescriptor::Print() {
os << std::flush;
}
void LayoutDescriptor::ShortPrint(std::ostream& os) {
if (IsSmi()) {
os << this; // Print tagged value for easy use with "jld" gdb macro.
} else {
os << Brief(this);
}
}
void LayoutDescriptor::Print(std::ostream& os) { // NOLINT
os << "Layout descriptor: ";
if (IsOddball() && IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
os << "<uninitialized>";
} else if (IsFastPointerLayout()) {
if (IsFastPointerLayout()) {
os << "<all tagged>";
} else if (IsSmi()) {
os << "fast";
PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value()));
} else if (IsOddball() &&
IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
os << "<uninitialized>";
} else {
os << "slow";
int len = length();
@ -1638,6 +1647,15 @@ extern void _v8_internal_Print_DescriptorArray(void* object) {
}
}
extern void _v8_internal_Print_LayoutDescriptor(void* object) {
i::Object* o = reinterpret_cast<i::Object*>(object);
if (!o->IsLayoutDescriptor()) {
printf("Not a layout descriptor\n");
} else {
reinterpret_cast<i::LayoutDescriptor*>(object)->Print();
}
}
extern void _v8_internal_Print_TransitionArray(void* object) {
if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
printf("Not a transition array\n");

View File

@ -38,6 +38,15 @@ Print a v8 DescriptorArray object
Usage: jda tagged_ptr
end
# Print LayoutDescriptor.
define jld
call _v8_internal_Print_LayoutDescriptor((void*)($arg0))
end
document jld
Print a v8 LayoutDescriptor object
Usage: jld tagged_ptr
end
# Print TransitionArray.
define jta
call _v8_internal_Print_TransitionArray((void*)($arg0))