| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 kHidden = v8::HeapGraphEdge::kHidden, | 457 kHidden = v8::HeapGraphEdge::kHidden, |
| 458 kShortcut = v8::HeapGraphEdge::kShortcut, | 458 kShortcut = v8::HeapGraphEdge::kShortcut, |
| 459 kWeak = v8::HeapGraphEdge::kWeak | 459 kWeak = v8::HeapGraphEdge::kWeak |
| 460 }; | 460 }; |
| 461 | 461 |
| 462 HeapGraphEdge() { } | 462 HeapGraphEdge() { } |
| 463 void Init(int child_index, Type type, const char* name, HeapEntry* to); | 463 void Init(int child_index, Type type, const char* name, HeapEntry* to); |
| 464 void Init(int child_index, Type type, int index, HeapEntry* to); | 464 void Init(int child_index, Type type, int index, HeapEntry* to); |
| 465 void Init(int child_index, int index, HeapEntry* to); | 465 void Init(int child_index, int index, HeapEntry* to); |
| 466 | 466 |
| 467 Type type() { return static_cast<Type>(type_); } | 467 Type type() const { return static_cast<Type>(type_); } |
| 468 int index() { | 468 int index() const { |
| 469 ASSERT(type_ == kElement || type_ == kHidden || type_ == kWeak); | 469 ASSERT(type_ == kElement || type_ == kHidden || type_ == kWeak); |
| 470 return index_; | 470 return index_; |
| 471 } | 471 } |
| 472 const char* name() { | 472 const char* name() const { |
| 473 ASSERT(type_ == kContextVariable | 473 ASSERT(type_ == kContextVariable |
| 474 || type_ == kProperty | 474 || type_ == kProperty |
| 475 || type_ == kInternal | 475 || type_ == kInternal |
| 476 || type_ == kShortcut); | 476 || type_ == kShortcut); |
| 477 return name_; | 477 return name_; |
| 478 } | 478 } |
| 479 HeapEntry* to() { return to_; } | 479 HeapEntry* to() const { return to_; } |
| 480 | 480 INLINE(HeapEntry* from() const); |
| 481 HeapEntry* From(); | |
| 482 | 481 |
| 483 private: | 482 private: |
| 484 int child_index_ : 29; | 483 int child_index_ : 29; |
| 485 unsigned type_ : 3; | 484 unsigned type_ : 3; |
| 486 union { | 485 union { |
| 487 int index_; | 486 int index_; |
| 488 const char* name_; | 487 const char* name_; |
| 489 }; | 488 }; |
| 490 HeapEntry* to_; | 489 HeapEntry* to_; |
| 491 | 490 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 Vector<HeapGraphEdge*> retainers() { | 556 Vector<HeapGraphEdge*> retainers() { |
| 558 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } | 557 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } |
| 559 HeapEntry* dominator() { return dominator_; } | 558 HeapEntry* dominator() { return dominator_; } |
| 560 void set_dominator(HeapEntry* entry) { | 559 void set_dominator(HeapEntry* entry) { |
| 561 ASSERT(entry != NULL); | 560 ASSERT(entry != NULL); |
| 562 dominator_ = entry; | 561 dominator_ = entry; |
| 563 } | 562 } |
| 564 void clear_paint() { painted_ = false; } | 563 void clear_paint() { painted_ = false; } |
| 565 bool painted() { return painted_; } | 564 bool painted() { return painted_; } |
| 566 void paint() { painted_ = true; } | 565 void paint() { painted_ = true; } |
| 566 bool reachable_from_window() { return reachable_from_window_; } |
| 567 void set_reachable_from_window() { reachable_from_window_ = true; } |
| 567 | 568 |
| 568 void SetIndexedReference(HeapGraphEdge::Type type, | 569 void SetIndexedReference(HeapGraphEdge::Type type, |
| 569 int child_index, | 570 int child_index, |
| 570 int index, | 571 int index, |
| 571 HeapEntry* entry, | 572 HeapEntry* entry, |
| 572 int retainer_index); | 573 int retainer_index); |
| 573 void SetNamedReference(HeapGraphEdge::Type type, | 574 void SetNamedReference(HeapGraphEdge::Type type, |
| 574 int child_index, | 575 int child_index, |
| 575 const char* name, | 576 const char* name, |
| 576 HeapEntry* entry, | 577 HeapEntry* entry, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 593 private: | 594 private: |
| 594 HeapGraphEdge* children_arr() { | 595 HeapGraphEdge* children_arr() { |
| 595 return reinterpret_cast<HeapGraphEdge*>(this + 1); | 596 return reinterpret_cast<HeapGraphEdge*>(this + 1); |
| 596 } | 597 } |
| 597 HeapGraphEdge** retainers_arr() { | 598 HeapGraphEdge** retainers_arr() { |
| 598 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); | 599 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); |
| 599 } | 600 } |
| 600 const char* TypeAsString(); | 601 const char* TypeAsString(); |
| 601 | 602 |
| 602 unsigned painted_: 1; | 603 unsigned painted_: 1; |
| 604 unsigned reachable_from_window_: 1; |
| 603 unsigned type_: 4; | 605 unsigned type_: 4; |
| 604 int children_count_: 27; | 606 int children_count_: 26; |
| 605 int retainers_count_; | 607 int retainers_count_; |
| 606 int self_size_; | 608 int self_size_; |
| 607 union { | 609 union { |
| 608 int ordered_index_; // Used during dominator tree building. | 610 int ordered_index_; // Used during dominator tree building. |
| 609 int retained_size_; // At that moment, there is no retained size yet. | 611 int retained_size_; // At that moment, there is no retained size yet. |
| 610 }; | 612 }; |
| 611 int entry_index_; | 613 int entry_index_; |
| 612 SnapshotObjectId id_; | 614 SnapshotObjectId id_; |
| 613 HeapEntry* dominator_; | 615 HeapEntry* dominator_; |
| 614 HeapSnapshot* snapshot_; | 616 HeapSnapshot* snapshot_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 641 HeapSnapshotsCollection* collection() { return collection_; } | 643 HeapSnapshotsCollection* collection() { return collection_; } |
| 642 Type type() { return type_; } | 644 Type type() { return type_; } |
| 643 const char* title() { return title_; } | 645 const char* title() { return title_; } |
| 644 unsigned uid() { return uid_; } | 646 unsigned uid() { return uid_; } |
| 645 HeapEntry* root() { return root_entry_; } | 647 HeapEntry* root() { return root_entry_; } |
| 646 HeapEntry* gc_roots() { return gc_roots_entry_; } | 648 HeapEntry* gc_roots() { return gc_roots_entry_; } |
| 647 HeapEntry* natives_root() { return natives_root_entry_; } | 649 HeapEntry* natives_root() { return natives_root_entry_; } |
| 648 HeapEntry* gc_subroot(int index) { return gc_subroot_entries_[index]; } | 650 HeapEntry* gc_subroot(int index) { return gc_subroot_entries_[index]; } |
| 649 List<HeapEntry*>* entries() { return &entries_; } | 651 List<HeapEntry*>* entries() { return &entries_; } |
| 650 size_t raw_entries_size() { return raw_entries_size_; } | 652 size_t raw_entries_size() { return raw_entries_size_; } |
| 653 int number_of_edges() { return number_of_edges_; } |
| 651 void RememberLastJSObjectId(); | 654 void RememberLastJSObjectId(); |
| 652 SnapshotObjectId max_snapshot_js_object_id() const { | 655 SnapshotObjectId max_snapshot_js_object_id() const { |
| 653 return max_snapshot_js_object_id_; | 656 return max_snapshot_js_object_id_; |
| 654 } | 657 } |
| 655 | 658 |
| 656 void AllocateEntries( | 659 void AllocateEntries( |
| 657 int entries_count, int children_count, int retainers_count); | 660 int entries_count, int children_count, int retainers_count); |
| 658 HeapEntry* AddEntry(HeapEntry::Type type, | 661 HeapEntry* AddEntry(HeapEntry::Type type, |
| 659 const char* name, | 662 const char* name, |
| 660 SnapshotObjectId id, | 663 SnapshotObjectId id, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 683 const char* title_; | 686 const char* title_; |
| 684 unsigned uid_; | 687 unsigned uid_; |
| 685 HeapEntry* root_entry_; | 688 HeapEntry* root_entry_; |
| 686 HeapEntry* gc_roots_entry_; | 689 HeapEntry* gc_roots_entry_; |
| 687 HeapEntry* natives_root_entry_; | 690 HeapEntry* natives_root_entry_; |
| 688 HeapEntry* gc_subroot_entries_[VisitorSynchronization::kNumberOfSyncTags]; | 691 HeapEntry* gc_subroot_entries_[VisitorSynchronization::kNumberOfSyncTags]; |
| 689 char* raw_entries_; | 692 char* raw_entries_; |
| 690 List<HeapEntry*> entries_; | 693 List<HeapEntry*> entries_; |
| 691 List<HeapEntry*> sorted_entries_; | 694 List<HeapEntry*> sorted_entries_; |
| 692 size_t raw_entries_size_; | 695 size_t raw_entries_size_; |
| 696 int number_of_edges_; |
| 693 SnapshotObjectId max_snapshot_js_object_id_; | 697 SnapshotObjectId max_snapshot_js_object_id_; |
| 694 | 698 |
| 695 friend class HeapSnapshotTester; | 699 friend class HeapSnapshotTester; |
| 696 | 700 |
| 697 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); | 701 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); |
| 698 }; | 702 }; |
| 699 | 703 |
| 700 | 704 |
| 701 class HeapObjectsMap { | 705 class HeapObjectsMap { |
| 702 public: | 706 public: |
| 703 HeapObjectsMap(); | 707 HeapObjectsMap(); |
| 704 ~HeapObjectsMap(); | |
| 705 | 708 |
| 706 void SnapshotGenerationFinished(); | 709 void SnapshotGenerationFinished(); |
| 707 SnapshotObjectId FindObject(Address addr); | 710 SnapshotObjectId FindEntry(Address addr); |
| 711 SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size); |
| 708 void MoveObject(Address from, Address to); | 712 void MoveObject(Address from, Address to); |
| 709 SnapshotObjectId last_assigned_id() const { | 713 SnapshotObjectId last_assigned_id() const { |
| 710 return next_id_ - kObjectIdStep; | 714 return next_id_ - kObjectIdStep; |
| 711 } | 715 } |
| 712 | 716 |
| 713 void StopHeapObjectsTracking(); | 717 void StopHeapObjectsTracking(); |
| 714 void PushHeapObjectsStats(OutputStream* stream); | 718 void PushHeapObjectsStats(OutputStream* stream); |
| 715 | 719 |
| 716 static SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info); | 720 static SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info); |
| 717 static inline SnapshotObjectId GetNthGcSubrootId(int delta); | 721 static inline SnapshotObjectId GetNthGcSubrootId(int delta); |
| 718 | 722 |
| 719 static const int kObjectIdStep = 2; | 723 static const int kObjectIdStep = 2; |
| 720 static const SnapshotObjectId kInternalRootObjectId; | 724 static const SnapshotObjectId kInternalRootObjectId; |
| 721 static const SnapshotObjectId kGcRootsObjectId; | 725 static const SnapshotObjectId kGcRootsObjectId; |
| 722 static const SnapshotObjectId kNativesRootObjectId; | 726 static const SnapshotObjectId kNativesRootObjectId; |
| 723 static const SnapshotObjectId kGcRootsFirstSubrootId; | 727 static const SnapshotObjectId kGcRootsFirstSubrootId; |
| 724 static const SnapshotObjectId kFirstAvailableObjectId; | 728 static const SnapshotObjectId kFirstAvailableObjectId; |
| 725 | 729 |
| 726 private: | 730 private: |
| 727 struct EntryInfo { | 731 struct EntryInfo { |
| 728 EntryInfo(SnapshotObjectId id, Address addr) | 732 EntryInfo(SnapshotObjectId id, Address addr, unsigned int size) |
| 729 : id(id), addr(addr), accessed(true) { } | 733 : id(id), addr(addr), size(size), accessed(true) { } |
| 730 EntryInfo(SnapshotObjectId id, Address addr, bool accessed) | 734 EntryInfo(SnapshotObjectId id, Address addr, unsigned int size, bool accessed) |
| 731 : id(id), addr(addr), accessed(accessed) { } | 735 : id(id), addr(addr), size(size), accessed(accessed) { } |
| 732 SnapshotObjectId id; | 736 SnapshotObjectId id; |
| 733 Address addr; | 737 Address addr; |
| 738 unsigned int size; |
| 734 bool accessed; | 739 bool accessed; |
| 735 }; | 740 }; |
| 736 struct TimeInterval { | 741 struct TimeInterval { |
| 737 explicit TimeInterval(SnapshotObjectId id) : id(id), count(0) { } | 742 explicit TimeInterval(SnapshotObjectId id) : id(id), size(0), count(0) { } |
| 738 SnapshotObjectId id; | 743 SnapshotObjectId id; |
| 744 unsigned int size; |
| 739 uint32_t count; | 745 uint32_t count; |
| 740 }; | 746 }; |
| 741 | 747 |
| 742 void AddEntry(Address addr, SnapshotObjectId id); | |
| 743 SnapshotObjectId FindEntry(Address addr); | |
| 744 SnapshotObjectId FindOrAddEntry(Address addr); | |
| 745 void UpdateHeapObjectsMap(); | 748 void UpdateHeapObjectsMap(); |
| 746 void RemoveDeadEntries(); | 749 void RemoveDeadEntries(); |
| 747 | 750 |
| 748 static bool AddressesMatch(void* key1, void* key2) { | 751 static bool AddressesMatch(void* key1, void* key2) { |
| 749 return key1 == key2; | 752 return key1 == key2; |
| 750 } | 753 } |
| 751 | 754 |
| 752 static uint32_t AddressHash(Address addr) { | 755 static uint32_t AddressHash(Address addr) { |
| 753 return ComputeIntegerHash( | 756 return ComputeIntegerHash( |
| 754 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)), | 757 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)), |
| 755 v8::internal::kZeroHashSeed); | 758 v8::internal::kZeroHashSeed); |
| 756 } | 759 } |
| 757 | 760 |
| 758 bool initial_fill_mode_; | |
| 759 SnapshotObjectId next_id_; | 761 SnapshotObjectId next_id_; |
| 760 HashMap entries_map_; | 762 HashMap entries_map_; |
| 761 List<EntryInfo>* entries_; | 763 List<EntryInfo> entries_; |
| 762 List<TimeInterval> time_intervals_; | 764 List<TimeInterval> time_intervals_; |
| 763 | 765 |
| 764 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); | 766 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); |
| 765 }; | 767 }; |
| 766 | 768 |
| 767 | 769 |
| 768 class HeapSnapshotsCollection { | 770 class HeapSnapshotsCollection { |
| 769 public: | 771 public: |
| 770 HeapSnapshotsCollection(); | 772 HeapSnapshotsCollection(); |
| 771 ~HeapSnapshotsCollection(); | 773 ~HeapSnapshotsCollection(); |
| 772 | 774 |
| 773 bool is_tracking_objects() { return is_tracking_objects_; } | 775 bool is_tracking_objects() { return is_tracking_objects_; } |
| 774 void PushHeapObjectsStats(OutputStream* stream) { | 776 void PushHeapObjectsStats(OutputStream* stream) { |
| 775 return ids_.PushHeapObjectsStats(stream); | 777 return ids_.PushHeapObjectsStats(stream); |
| 776 } | 778 } |
| 777 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } | 779 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } |
| 778 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } | 780 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } |
| 779 | 781 |
| 780 HeapSnapshot* NewSnapshot( | 782 HeapSnapshot* NewSnapshot( |
| 781 HeapSnapshot::Type type, const char* name, unsigned uid); | 783 HeapSnapshot::Type type, const char* name, unsigned uid); |
| 782 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 784 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
| 783 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 785 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
| 784 HeapSnapshot* GetSnapshot(unsigned uid); | 786 HeapSnapshot* GetSnapshot(unsigned uid); |
| 785 void RemoveSnapshot(HeapSnapshot* snapshot); | 787 void RemoveSnapshot(HeapSnapshot* snapshot); |
| 786 | 788 |
| 787 StringsStorage* names() { return &names_; } | 789 StringsStorage* names() { return &names_; } |
| 788 TokenEnumerator* token_enumerator() { return token_enumerator_; } | 790 TokenEnumerator* token_enumerator() { return token_enumerator_; } |
| 789 | 791 |
| 790 SnapshotObjectId GetObjectId(Address addr) { return ids_.FindObject(addr); } | 792 SnapshotObjectId FindObjectId(Address object_addr) { |
| 793 return ids_.FindEntry(object_addr); |
| 794 } |
| 795 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { |
| 796 return ids_.FindOrAddEntry(object_addr, object_size); |
| 797 } |
| 791 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); | 798 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); |
| 792 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 799 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
| 793 SnapshotObjectId last_assigned_id() const { | 800 SnapshotObjectId last_assigned_id() const { |
| 794 return ids_.last_assigned_id(); | 801 return ids_.last_assigned_id(); |
| 795 } | 802 } |
| 796 | 803 |
| 797 private: | 804 private: |
| 798 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { | 805 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { |
| 799 return key1 == key2; | 806 return key1 == key2; |
| 800 } | 807 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 void SetPropertyReference(HeapObject* parent_obj, | 1013 void SetPropertyReference(HeapObject* parent_obj, |
| 1007 HeapEntry* parent, | 1014 HeapEntry* parent, |
| 1008 String* reference_name, | 1015 String* reference_name, |
| 1009 Object* child, | 1016 Object* child, |
| 1010 const char* name_format_string = NULL, | 1017 const char* name_format_string = NULL, |
| 1011 int field_offset = -1); | 1018 int field_offset = -1); |
| 1012 void SetPropertyShortcutReference(HeapObject* parent_obj, | 1019 void SetPropertyShortcutReference(HeapObject* parent_obj, |
| 1013 HeapEntry* parent, | 1020 HeapEntry* parent, |
| 1014 String* reference_name, | 1021 String* reference_name, |
| 1015 Object* child); | 1022 Object* child); |
| 1016 void SetRootShortcutReference(Object* child); | 1023 void SetWindowReference(Object* window); |
| 1017 void SetRootGcRootsReference(); | 1024 void SetRootGcRootsReference(); |
| 1018 void SetGcRootsReference(VisitorSynchronization::SyncTag tag); | 1025 void SetGcRootsReference(VisitorSynchronization::SyncTag tag); |
| 1019 void SetGcSubrootReference( | 1026 void SetGcSubrootReference( |
| 1020 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child); | 1027 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child); |
| 1021 void SetObjectName(HeapObject* object); | 1028 void SetObjectName(HeapObject* object); |
| 1022 void TagObject(Object* obj, const char* tag); | 1029 void TagObject(Object* obj, const char* tag); |
| 1023 | 1030 |
| 1024 HeapEntry* GetEntry(Object* obj); | 1031 HeapEntry* GetEntry(Object* obj); |
| 1025 | 1032 |
| 1026 static inline HeapObject* GetNthGcSubrootObject(int delta); | 1033 static inline HeapObject* GetNthGcSubrootObject(int delta); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1117 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
| 1111 v8::ActivityControl* control); | 1118 v8::ActivityControl* control); |
| 1112 bool GenerateSnapshot(); | 1119 bool GenerateSnapshot(); |
| 1113 | 1120 |
| 1114 private: | 1121 private: |
| 1115 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, | 1122 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, |
| 1116 Vector<int>* dominators); | 1123 Vector<int>* dominators); |
| 1117 bool CalculateRetainedSizes(); | 1124 bool CalculateRetainedSizes(); |
| 1118 bool CountEntriesAndReferences(); | 1125 bool CountEntriesAndReferences(); |
| 1119 bool FillReferences(); | 1126 bool FillReferences(); |
| 1120 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); | 1127 void FillPostorderIndexes(Vector<HeapEntry*>* entries); |
| 1128 bool IsWindowReference(const HeapGraphEdge& edge); |
| 1129 void MarkWindowReachableObjects(); |
| 1121 void ProgressStep(); | 1130 void ProgressStep(); |
| 1122 bool ProgressReport(bool force = false); | 1131 bool ProgressReport(bool force = false); |
| 1123 bool SetEntriesDominators(); | 1132 bool SetEntriesDominators(); |
| 1124 void SetProgressTotal(int iterations_count); | 1133 void SetProgressTotal(int iterations_count); |
| 1125 | 1134 |
| 1126 HeapSnapshot* snapshot_; | 1135 HeapSnapshot* snapshot_; |
| 1127 v8::ActivityControl* control_; | 1136 v8::ActivityControl* control_; |
| 1128 V8HeapExplorer v8_heap_explorer_; | 1137 V8HeapExplorer v8_heap_explorer_; |
| 1129 NativeObjectsExplorer dom_explorer_; | 1138 NativeObjectsExplorer dom_explorer_; |
| 1130 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1139 // Mapping from HeapThing pointers to HeapEntry* pointers. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1153 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { | 1162 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { |
| 1154 return key1 == key2; | 1163 return key1 == key2; |
| 1155 } | 1164 } |
| 1156 | 1165 |
| 1157 INLINE(static uint32_t ObjectHash(const void* key)) { | 1166 INLINE(static uint32_t ObjectHash(const void* key)) { |
| 1158 return ComputeIntegerHash( | 1167 return ComputeIntegerHash( |
| 1159 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)), | 1168 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)), |
| 1160 v8::internal::kZeroHashSeed); | 1169 v8::internal::kZeroHashSeed); |
| 1161 } | 1170 } |
| 1162 | 1171 |
| 1172 void CalculateNodeIndexes(const List<HeapEntry*>& nodes); |
| 1163 HeapSnapshot* CreateFakeSnapshot(); | 1173 HeapSnapshot* CreateFakeSnapshot(); |
| 1164 int GetStringId(const char* s); | 1174 int GetStringId(const char* s); |
| 1165 void SerializeEdge(HeapGraphEdge* edge); | 1175 void SerializeEdge(HeapGraphEdge* edge, bool first_edge); |
| 1176 void SerializeEdges(const List<HeapEntry*>& nodes); |
| 1166 void SerializeImpl(); | 1177 void SerializeImpl(); |
| 1167 void SerializeNode(HeapEntry* entry); | 1178 void SerializeNode(HeapEntry* entry, int edges_index); |
| 1168 void SerializeNodes(); | 1179 void SerializeNodes(const List<HeapEntry*>& nodes); |
| 1169 void SerializeSnapshot(); | 1180 void SerializeSnapshot(); |
| 1170 void SerializeString(const unsigned char* s); | 1181 void SerializeString(const unsigned char* s); |
| 1171 void SerializeStrings(); | 1182 void SerializeStrings(); |
| 1172 void SortHashMap(HashMap* map, List<HashMap::Entry*>* sorted_entries); | 1183 void SortHashMap(HashMap* map, List<HashMap::Entry*>* sorted_entries); |
| 1173 | 1184 |
| 1174 static const int kMaxSerializableSnapshotRawSize; | 1185 static const int kMaxSerializableSnapshotRawSize; |
| 1175 | 1186 |
| 1176 HeapSnapshot* snapshot_; | 1187 HeapSnapshot* snapshot_; |
| 1177 HashMap strings_; | 1188 HashMap strings_; |
| 1178 int next_node_id_; | 1189 int next_node_id_; |
| 1179 int next_string_id_; | 1190 int next_string_id_; |
| 1180 OutputStreamWriter* writer_; | 1191 OutputStreamWriter* writer_; |
| 1181 | 1192 |
| 1182 friend class HeapSnapshotJSONSerializerEnumerator; | 1193 friend class HeapSnapshotJSONSerializerEnumerator; |
| 1183 friend class HeapSnapshotJSONSerializerIterator; | 1194 friend class HeapSnapshotJSONSerializerIterator; |
| 1184 | 1195 |
| 1185 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1196 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
| 1186 }; | 1197 }; |
| 1187 | 1198 |
| 1188 } } // namespace v8::internal | 1199 } } // namespace v8::internal |
| 1189 | 1200 |
| 1190 #endif // V8_PROFILE_GENERATOR_H_ | 1201 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |