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 "src/disasm.h" | 7 #include "src/disasm.h" |
8 #include "src/disassembler.h" | 8 #include "src/disassembler.h" |
9 #include "src/interpreter/bytecodes.h" | 9 #include "src/interpreter/bytecodes.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 os << "\n - capacity: " << length(); | 571 os << "\n - capacity: " << length(); |
572 for (int i = 0; i < length(); i++) { | 572 for (int i = 0; i < length(); i++) { |
573 os << "\n [" << i << "]: " << Brief(get(i)); | 573 os << "\n [" << i << "]: " << Brief(get(i)); |
574 if (i == kNextLinkIndex) os << " (next link)"; | 574 if (i == kNextLinkIndex) os << " (next link)"; |
575 if (i == kPrototypeTransitionsIndex) os << " (prototype transitions)"; | 575 if (i == kPrototypeTransitionsIndex) os << " (prototype transitions)"; |
576 if (i == kTransitionLengthIndex) os << " (number of transitions)"; | 576 if (i == kTransitionLengthIndex) os << " (number of transitions)"; |
577 } | 577 } |
578 os << "\n"; | 578 os << "\n"; |
579 } | 579 } |
580 | 580 |
| 581 template void FeedbackVectorSpecBase<StaticFeedbackVectorSpec>::Print(); |
| 582 template void FeedbackVectorSpecBase<FeedbackVectorSpec>::Print(); |
| 583 |
| 584 template <typename Derived> |
| 585 void FeedbackVectorSpecBase<Derived>::Print() { |
| 586 OFStream os(stdout); |
| 587 FeedbackVectorSpecPrint(os); |
| 588 os << std::flush; |
| 589 } |
| 590 |
| 591 template <typename Derived> |
| 592 void FeedbackVectorSpecBase<Derived>::FeedbackVectorSpecPrint( |
| 593 std::ostream& os) { // NOLINT |
| 594 int slot_count = This()->slots(); |
| 595 os << " - slot_count: " << slot_count; |
| 596 if (slot_count == 0) { |
| 597 os << " (empty)\n"; |
| 598 return; |
| 599 } |
| 600 |
| 601 for (int slot = 0, name_index = 0; slot < slot_count;) { |
| 602 FeedbackVectorSlotKind kind = This()->GetKind(slot); |
| 603 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); |
| 604 DCHECK_LT(0, entry_size); |
| 605 |
| 606 os << "\n Slot #" << slot << " " << kind; |
| 607 if (TypeFeedbackMetadata::SlotRequiresName(kind)) { |
| 608 os << ", " << Brief(*This()->GetName(name_index++)); |
| 609 } |
| 610 |
| 611 slot += entry_size; |
| 612 } |
| 613 os << "\n"; |
| 614 } |
581 | 615 |
582 void TypeFeedbackMetadata::Print() { | 616 void TypeFeedbackMetadata::Print() { |
583 OFStream os(stdout); | 617 OFStream os(stdout); |
584 TypeFeedbackMetadataPrint(os); | 618 TypeFeedbackMetadataPrint(os); |
585 os << std::flush; | 619 os << std::flush; |
586 } | 620 } |
587 | 621 |
588 | 622 |
589 void TypeFeedbackMetadata::TypeFeedbackMetadataPrint( | 623 void TypeFeedbackMetadata::TypeFeedbackMetadataPrint( |
590 std::ostream& os) { // NOLINT | 624 std::ostream& os) { // NOLINT |
591 HeapObject::PrintHeader(os, "TypeFeedbackMetadata"); | 625 HeapObject::PrintHeader(os, "TypeFeedbackMetadata"); |
592 os << "\n - length: " << length(); | 626 os << "\n - length: " << length(); |
593 if (length() == 0) { | 627 if (length() == 0) { |
594 os << " (empty)\n"; | 628 os << " (empty)\n"; |
595 return; | 629 return; |
596 } | 630 } |
| 631 os << "\n - slot_count: " << slot_count(); |
597 | 632 |
598 TypeFeedbackMetadataIterator iter(this); | 633 TypeFeedbackMetadataIterator iter(this); |
599 while (iter.HasNext()) { | 634 while (iter.HasNext()) { |
600 FeedbackVectorSlot slot = iter.Next(); | 635 FeedbackVectorSlot slot = iter.Next(); |
601 FeedbackVectorSlotKind kind = iter.kind(); | 636 FeedbackVectorSlotKind kind = iter.kind(); |
602 os << "\n Slot " << slot << " " << kind; | 637 os << "\n Slot " << slot << " " << kind; |
| 638 if (TypeFeedbackMetadata::SlotRequiresName(kind)) { |
| 639 os << ", " << Brief(iter.name()); |
| 640 } |
603 } | 641 } |
604 os << "\n"; | 642 os << "\n"; |
605 } | 643 } |
606 | 644 |
607 | 645 |
608 void TypeFeedbackVector::Print() { | 646 void TypeFeedbackVector::Print() { |
609 OFStream os(stdout); | 647 OFStream os(stdout); |
610 TypeFeedbackVectorPrint(os); | 648 TypeFeedbackVectorPrint(os); |
611 os << std::flush; | 649 os << std::flush; |
612 } | 650 } |
613 | 651 |
614 | 652 |
615 void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { // NOLINT | 653 void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { // NOLINT |
616 HeapObject::PrintHeader(os, "TypeFeedbackVector"); | 654 HeapObject::PrintHeader(os, "TypeFeedbackVector"); |
617 os << "\n - length: " << length(); | 655 os << "\n - length: " << length(); |
618 if (length() == 0) { | 656 if (length() == 0) { |
619 os << " (empty)\n"; | 657 os << " (empty)\n"; |
620 return; | 658 return; |
621 } | 659 } |
622 | 660 |
623 TypeFeedbackMetadataIterator iter(metadata()); | 661 TypeFeedbackMetadataIterator iter(metadata()); |
624 while (iter.HasNext()) { | 662 while (iter.HasNext()) { |
625 FeedbackVectorSlot slot = iter.Next(); | 663 FeedbackVectorSlot slot = iter.Next(); |
626 FeedbackVectorSlotKind kind = iter.kind(); | 664 FeedbackVectorSlotKind kind = iter.kind(); |
627 | 665 |
628 os << "\n Slot " << slot << " " << kind << " "; | 666 os << "\n Slot " << slot << " " << kind; |
| 667 if (TypeFeedbackMetadata::SlotRequiresName(kind)) { |
| 668 os << ", " << Brief(iter.name()); |
| 669 } |
| 670 os << " "; |
629 switch (kind) { | 671 switch (kind) { |
630 case FeedbackVectorSlotKind::LOAD_IC: { | 672 case FeedbackVectorSlotKind::LOAD_IC: { |
631 LoadICNexus nexus(this, slot); | 673 LoadICNexus nexus(this, slot); |
632 os << Code::ICState2String(nexus.StateFromFeedback()); | 674 os << Code::ICState2String(nexus.StateFromFeedback()); |
633 break; | 675 break; |
634 } | 676 } |
635 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: { | 677 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: { |
636 LoadGlobalICNexus nexus(this, slot); | 678 LoadGlobalICNexus nexus(this, slot); |
637 os << Code::ICState2String(nexus.StateFromFeedback()); | 679 os << Code::ICState2String(nexus.StateFromFeedback()); |
638 break; | 680 break; |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1386 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1345 Object* transitions = map()->raw_transitions(); | 1387 Object* transitions = map()->raw_transitions(); |
1346 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | 1388 int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
1347 if (num_transitions == 0) return; | 1389 if (num_transitions == 0) return; |
1348 os << "\n - transitions"; | 1390 os << "\n - transitions"; |
1349 TransitionArray::PrintTransitions(os, transitions, false); | 1391 TransitionArray::PrintTransitions(os, transitions, false); |
1350 } | 1392 } |
1351 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1393 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1352 } // namespace internal | 1394 } // namespace internal |
1353 } // namespace v8 | 1395 } // namespace v8 |
OLD | NEW |