Commit 6fdd480e authored by ishell's avatar ishell Committed by Commit bot

[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}
parent 1c112297
...@@ -83,6 +83,7 @@ class LayoutDescriptor : public FixedTypedArray<Uint32ArrayTraits> { ...@@ -83,6 +83,7 @@ class LayoutDescriptor : public FixedTypedArray<Uint32ArrayTraits> {
// 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 ShortPrint(std::ostream& os);
void Print(std::ostream& os); // NOLINT void Print(std::ostream& os); // NOLINT
#endif #endif
......
...@@ -511,7 +511,7 @@ static void JSObjectPrintHeader(std::ostream& os, JSObject* obj, ...@@ -511,7 +511,7 @@ 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
bool print_elements = true) { bool print_elements = true) {
os << "\n - properties = {"; os << "\n - properties = " << Brief(obj->properties()) << " {";
obj->PrintProperties(os); obj->PrintProperties(os);
os << "\n }\n"; os << "\n }\n";
if (print_elements && obj->elements()->length() > 0) { if (print_elements && obj->elements()->length() > 0) {
...@@ -597,7 +597,8 @@ void Map::MapPrint(std::ostream& os) { // NOLINT ...@@ -597,7 +597,8 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
<< "#" << NumberOfOwnDescriptors() << ": " << "#" << NumberOfOwnDescriptors() << ": "
<< Brief(instance_descriptors()); << Brief(instance_descriptors());
if (FLAG_unbox_double_fields) { 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()); int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions());
if (nof_transitions > 0) { if (nof_transitions > 0) {
...@@ -1449,16 +1450,24 @@ void LayoutDescriptor::Print() { ...@@ -1449,16 +1450,24 @@ void LayoutDescriptor::Print() {
os << std::flush; 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 void LayoutDescriptor::Print(std::ostream& os) { // NOLINT
os << "Layout descriptor: "; os << "Layout descriptor: ";
if (IsOddball() && IsUninitialized(HeapObject::cast(this)->GetIsolate())) { if (IsFastPointerLayout()) {
os << "<uninitialized>";
} else if (IsFastPointerLayout()) {
os << "<all tagged>"; os << "<all tagged>";
} else if (IsSmi()) { } else if (IsSmi()) {
os << "fast"; os << "fast";
PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value())); PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value()));
} else if (IsOddball() &&
IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
os << "<uninitialized>";
} else { } else {
os << "slow"; os << "slow";
int len = length(); int len = length();
...@@ -1638,6 +1647,15 @@ extern void _v8_internal_Print_DescriptorArray(void* object) { ...@@ -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) { extern void _v8_internal_Print_TransitionArray(void* object) {
if (reinterpret_cast<i::Object*>(object)->IsSmi()) { if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
printf("Not a transition array\n"); printf("Not a transition array\n");
......
...@@ -38,6 +38,15 @@ Print a v8 DescriptorArray object ...@@ -38,6 +38,15 @@ Print a v8 DescriptorArray object
Usage: jda tagged_ptr Usage: jda tagged_ptr
end 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. # Print TransitionArray.
define jta define jta
call _v8_internal_Print_TransitionArray((void*)($arg0)) call _v8_internal_Print_TransitionArray((void*)($arg0))
......
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