OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 }; | 59 }; |
60 | 60 |
61 | 61 |
62 // Provides a storage of strings allocated in C++ heap, to hold them | 62 // Provides a storage of strings allocated in C++ heap, to hold them |
63 // forever, even if they disappear from JS heap or external storage. | 63 // forever, even if they disappear from JS heap or external storage. |
64 class StringsStorage { | 64 class StringsStorage { |
65 public: | 65 public: |
66 StringsStorage(); | 66 StringsStorage(); |
67 ~StringsStorage(); | 67 ~StringsStorage(); |
68 | 68 |
69 const char* PrintF(const char* format, ...); | |
Vitaly Repeshko
2011/03/09 14:15:49
"PrintF" is a bad name. We don't actually print an
mnaganov (inactive)
2011/03/09 15:26:32
Renamed to GetFormatted and GetVFormatted, as it d
| |
70 const char* VPrintF(const char* format, va_list args); | |
69 const char* GetName(String* name); | 71 const char* GetName(String* name); |
70 const char* GetName(int index); | 72 const char* GetName(int index); |
71 inline const char* GetFunctionName(String* name); | 73 inline const char* GetFunctionName(String* name); |
72 inline const char* GetFunctionName(const char* name); | 74 inline const char* GetFunctionName(const char* name); |
73 | 75 |
74 private: | 76 private: |
75 INLINE(static bool StringsMatch(void* key1, void* key2)) { | 77 INLINE(static bool StringsMatch(void* key1, void* key2)) { |
76 return strcmp(reinterpret_cast<char*>(key1), | 78 return strcmp(reinterpret_cast<char*>(key1), |
77 reinterpret_cast<char*>(key2)) == 0; | 79 reinterpret_cast<char*>(key2)) == 0; |
78 } | 80 } |
81 const char* AddOrDisposeString(char* str, uint32_t hash); | |
79 | 82 |
80 // Mapping of strings by String::Hash to const char* strings. | 83 // Mapping of strings by String::Hash to const char* strings. |
81 HashMap names_; | 84 HashMap names_; |
82 // Mapping from ints to char* strings. | |
83 List<char*> index_names_; | |
84 | 85 |
85 DISALLOW_COPY_AND_ASSIGN(StringsStorage); | 86 DISALLOW_COPY_AND_ASSIGN(StringsStorage); |
86 }; | 87 }; |
87 | 88 |
88 | 89 |
89 class CodeEntry { | 90 class CodeEntry { |
90 public: | 91 public: |
91 // CodeEntry doesn't own name strings, just references them. | 92 // CodeEntry doesn't own name strings, just references them. |
92 INLINE(CodeEntry(Logger::LogEventsAndTags tag, | 93 INLINE(CodeEntry(Logger::LogEventsAndTags tag, |
93 const char* name_prefix, | 94 const char* name_prefix, |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 class HeapEntry BASE_EMBEDDED { | 511 class HeapEntry BASE_EMBEDDED { |
511 public: | 512 public: |
512 enum Type { | 513 enum Type { |
513 kHidden = v8::HeapGraphNode::kHidden, | 514 kHidden = v8::HeapGraphNode::kHidden, |
514 kArray = v8::HeapGraphNode::kArray, | 515 kArray = v8::HeapGraphNode::kArray, |
515 kString = v8::HeapGraphNode::kString, | 516 kString = v8::HeapGraphNode::kString, |
516 kObject = v8::HeapGraphNode::kObject, | 517 kObject = v8::HeapGraphNode::kObject, |
517 kCode = v8::HeapGraphNode::kCode, | 518 kCode = v8::HeapGraphNode::kCode, |
518 kClosure = v8::HeapGraphNode::kClosure, | 519 kClosure = v8::HeapGraphNode::kClosure, |
519 kRegExp = v8::HeapGraphNode::kRegExp, | 520 kRegExp = v8::HeapGraphNode::kRegExp, |
520 kHeapNumber = v8::HeapGraphNode::kHeapNumber | 521 kHeapNumber = v8::HeapGraphNode::kHeapNumber, |
522 kNative = v8::HeapGraphNode::kNative | |
521 }; | 523 }; |
522 | 524 |
523 HeapEntry() { } | 525 HeapEntry() { } |
524 void Init(HeapSnapshot* snapshot, | 526 void Init(HeapSnapshot* snapshot, |
525 Type type, | 527 Type type, |
526 const char* name, | 528 const char* name, |
527 uint64_t id, | 529 uint64_t id, |
528 int self_size, | 530 int self_size, |
529 int children_count, | 531 int children_count, |
530 int retainers_count); | 532 int retainers_count); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 } | 599 } |
598 HeapGraphEdge** retainers_arr() { | 600 HeapGraphEdge** retainers_arr() { |
599 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); | 601 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); |
600 } | 602 } |
601 void CalculateExactRetainedSize(); | 603 void CalculateExactRetainedSize(); |
602 void FindRetainingPaths(CachedHeapGraphPath* prev_path, | 604 void FindRetainingPaths(CachedHeapGraphPath* prev_path, |
603 List<HeapGraphPath*>* retaining_paths); | 605 List<HeapGraphPath*>* retaining_paths); |
604 const char* TypeAsString(); | 606 const char* TypeAsString(); |
605 | 607 |
606 unsigned painted_: 2; | 608 unsigned painted_: 2; |
607 unsigned type_: 3; | 609 unsigned type_: 4; |
608 int children_count_: 27; | 610 int children_count_: 26; |
609 int retainers_count_; | 611 int retainers_count_; |
610 int self_size_; | 612 int self_size_; |
611 union { | 613 union { |
612 int ordered_index_; // Used during dominator tree building. | 614 int ordered_index_; // Used during dominator tree building. |
613 int retained_size_; // At that moment, there is no retained size yet. | 615 int retained_size_; // At that moment, there is no retained size yet. |
614 }; | 616 }; |
615 HeapEntry* dominator_; | 617 HeapEntry* dominator_; |
616 HeapSnapshot* snapshot_; | 618 HeapSnapshot* snapshot_; |
617 struct Id { | 619 struct Id { |
618 uint32_t id1_; | 620 uint32_t id1_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
670 const char* title, | 672 const char* title, |
671 unsigned uid); | 673 unsigned uid); |
672 ~HeapSnapshot(); | 674 ~HeapSnapshot(); |
673 | 675 |
674 HeapSnapshotsCollection* collection() { return collection_; } | 676 HeapSnapshotsCollection* collection() { return collection_; } |
675 Type type() { return type_; } | 677 Type type() { return type_; } |
676 const char* title() { return title_; } | 678 const char* title() { return title_; } |
677 unsigned uid() { return uid_; } | 679 unsigned uid() { return uid_; } |
678 HeapEntry* root() { return root_entry_; } | 680 HeapEntry* root() { return root_entry_; } |
679 HeapEntry* gc_roots() { return gc_roots_entry_; } | 681 HeapEntry* gc_roots() { return gc_roots_entry_; } |
682 HeapEntry* dom_subtrees_root() { return dom_subtrees_root_entry_; } | |
680 List<HeapEntry*>* entries() { return &entries_; } | 683 List<HeapEntry*>* entries() { return &entries_; } |
681 | 684 |
682 void AllocateEntries( | 685 void AllocateEntries( |
683 int entries_count, int children_count, int retainers_count); | 686 int entries_count, int children_count, int retainers_count); |
684 HeapEntry* AddEntry(HeapEntry::Type type, | 687 HeapEntry* AddEntry(HeapEntry::Type type, |
685 const char* name, | 688 const char* name, |
686 uint64_t id, | 689 uint64_t id, |
687 int size, | 690 int size, |
688 int children_count, | 691 int children_count, |
689 int retainers_count); | 692 int retainers_count); |
690 HeapEntry* AddRootEntry(int children_count); | 693 HeapEntry* AddRootEntry(int children_count); |
691 HeapEntry* AddGcRootsEntry(int children_count, int retainers_count); | 694 HeapEntry* AddGcRootsEntry(int children_count, int retainers_count); |
695 HeapEntry* AddNativesRootEntry(int children_count, int retainers_count); | |
692 void ClearPaint(); | 696 void ClearPaint(); |
693 HeapSnapshotsDiff* CompareWith(HeapSnapshot* snapshot); | 697 HeapSnapshotsDiff* CompareWith(HeapSnapshot* snapshot); |
694 HeapEntry* GetEntryById(uint64_t id); | 698 HeapEntry* GetEntryById(uint64_t id); |
695 List<HeapGraphPath*>* GetRetainingPaths(HeapEntry* entry); | 699 List<HeapGraphPath*>* GetRetainingPaths(HeapEntry* entry); |
696 List<HeapEntry*>* GetSortedEntriesList(); | 700 List<HeapEntry*>* GetSortedEntriesList(); |
697 template<class Visitor> | 701 template<class Visitor> |
698 void IterateEntries(Visitor* visitor) { entries_.Iterate(visitor); } | 702 void IterateEntries(Visitor* visitor) { entries_.Iterate(visitor); } |
699 void SetDominatorsToSelf(); | 703 void SetDominatorsToSelf(); |
700 | 704 |
701 void Print(int max_depth); | 705 void Print(int max_depth); |
702 void PrintEntriesSize(); | 706 void PrintEntriesSize(); |
703 | 707 |
704 private: | 708 private: |
705 HeapEntry* GetNextEntryToInit(); | 709 HeapEntry* GetNextEntryToInit(); |
706 | 710 |
707 HeapSnapshotsCollection* collection_; | 711 HeapSnapshotsCollection* collection_; |
708 Type type_; | 712 Type type_; |
709 const char* title_; | 713 const char* title_; |
710 unsigned uid_; | 714 unsigned uid_; |
711 HeapEntry* root_entry_; | 715 HeapEntry* root_entry_; |
712 HeapEntry* gc_roots_entry_; | 716 HeapEntry* gc_roots_entry_; |
717 HeapEntry* dom_subtrees_root_entry_; | |
713 char* raw_entries_; | 718 char* raw_entries_; |
714 List<HeapEntry*> entries_; | 719 List<HeapEntry*> entries_; |
715 bool entries_sorted_; | 720 bool entries_sorted_; |
716 HashMap retaining_paths_; | 721 HashMap retaining_paths_; |
717 #ifdef DEBUG | 722 #ifdef DEBUG |
718 int raw_entries_size_; | 723 int raw_entries_size_; |
719 #endif | 724 #endif |
720 | 725 |
721 friend class HeapSnapshotTester; | 726 friend class HeapSnapshotTester; |
722 | 727 |
723 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); | 728 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); |
724 }; | 729 }; |
725 | 730 |
726 | 731 |
727 class HeapObjectsMap { | 732 class HeapObjectsMap { |
728 public: | 733 public: |
729 HeapObjectsMap(); | 734 HeapObjectsMap(); |
730 ~HeapObjectsMap(); | 735 ~HeapObjectsMap(); |
731 | 736 |
732 void SnapshotGenerationFinished(); | 737 void SnapshotGenerationFinished(); |
733 uint64_t FindObject(Address addr); | 738 uint64_t FindObject(Address addr); |
734 void MoveObject(Address from, Address to); | 739 void MoveObject(Address from, Address to); |
735 | 740 |
741 static uint64_t GenerateId(v8::RetainedObjectInfo* info); | |
742 | |
736 static const uint64_t kInternalRootObjectId; | 743 static const uint64_t kInternalRootObjectId; |
737 static const uint64_t kGcRootsObjectId; | 744 static const uint64_t kGcRootsObjectId; |
745 static const uint64_t kNativesRootObjectId; | |
738 static const uint64_t kFirstAvailableObjectId; | 746 static const uint64_t kFirstAvailableObjectId; |
739 | 747 |
740 private: | 748 private: |
741 struct EntryInfo { | 749 struct EntryInfo { |
742 explicit EntryInfo(uint64_t id) : id(id), accessed(true) { } | 750 explicit EntryInfo(uint64_t id) : id(id), accessed(true) { } |
743 EntryInfo(uint64_t id, bool accessed) : id(id), accessed(accessed) { } | 751 EntryInfo(uint64_t id, bool accessed) : id(id), accessed(accessed) { } |
744 uint64_t id; | 752 uint64_t id; |
745 bool accessed; | 753 bool accessed; |
746 }; | 754 }; |
747 | 755 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
825 ~HeapSnapshotsCollection(); | 833 ~HeapSnapshotsCollection(); |
826 | 834 |
827 bool is_tracking_objects() { return is_tracking_objects_; } | 835 bool is_tracking_objects() { return is_tracking_objects_; } |
828 | 836 |
829 HeapSnapshot* NewSnapshot( | 837 HeapSnapshot* NewSnapshot( |
830 HeapSnapshot::Type type, const char* name, unsigned uid); | 838 HeapSnapshot::Type type, const char* name, unsigned uid); |
831 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 839 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
832 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 840 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
833 HeapSnapshot* GetSnapshot(unsigned uid); | 841 HeapSnapshot* GetSnapshot(unsigned uid); |
834 | 842 |
835 const char* GetName(String* name) { return names_.GetName(name); } | 843 const char* GetName(String* name) { return names_.GetName(name); } |
Vitaly Repeshko
2011/03/09 14:15:49
I think it'd be much better to expose the string s
mnaganov (inactive)
2011/03/09 15:26:32
Right. There are now too many functions to export.
| |
836 const char* GetName(int index) { return names_.GetName(index); } | 844 const char* GetName(int index) { return names_.GetName(index); } |
837 const char* GetFunctionName(String* name) { | 845 const char* GetFunctionName(String* name) { |
838 return names_.GetFunctionName(name); | 846 return names_.GetFunctionName(name); |
839 } | 847 } |
848 const char* PrintF(const char* format, ...); | |
840 | 849 |
841 TokenEnumerator* token_enumerator() { return token_enumerator_; } | 850 TokenEnumerator* token_enumerator() { return token_enumerator_; } |
842 | 851 |
843 uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); } | 852 uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); } |
844 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 853 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
845 | 854 |
846 HeapSnapshotsDiff* CompareSnapshots(HeapSnapshot* snapshot1, | 855 HeapSnapshotsDiff* CompareSnapshots(HeapSnapshot* snapshot1, |
847 HeapSnapshot* snapshot2); | 856 HeapSnapshot* snapshot2); |
848 | 857 |
849 private: | 858 private: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
943 HashMap entries_; | 952 HashMap entries_; |
944 | 953 |
945 DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet); | 954 DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet); |
946 }; | 955 }; |
947 | 956 |
948 | 957 |
949 // An interface used to populate a snapshot with nodes and edges. | 958 // An interface used to populate a snapshot with nodes and edges. |
950 class SnapshotFillerInterface { | 959 class SnapshotFillerInterface { |
951 public: | 960 public: |
952 virtual ~SnapshotFillerInterface() { } | 961 virtual ~SnapshotFillerInterface() { } |
953 virtual HeapEntry* AddEntry(HeapThing ptr) = 0; | 962 virtual HeapEntry* AddEntry(HeapThing ptr, |
954 virtual HeapEntry* FindOrAddEntry(HeapThing ptr) = 0; | 963 HeapEntriesAllocator* allocator) = 0; |
964 virtual HeapEntry* FindEntry(HeapThing ptr) = 0; | |
965 virtual HeapEntry* FindOrAddEntry(HeapThing ptr, | |
966 HeapEntriesAllocator* allocator) = 0; | |
955 virtual void SetIndexedReference(HeapGraphEdge::Type type, | 967 virtual void SetIndexedReference(HeapGraphEdge::Type type, |
956 HeapThing parent_ptr, | 968 HeapThing parent_ptr, |
957 HeapEntry* parent_entry, | 969 HeapEntry* parent_entry, |
958 int index, | 970 int index, |
959 HeapThing child_ptr, | 971 HeapThing child_ptr, |
960 HeapEntry* child_entry) = 0; | 972 HeapEntry* child_entry) = 0; |
961 virtual void SetIndexedAutoIndexReference(HeapGraphEdge::Type type, | 973 virtual void SetIndexedAutoIndexReference(HeapGraphEdge::Type type, |
962 HeapThing parent_ptr, | 974 HeapThing parent_ptr, |
963 HeapEntry* parent_entry, | 975 HeapEntry* parent_entry, |
964 HeapThing child_ptr, | 976 HeapThing child_ptr, |
(...skipping 25 matching lines...) Expand all Loading... | |
990 public: | 1002 public: |
991 V8HeapExplorer(HeapSnapshot* snapshot, | 1003 V8HeapExplorer(HeapSnapshot* snapshot, |
992 SnapshottingProgressReportingInterface* progress); | 1004 SnapshottingProgressReportingInterface* progress); |
993 ~V8HeapExplorer(); | 1005 ~V8HeapExplorer(); |
994 virtual HeapEntry* AllocateEntry( | 1006 virtual HeapEntry* AllocateEntry( |
995 HeapThing ptr, int children_count, int retainers_count); | 1007 HeapThing ptr, int children_count, int retainers_count); |
996 void AddRootEntries(SnapshotFillerInterface* filler); | 1008 void AddRootEntries(SnapshotFillerInterface* filler); |
997 int EstimateObjectsCount(); | 1009 int EstimateObjectsCount(); |
998 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); | 1010 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); |
999 | 1011 |
1012 static HeapObject* const kInternalRootObject; | |
1013 | |
1000 private: | 1014 private: |
1001 HeapEntry* AddEntry( | 1015 HeapEntry* AddEntry( |
1002 HeapObject* object, int children_count, int retainers_count); | 1016 HeapObject* object, int children_count, int retainers_count); |
1003 HeapEntry* AddEntry(HeapObject* object, | 1017 HeapEntry* AddEntry(HeapObject* object, |
1004 HeapEntry::Type type, | 1018 HeapEntry::Type type, |
1005 const char* name, | 1019 const char* name, |
1006 int children_count, | 1020 int children_count, |
1007 int retainers_count); | 1021 int retainers_count); |
1008 void ExtractReferences(HeapObject* obj); | 1022 void ExtractReferences(HeapObject* obj); |
1009 void ExtractClosureReferences(JSObject* js_obj, HeapEntry* entry); | 1023 void ExtractClosureReferences(JSObject* js_obj, HeapEntry* entry); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 HeapEntry* GetEntry(Object* obj); | 1059 HeapEntry* GetEntry(Object* obj); |
1046 | 1060 |
1047 HeapSnapshot* snapshot_; | 1061 HeapSnapshot* snapshot_; |
1048 HeapSnapshotsCollection* collection_; | 1062 HeapSnapshotsCollection* collection_; |
1049 SnapshottingProgressReportingInterface* progress_; | 1063 SnapshottingProgressReportingInterface* progress_; |
1050 // Used during references extraction to mark heap objects that | 1064 // Used during references extraction to mark heap objects that |
1051 // are references via non-hidden properties. | 1065 // are references via non-hidden properties. |
1052 HeapObjectsSet known_references_; | 1066 HeapObjectsSet known_references_; |
1053 SnapshotFillerInterface* filler_; | 1067 SnapshotFillerInterface* filler_; |
1054 | 1068 |
1055 static HeapObject* const kInternalRootObject; | |
1056 static HeapObject* const kGcRootsObject; | 1069 static HeapObject* const kGcRootsObject; |
1057 | 1070 |
1058 friend class IndexedReferencesExtractor; | 1071 friend class IndexedReferencesExtractor; |
1059 friend class RootsReferencesExtractor; | 1072 friend class RootsReferencesExtractor; |
1060 | 1073 |
1061 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); | 1074 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); |
1062 }; | 1075 }; |
1063 | 1076 |
1064 | 1077 |
1078 // An implementation of retained native objects extractor. | |
1079 class NativeObjectsExplorer : public HeapEntriesAllocator { | |
1080 public: | |
1081 NativeObjectsExplorer(HeapSnapshot* snapshot, | |
1082 SnapshottingProgressReportingInterface* progress); | |
1083 ~NativeObjectsExplorer(); | |
Vitaly Repeshko
2011/03/09 14:15:49
Please make the implicit "virtual" explicit.
mnaganov (inactive)
2011/03/09 15:26:32
Done.
| |
1084 virtual HeapEntry* AllocateEntry( | |
1085 HeapThing ptr, int children_count, int retainers_count); | |
1086 void AddRootEntries(SnapshotFillerInterface* filler); | |
1087 int EstimateObjectsCount(); | |
1088 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); | |
1089 | |
1090 private: | |
1091 void FillRetainedObjects(); | |
1092 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); | |
1093 void SetNativeRootReference(v8::RetainedObjectInfo* info); | |
1094 void SetRootNativesRootReference(); | |
1095 void SetWrapperNativeReferences(HeapObject* wrapper, | |
1096 v8::RetainedObjectInfo* info); | |
1097 void VisitSubtreeWrapper(Object** p, uint16_t class_id); | |
1098 | |
1099 static uint32_t InfoHash(v8::RetainedObjectInfo* info) { | |
1100 return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash())); | |
1101 } | |
1102 static bool RetainedInfosMatch(void* key1, void* key2) { | |
1103 return key1 == key2 || | |
1104 (reinterpret_cast<v8::RetainedObjectInfo*>(key1))->IsEquivalent( | |
1105 reinterpret_cast<v8::RetainedObjectInfo*>(key2)); | |
1106 } | |
1107 | |
1108 HeapSnapshot* snapshot_; | |
1109 HeapSnapshotsCollection* collection_; | |
1110 SnapshottingProgressReportingInterface* progress_; | |
1111 bool embedder_queried_; | |
1112 HeapObjectsSet in_groups_; | |
1113 // RetainedObjectInfo* -> List<HeapObject*>* | |
1114 HashMap objects_by_info_; | |
1115 // Used during references extraction. | |
1116 SnapshotFillerInterface* filler_; | |
1117 | |
1118 static HeapThing const kNativesRootObject; | |
1119 | |
1120 friend class GlobalHandlesExtractor; | |
1121 | |
1122 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); | |
1123 }; | |
1124 | |
1125 | |
1065 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { | 1126 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { |
1066 public: | 1127 public: |
1067 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1128 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
1068 v8::ActivityControl* control); | 1129 v8::ActivityControl* control); |
1069 bool GenerateSnapshot(); | 1130 bool GenerateSnapshot(); |
1070 | 1131 |
1071 private: | 1132 private: |
1072 bool ApproximateRetainedSizes(); | 1133 bool ApproximateRetainedSizes(); |
1073 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, | 1134 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, |
1074 Vector<HeapEntry*>* dominators); | 1135 Vector<HeapEntry*>* dominators); |
1075 bool CountEntriesAndReferences(); | 1136 bool CountEntriesAndReferences(); |
1076 bool FillReferences(); | 1137 bool FillReferences(); |
1077 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); | 1138 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); |
1078 void ProgressStep(); | 1139 void ProgressStep(); |
1079 bool ProgressReport(bool force = false); | 1140 bool ProgressReport(bool force = false); |
1080 bool SetEntriesDominators(); | 1141 bool SetEntriesDominators(); |
1081 void SetProgressTotal(int iterations_count); | 1142 void SetProgressTotal(int iterations_count); |
1082 | 1143 |
1083 HeapSnapshot* snapshot_; | 1144 HeapSnapshot* snapshot_; |
1084 v8::ActivityControl* control_; | 1145 v8::ActivityControl* control_; |
1085 V8HeapExplorer v8_heap_explorer_; | 1146 V8HeapExplorer v8_heap_explorer_; |
1147 NativeObjectsExplorer dom_explorer_; | |
1086 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1148 // Mapping from HeapThing pointers to HeapEntry* pointers. |
1087 HeapEntriesMap entries_; | 1149 HeapEntriesMap entries_; |
1088 // Used during snapshot generation. | 1150 // Used during snapshot generation. |
1089 int progress_counter_; | 1151 int progress_counter_; |
1090 int progress_total_; | 1152 int progress_total_; |
1091 | 1153 |
1092 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); | 1154 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); |
1093 }; | 1155 }; |
1094 | 1156 |
1095 class OutputStreamWriter; | 1157 class OutputStreamWriter; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1142 }; | 1204 }; |
1143 | 1205 |
1144 | 1206 |
1145 String* GetConstructorNameForHeapProfile(JSObject* object); | 1207 String* GetConstructorNameForHeapProfile(JSObject* object); |
1146 | 1208 |
1147 } } // namespace v8::internal | 1209 } } // namespace v8::internal |
1148 | 1210 |
1149 #endif // ENABLE_LOGGING_AND_PROFILING | 1211 #endif // ENABLE_LOGGING_AND_PROFILING |
1150 | 1212 |
1151 #endif // V8_PROFILE_GENERATOR_H_ | 1213 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |