| OLD | NEW |
| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 template <typename Derived> | 679 template <typename Derived> |
| 680 void FeedbackVectorSpecBase<Derived>::FeedbackVectorSpecPrint( | 680 void FeedbackVectorSpecBase<Derived>::FeedbackVectorSpecPrint( |
| 681 std::ostream& os) { // NOLINT | 681 std::ostream& os) { // NOLINT |
| 682 int slot_count = This()->slots(); | 682 int slot_count = This()->slots(); |
| 683 os << " - slot_count: " << slot_count; | 683 os << " - slot_count: " << slot_count; |
| 684 if (slot_count == 0) { | 684 if (slot_count == 0) { |
| 685 os << " (empty)\n"; | 685 os << " (empty)\n"; |
| 686 return; | 686 return; |
| 687 } | 687 } |
| 688 | 688 |
| 689 for (int slot = 0, name_index = 0; slot < slot_count;) { | 689 for (int slot = 0; slot < slot_count;) { |
| 690 FeedbackVectorSlotKind kind = This()->GetKind(slot); | 690 FeedbackVectorSlotKind kind = This()->GetKind(slot); |
| 691 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); | 691 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); |
| 692 DCHECK_LT(0, entry_size); | 692 DCHECK_LT(0, entry_size); |
| 693 | |
| 694 os << "\n Slot #" << slot << " " << kind; | 693 os << "\n Slot #" << slot << " " << kind; |
| 695 if (TypeFeedbackMetadata::SlotRequiresName(kind)) { | |
| 696 os << ", " << Brief(*This()->GetName(name_index++)); | |
| 697 } | |
| 698 | |
| 699 slot += entry_size; | 694 slot += entry_size; |
| 700 } | 695 } |
| 701 os << "\n"; | 696 os << "\n"; |
| 702 } | 697 } |
| 703 | 698 |
| 704 void TypeFeedbackMetadata::Print() { | 699 void TypeFeedbackMetadata::Print() { |
| 705 OFStream os(stdout); | 700 OFStream os(stdout); |
| 706 TypeFeedbackMetadataPrint(os); | 701 TypeFeedbackMetadataPrint(os); |
| 707 os << std::flush; | 702 os << std::flush; |
| 708 } | 703 } |
| 709 | 704 |
| 710 | 705 |
| 711 void TypeFeedbackMetadata::TypeFeedbackMetadataPrint( | 706 void TypeFeedbackMetadata::TypeFeedbackMetadataPrint( |
| 712 std::ostream& os) { // NOLINT | 707 std::ostream& os) { // NOLINT |
| 713 HeapObject::PrintHeader(os, "TypeFeedbackMetadata"); | 708 HeapObject::PrintHeader(os, "TypeFeedbackMetadata"); |
| 714 os << "\n - length: " << length(); | 709 os << "\n - length: " << length(); |
| 715 if (length() == 0) { | 710 if (length() == 0) { |
| 716 os << " (empty)\n"; | 711 os << " (empty)\n"; |
| 717 return; | 712 return; |
| 718 } | 713 } |
| 719 os << "\n - slot_count: " << slot_count(); | 714 os << "\n - slot_count: " << slot_count(); |
| 720 | 715 |
| 721 TypeFeedbackMetadataIterator iter(this); | 716 TypeFeedbackMetadataIterator iter(this); |
| 722 while (iter.HasNext()) { | 717 while (iter.HasNext()) { |
| 723 FeedbackVectorSlot slot = iter.Next(); | 718 FeedbackVectorSlot slot = iter.Next(); |
| 724 FeedbackVectorSlotKind kind = iter.kind(); | 719 FeedbackVectorSlotKind kind = iter.kind(); |
| 725 os << "\n Slot " << slot << " " << kind; | 720 os << "\n Slot " << slot << " " << kind; |
| 726 if (TypeFeedbackMetadata::SlotRequiresName(kind)) { | |
| 727 os << ", " << Brief(iter.name()); | |
| 728 } | |
| 729 } | 721 } |
| 730 os << "\n"; | 722 os << "\n"; |
| 731 } | 723 } |
| 732 | 724 |
| 733 | 725 |
| 734 void TypeFeedbackVector::Print() { | 726 void TypeFeedbackVector::Print() { |
| 735 OFStream os(stdout); | 727 OFStream os(stdout); |
| 736 TypeFeedbackVectorPrint(os); | 728 TypeFeedbackVectorPrint(os); |
| 737 os << std::flush; | 729 os << std::flush; |
| 738 } | 730 } |
| 739 | 731 |
| 740 | 732 |
| 741 void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { // NOLINT | 733 void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { // NOLINT |
| 742 HeapObject::PrintHeader(os, "TypeFeedbackVector"); | 734 HeapObject::PrintHeader(os, "TypeFeedbackVector"); |
| 743 os << "\n - length: " << length(); | 735 os << "\n - length: " << length(); |
| 744 if (length() == 0) { | 736 if (length() == 0) { |
| 745 os << " (empty)\n"; | 737 os << " (empty)\n"; |
| 746 return; | 738 return; |
| 747 } | 739 } |
| 748 | 740 |
| 749 TypeFeedbackMetadataIterator iter(metadata()); | 741 TypeFeedbackMetadataIterator iter(metadata()); |
| 750 while (iter.HasNext()) { | 742 while (iter.HasNext()) { |
| 751 FeedbackVectorSlot slot = iter.Next(); | 743 FeedbackVectorSlot slot = iter.Next(); |
| 752 FeedbackVectorSlotKind kind = iter.kind(); | 744 FeedbackVectorSlotKind kind = iter.kind(); |
| 753 | 745 |
| 754 os << "\n Slot " << slot << " " << kind; | 746 os << "\n Slot " << slot << " " << kind; |
| 755 if (TypeFeedbackMetadata::SlotRequiresName(kind)) { | |
| 756 os << ", " << Brief(iter.name()); | |
| 757 } | |
| 758 os << " "; | 747 os << " "; |
| 759 switch (kind) { | 748 switch (kind) { |
| 760 case FeedbackVectorSlotKind::LOAD_IC: { | 749 case FeedbackVectorSlotKind::LOAD_IC: { |
| 761 LoadICNexus nexus(this, slot); | 750 LoadICNexus nexus(this, slot); |
| 762 os << Code::ICState2String(nexus.StateFromFeedback()); | 751 os << Code::ICState2String(nexus.StateFromFeedback()); |
| 763 break; | 752 break; |
| 764 } | 753 } |
| 765 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: { | 754 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: { |
| 766 LoadGlobalICNexus nexus(this, slot); | 755 LoadGlobalICNexus nexus(this, slot); |
| 767 os << Code::ICState2String(nexus.StateFromFeedback()); | 756 os << Code::ICState2String(nexus.StateFromFeedback()); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 printf("Not a transition array\n"); | 1643 printf("Not a transition array\n"); |
| 1655 } else { | 1644 } else { |
| 1656 reinterpret_cast<i::TransitionArray*>(object)->Print(); | 1645 reinterpret_cast<i::TransitionArray*>(object)->Print(); |
| 1657 } | 1646 } |
| 1658 } | 1647 } |
| 1659 | 1648 |
| 1660 extern void _v8_internal_Print_StackTrace() { | 1649 extern void _v8_internal_Print_StackTrace() { |
| 1661 i::Isolate* isolate = i::Isolate::Current(); | 1650 i::Isolate* isolate = i::Isolate::Current(); |
| 1662 isolate->PrintStack(stdout); | 1651 isolate->PrintStack(stdout); |
| 1663 } | 1652 } |
| OLD | NEW |