Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Side by Side Diff: src/objects-printer.cc

Issue 2537523002: [printing] Print properties backing store value and add a gdb macro for printing LayoutDescriptors. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/layout-descriptor.h ('k') | tools/gdbinit » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/disasm.h" 10 #include "src/disasm.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 504 }
505 os << "]"; 505 os << "]";
506 if (obj->GetInternalFieldCount() > 0) { 506 if (obj->GetInternalFieldCount() > 0) {
507 os << "\n - internal fields: " << obj->GetInternalFieldCount(); 507 os << "\n - internal fields: " << obj->GetInternalFieldCount();
508 } 508 }
509 } 509 }
510 510
511 511
512 static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT 512 static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT
513 bool print_elements = true) { 513 bool print_elements = true) {
514 os << "\n - properties = {"; 514 os << "\n - properties = " << Brief(obj->properties()) << " {";
515 obj->PrintProperties(os); 515 obj->PrintProperties(os);
516 os << "\n }\n"; 516 os << "\n }\n";
517 if (print_elements && obj->elements()->length() > 0) { 517 if (print_elements && obj->elements()->length() > 0) {
518 os << " - elements = {"; 518 os << " - elements = {";
519 obj->PrintElements(os); 519 obj->PrintElements(os);
520 os << "\n }\n"; 520 os << "\n }\n";
521 } 521 }
522 int internal_fields = obj->GetInternalFieldCount(); 522 int internal_fields = obj->GetInternalFieldCount();
523 if (internal_fields > 0) { 523 if (internal_fields > 0) {
524 os << " - internal fields = {"; 524 os << " - internal fields = {";
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (is_prototype_map()) { 590 if (is_prototype_map()) {
591 os << "\n - prototype_map"; 591 os << "\n - prototype_map";
592 os << "\n - prototype info: " << Brief(prototype_info()); 592 os << "\n - prototype info: " << Brief(prototype_info());
593 } else { 593 } else {
594 os << "\n - back pointer: " << Brief(GetBackPointer()); 594 os << "\n - back pointer: " << Brief(GetBackPointer());
595 } 595 }
596 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") 596 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "")
597 << "#" << NumberOfOwnDescriptors() << ": " 597 << "#" << NumberOfOwnDescriptors() << ": "
598 << Brief(instance_descriptors()); 598 << Brief(instance_descriptors());
599 if (FLAG_unbox_double_fields) { 599 if (FLAG_unbox_double_fields) {
600 os << "\n - layout descriptor: " << Brief(layout_descriptor()); 600 os << "\n - layout descriptor: ";
601 layout_descriptor()->ShortPrint(os);
601 } 602 }
602 int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions()); 603 int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions());
603 if (nof_transitions > 0) { 604 if (nof_transitions > 0) {
604 os << "\n - transitions #" << nof_transitions << ": " 605 os << "\n - transitions #" << nof_transitions << ": "
605 << Brief(raw_transitions()); 606 << Brief(raw_transitions());
606 TransitionArray::PrintTransitions(os, raw_transitions(), false); 607 TransitionArray::PrintTransitions(os, raw_transitions(), false);
607 } 608 }
608 os << "\n - prototype: " << Brief(prototype()); 609 os << "\n - prototype: " << Brief(prototype());
609 os << "\n - constructor: " << Brief(GetConstructor()); 610 os << "\n - constructor: " << Brief(GetConstructor());
610 os << "\n - code cache: " << Brief(code_cache()); 611 os << "\n - code cache: " << Brief(code_cache());
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 } 1443 }
1443 } 1444 }
1444 1445
1445 1446
1446 void LayoutDescriptor::Print() { 1447 void LayoutDescriptor::Print() {
1447 OFStream os(stdout); 1448 OFStream os(stdout);
1448 this->Print(os); 1449 this->Print(os);
1449 os << std::flush; 1450 os << std::flush;
1450 } 1451 }
1451 1452
1453 void LayoutDescriptor::ShortPrint(std::ostream& os) {
1454 if (IsSmi()) {
1455 os << this; // Print tagged value for easy use with "jld" gdb macro.
1456 } else {
1457 os << Brief(this);
1458 }
1459 }
1452 1460
1453 void LayoutDescriptor::Print(std::ostream& os) { // NOLINT 1461 void LayoutDescriptor::Print(std::ostream& os) { // NOLINT
1454 os << "Layout descriptor: "; 1462 os << "Layout descriptor: ";
1455 if (IsOddball() && IsUninitialized(HeapObject::cast(this)->GetIsolate())) { 1463 if (IsFastPointerLayout()) {
1456 os << "<uninitialized>";
1457 } else if (IsFastPointerLayout()) {
1458 os << "<all tagged>"; 1464 os << "<all tagged>";
1459 } else if (IsSmi()) { 1465 } else if (IsSmi()) {
1460 os << "fast"; 1466 os << "fast";
1461 PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value())); 1467 PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value()));
1468 } else if (IsOddball() &&
1469 IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
1470 os << "<uninitialized>";
1462 } else { 1471 } else {
1463 os << "slow"; 1472 os << "slow";
1464 int len = length(); 1473 int len = length();
1465 for (int i = 0; i < len; i++) { 1474 for (int i = 0; i < len; i++) {
1466 if (i > 0) os << " |"; 1475 if (i > 0) os << " |";
1467 PrintBitMask(os, get_scalar(i)); 1476 PrintBitMask(os, get_scalar(i));
1468 } 1477 }
1469 } 1478 }
1470 os << "\n"; 1479 os << "\n";
1471 } 1480 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 } 1640 }
1632 1641
1633 extern void _v8_internal_Print_DescriptorArray(void* object) { 1642 extern void _v8_internal_Print_DescriptorArray(void* object) {
1634 if (reinterpret_cast<i::Object*>(object)->IsSmi()) { 1643 if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
1635 printf("Not a descriptor array\n"); 1644 printf("Not a descriptor array\n");
1636 } else { 1645 } else {
1637 reinterpret_cast<i::DescriptorArray*>(object)->Print(); 1646 reinterpret_cast<i::DescriptorArray*>(object)->Print();
1638 } 1647 }
1639 } 1648 }
1640 1649
1650 extern void _v8_internal_Print_LayoutDescriptor(void* object) {
1651 i::Object* o = reinterpret_cast<i::Object*>(object);
1652 if (!o->IsLayoutDescriptor()) {
1653 printf("Not a layout descriptor\n");
1654 } else {
1655 reinterpret_cast<i::LayoutDescriptor*>(object)->Print();
1656 }
1657 }
1658
1641 extern void _v8_internal_Print_TransitionArray(void* object) { 1659 extern void _v8_internal_Print_TransitionArray(void* object) {
1642 if (reinterpret_cast<i::Object*>(object)->IsSmi()) { 1660 if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
1643 printf("Not a transition array\n"); 1661 printf("Not a transition array\n");
1644 } else { 1662 } else {
1645 reinterpret_cast<i::TransitionArray*>(object)->Print(); 1663 reinterpret_cast<i::TransitionArray*>(object)->Print();
1646 } 1664 }
1647 } 1665 }
1648 1666
1649 extern void _v8_internal_Print_StackTrace() { 1667 extern void _v8_internal_Print_StackTrace() {
1650 i::Isolate* isolate = i::Isolate::Current(); 1668 i::Isolate* isolate = i::Isolate::Current();
1651 isolate->PrintStack(stdout); 1669 isolate->PrintStack(stdout);
1652 } 1670 }
OLDNEW
« no previous file with comments | « src/layout-descriptor.h ('k') | tools/gdbinit » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698