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

Side by Side Diff: src/profile-generator.h

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « src/platform-win32.cc ('k') | src/profile-generator.cc » ('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 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 HashMap names_; 81 HashMap names_;
82 // Mapping from ints to char* strings. 82 // Mapping from ints to char* strings.
83 List<char*> index_names_; 83 List<char*> index_names_;
84 84
85 DISALLOW_COPY_AND_ASSIGN(StringsStorage); 85 DISALLOW_COPY_AND_ASSIGN(StringsStorage);
86 }; 86 };
87 87
88 88
89 class CodeEntry { 89 class CodeEntry {
90 public: 90 public:
91 explicit INLINE(CodeEntry(int security_token_id));
92 // CodeEntry doesn't own name strings, just references them. 91 // CodeEntry doesn't own name strings, just references them.
93 INLINE(CodeEntry(Logger::LogEventsAndTags tag, 92 INLINE(CodeEntry(Logger::LogEventsAndTags tag,
94 const char* name_prefix, 93 const char* name_prefix,
95 const char* name, 94 const char* name,
96 const char* resource_name, 95 const char* resource_name,
97 int line_number, 96 int line_number,
98 int security_token_id)); 97 int security_token_id));
99 98
100 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); } 99 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
101 INLINE(const char* name_prefix() const) { return name_prefix_; } 100 INLINE(const char* name_prefix() const) { return name_prefix_; }
102 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; } 101 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; }
103 INLINE(const char* name() const) { return name_; } 102 INLINE(const char* name() const) { return name_; }
104 INLINE(const char* resource_name() const) { return resource_name_; } 103 INLINE(const char* resource_name() const) { return resource_name_; }
105 INLINE(int line_number() const) { return line_number_; } 104 INLINE(int line_number() const) { return line_number_; }
105 INLINE(int shared_id() const) { return shared_id_; }
106 INLINE(void set_shared_id(int shared_id)) { shared_id_ = shared_id; }
106 INLINE(int security_token_id() const) { return security_token_id_; } 107 INLINE(int security_token_id() const) { return security_token_id_; }
107 108
108 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag)); 109 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag));
109 110
110 void CopyData(const CodeEntry& source); 111 void CopyData(const CodeEntry& source);
111 uint32_t GetCallUid() const; 112 uint32_t GetCallUid() const;
112 bool IsSameAs(CodeEntry* entry) const; 113 bool IsSameAs(CodeEntry* entry) const;
113 114
114 static const char* const kEmptyNamePrefix; 115 static const char* const kEmptyNamePrefix;
115 116
116 private: 117 private:
117 Logger::LogEventsAndTags tag_; 118 Logger::LogEventsAndTags tag_;
118 const char* name_prefix_; 119 const char* name_prefix_;
119 const char* name_; 120 const char* name_;
120 const char* resource_name_; 121 const char* resource_name_;
121 int line_number_; 122 int line_number_;
123 int shared_id_;
122 int security_token_id_; 124 int security_token_id_;
123 125
124 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 126 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
125 }; 127 };
126 128
127 129
128 class ProfileTree; 130 class ProfileTree;
129 131
130 class ProfileNode { 132 class ProfileNode {
131 public: 133 public:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 unsigned uid_; 229 unsigned uid_;
228 ProfileTree top_down_; 230 ProfileTree top_down_;
229 ProfileTree bottom_up_; 231 ProfileTree bottom_up_;
230 232
231 DISALLOW_COPY_AND_ASSIGN(CpuProfile); 233 DISALLOW_COPY_AND_ASSIGN(CpuProfile);
232 }; 234 };
233 235
234 236
235 class CodeMap { 237 class CodeMap {
236 public: 238 public:
237 CodeMap() { } 239 CodeMap() : next_sfi_tag_(1) { }
238 INLINE(void AddCode(Address addr, CodeEntry* entry, unsigned size)); 240 INLINE(void AddCode(Address addr, CodeEntry* entry, unsigned size));
239 INLINE(void MoveCode(Address from, Address to)); 241 INLINE(void MoveCode(Address from, Address to));
240 INLINE(void DeleteCode(Address addr)); 242 INLINE(void DeleteCode(Address addr));
241 void AddAlias(Address start, CodeEntry* entry, Address code_start);
242 CodeEntry* FindEntry(Address addr); 243 CodeEntry* FindEntry(Address addr);
244 int GetSFITag(Address addr);
243 245
244 void Print(); 246 void Print();
245 247
246 private: 248 private:
247 struct CodeEntryInfo { 249 struct CodeEntryInfo {
248 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size) 250 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size)
249 : entry(an_entry), size(a_size) { } 251 : entry(an_entry), size(a_size) { }
250 CodeEntry* entry; 252 CodeEntry* entry;
251 unsigned size; 253 unsigned size;
252 }; 254 };
253 255
254 struct CodeTreeConfig { 256 struct CodeTreeConfig {
255 typedef Address Key; 257 typedef Address Key;
256 typedef CodeEntryInfo Value; 258 typedef CodeEntryInfo Value;
257 static const Key kNoKey; 259 static const Key kNoKey;
258 static const Value kNoValue; 260 static const Value kNoValue;
259 static int Compare(const Key& a, const Key& b) { 261 static int Compare(const Key& a, const Key& b) {
260 return a < b ? -1 : (a > b ? 1 : 0); 262 return a < b ? -1 : (a > b ? 1 : 0);
261 } 263 }
262 }; 264 };
263 typedef SplayTree<CodeTreeConfig> CodeTree; 265 typedef SplayTree<CodeTreeConfig> CodeTree;
264 266
265 class CodeTreePrinter { 267 class CodeTreePrinter {
266 public: 268 public:
267 void Call(const Address& key, const CodeEntryInfo& value); 269 void Call(const Address& key, const CodeEntryInfo& value);
268 }; 270 };
269 271
272 // Fake CodeEntry pointer to distinguish SFI entries.
273 static CodeEntry* const kSfiCodeEntry;
274
270 CodeTree tree_; 275 CodeTree tree_;
276 int next_sfi_tag_;
271 277
272 DISALLOW_COPY_AND_ASSIGN(CodeMap); 278 DISALLOW_COPY_AND_ASSIGN(CodeMap);
273 }; 279 };
274 280
275 281
276 class CpuProfilesCollection { 282 class CpuProfilesCollection {
277 public: 283 public:
278 CpuProfilesCollection(); 284 CpuProfilesCollection();
279 ~CpuProfilesCollection(); 285 ~CpuProfilesCollection();
280 286
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 HeapSnapshotsCollection* collection() { return collection_; } 674 HeapSnapshotsCollection* collection() { return collection_; }
669 Type type() { return type_; } 675 Type type() { return type_; }
670 const char* title() { return title_; } 676 const char* title() { return title_; }
671 unsigned uid() { return uid_; } 677 unsigned uid() { return uid_; }
672 HeapEntry* root() { return root_entry_; } 678 HeapEntry* root() { return root_entry_; }
673 HeapEntry* gc_roots() { return gc_roots_entry_; } 679 HeapEntry* gc_roots() { return gc_roots_entry_; }
674 List<HeapEntry*>* entries() { return &entries_; } 680 List<HeapEntry*>* entries() { return &entries_; }
675 681
676 void AllocateEntries( 682 void AllocateEntries(
677 int entries_count, int children_count, int retainers_count); 683 int entries_count, int children_count, int retainers_count);
678 HeapEntry* AddEntry(
679 HeapObject* object, int children_count, int retainers_count);
680 HeapEntry* AddEntry(HeapEntry::Type type, 684 HeapEntry* AddEntry(HeapEntry::Type type,
681 const char* name, 685 const char* name,
682 uint64_t id, 686 uint64_t id,
683 int size, 687 int size,
684 int children_count, 688 int children_count,
685 int retainers_count); 689 int retainers_count);
690 HeapEntry* AddRootEntry(int children_count);
691 HeapEntry* AddGcRootsEntry(int children_count, int retainers_count);
686 void ClearPaint(); 692 void ClearPaint();
687 HeapSnapshotsDiff* CompareWith(HeapSnapshot* snapshot); 693 HeapSnapshotsDiff* CompareWith(HeapSnapshot* snapshot);
688 HeapEntry* GetEntryById(uint64_t id); 694 HeapEntry* GetEntryById(uint64_t id);
689 List<HeapGraphPath*>* GetRetainingPaths(HeapEntry* entry); 695 List<HeapGraphPath*>* GetRetainingPaths(HeapEntry* entry);
690 List<HeapEntry*>* GetSortedEntriesList(); 696 List<HeapEntry*>* GetSortedEntriesList();
691 template<class Visitor> 697 template<class Visitor>
692 void IterateEntries(Visitor* visitor) { entries_.Iterate(visitor); } 698 void IterateEntries(Visitor* visitor) { entries_.Iterate(visitor); }
693 void SetDominatorsToSelf(); 699 void SetDominatorsToSelf();
694 700
695 void Print(int max_depth); 701 void Print(int max_depth);
696 void PrintEntriesSize(); 702 void PrintEntriesSize();
697 703
698 static HeapObject* const kInternalRootObject;
699 static HeapObject* const kGcRootsObject;
700
701 private: 704 private:
702 HeapEntry* AddEntry(HeapObject* object,
703 HeapEntry::Type type,
704 const char* name,
705 int children_count,
706 int retainers_count);
707 HeapEntry* GetNextEntryToInit(); 705 HeapEntry* GetNextEntryToInit();
708 706
709 HeapSnapshotsCollection* collection_; 707 HeapSnapshotsCollection* collection_;
710 Type type_; 708 Type type_;
711 const char* title_; 709 const char* title_;
712 unsigned uid_; 710 unsigned uid_;
713 HeapEntry* root_entry_; 711 HeapEntry* root_entry_;
714 HeapEntry* gc_roots_entry_; 712 HeapEntry* gc_roots_entry_;
715 char* raw_entries_; 713 char* raw_entries_;
716 List<HeapEntry*> entries_; 714 List<HeapEntry*> entries_;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 StringsStorage names_; 858 StringsStorage names_;
861 TokenEnumerator* token_enumerator_; 859 TokenEnumerator* token_enumerator_;
862 // Mapping from HeapObject addresses to objects' uids. 860 // Mapping from HeapObject addresses to objects' uids.
863 HeapObjectsMap ids_; 861 HeapObjectsMap ids_;
864 HeapSnapshotsComparator comparator_; 862 HeapSnapshotsComparator comparator_;
865 863
866 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); 864 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection);
867 }; 865 };
868 866
869 867
868 // A typedef for referencing anything that can be snapshotted living
869 // in any kind of heap memory.
870 typedef void* HeapThing;
871
872
873 // An interface that creates HeapEntries by HeapThings.
874 class HeapEntriesAllocator {
875 public:
876 virtual ~HeapEntriesAllocator() { }
877 virtual HeapEntry* AllocateEntry(
878 HeapThing ptr, int children_count, int retainers_count) = 0;
879 };
880
881
870 // The HeapEntriesMap instance is used to track a mapping between 882 // The HeapEntriesMap instance is used to track a mapping between
871 // real heap objects and their representations in heap snapshots. 883 // real heap objects and their representations in heap snapshots.
872 class HeapEntriesMap { 884 class HeapEntriesMap {
873 public: 885 public:
874 HeapEntriesMap(); 886 HeapEntriesMap();
875 ~HeapEntriesMap(); 887 ~HeapEntriesMap();
876 888
877 HeapEntry* Map(HeapObject* object); 889 void AllocateEntries();
878 void Pair(HeapObject* object, HeapEntry* entry); 890 HeapEntry* Map(HeapThing thing);
879 void CountReference(HeapObject* from, HeapObject* to, 891 void Pair(HeapThing thing, HeapEntriesAllocator* allocator, HeapEntry* entry);
892 void CountReference(HeapThing from, HeapThing to,
880 int* prev_children_count = NULL, 893 int* prev_children_count = NULL,
881 int* prev_retainers_count = NULL); 894 int* prev_retainers_count = NULL);
882 template<class Visitor>
883 void UpdateEntries(Visitor* visitor);
884 895
885 int entries_count() { return entries_count_; } 896 int entries_count() { return entries_count_; }
886 int total_children_count() { return total_children_count_; } 897 int total_children_count() { return total_children_count_; }
887 int total_retainers_count() { return total_retainers_count_; } 898 int total_retainers_count() { return total_retainers_count_; }
888 899
889 static HeapEntry *const kHeapEntryPlaceholder; 900 static HeapEntry *const kHeapEntryPlaceholder;
890 901
891 private: 902 private:
892 struct EntryInfo { 903 struct EntryInfo {
893 explicit EntryInfo(HeapEntry* entry) 904 EntryInfo(HeapEntry* entry, HeapEntriesAllocator* allocator)
894 : entry(entry), children_count(0), retainers_count(0) { } 905 : entry(entry),
906 allocator(allocator),
907 children_count(0),
908 retainers_count(0) {
909 }
895 HeapEntry* entry; 910 HeapEntry* entry;
911 HeapEntriesAllocator* allocator;
896 int children_count; 912 int children_count;
897 int retainers_count; 913 int retainers_count;
898 }; 914 };
899 915
900 static uint32_t Hash(HeapObject* object) { 916 static uint32_t Hash(HeapThing thing) {
901 return ComputeIntegerHash( 917 return ComputeIntegerHash(
902 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object))); 918 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(thing)));
903 } 919 }
904 static bool HeapObjectsMatch(void* key1, void* key2) { return key1 == key2; } 920 static bool HeapThingsMatch(HeapThing key1, HeapThing key2) {
921 return key1 == key2;
922 }
905 923
906 HashMap entries_; 924 HashMap entries_;
907 int entries_count_; 925 int entries_count_;
908 int total_children_count_; 926 int total_children_count_;
909 int total_retainers_count_; 927 int total_retainers_count_;
910 928
911 friend class HeapObjectsSet; 929 friend class HeapObjectsSet;
912 930
913 DISALLOW_COPY_AND_ASSIGN(HeapEntriesMap); 931 DISALLOW_COPY_AND_ASSIGN(HeapEntriesMap);
914 }; 932 };
915 933
916 934
917 class HeapObjectsSet { 935 class HeapObjectsSet {
918 public: 936 public:
919 HeapObjectsSet(); 937 HeapObjectsSet();
920 void Clear(); 938 void Clear();
921 bool Contains(Object* object); 939 bool Contains(Object* object);
922 void Insert(Object* obj); 940 void Insert(Object* obj);
923 941
924 private: 942 private:
925 HashMap entries_; 943 HashMap entries_;
926 944
927 DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet); 945 DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet);
928 }; 946 };
929 947
930 948
931 class HeapSnapshotGenerator { 949 // An interface used to populate a snapshot with nodes and edges.
950 class SnapshotFillerInterface {
932 public: 951 public:
933 class SnapshotFillerInterface { 952 virtual ~SnapshotFillerInterface() { }
934 public: 953 virtual HeapEntry* AddEntry(HeapThing ptr) = 0;
935 virtual ~SnapshotFillerInterface() { } 954 virtual HeapEntry* FindOrAddEntry(HeapThing ptr) = 0;
936 virtual HeapEntry* AddEntry(HeapObject* obj) = 0; 955 virtual void SetIndexedReference(HeapGraphEdge::Type type,
937 virtual void SetIndexedReference(HeapGraphEdge::Type type, 956 HeapThing parent_ptr,
938 HeapObject* parent_obj,
939 HeapEntry* parent_entry,
940 int index,
941 Object* child_obj,
942 HeapEntry* child_entry) = 0;
943 virtual void SetNamedReference(HeapGraphEdge::Type type,
944 HeapObject* parent_obj,
945 HeapEntry* parent_entry, 957 HeapEntry* parent_entry,
946 const char* reference_name, 958 int index,
947 Object* child_obj, 959 HeapThing child_ptr,
948 HeapEntry* child_entry) = 0; 960 HeapEntry* child_entry) = 0;
949 virtual void SetRootGcRootsReference() = 0; 961 virtual void SetIndexedAutoIndexReference(HeapGraphEdge::Type type,
950 virtual void SetRootShortcutReference(Object* child_obj, 962 HeapThing parent_ptr,
963 HeapEntry* parent_entry,
964 HeapThing child_ptr,
965 HeapEntry* child_entry) = 0;
966 virtual void SetNamedReference(HeapGraphEdge::Type type,
967 HeapThing parent_ptr,
968 HeapEntry* parent_entry,
969 const char* reference_name,
970 HeapThing child_ptr,
971 HeapEntry* child_entry) = 0;
972 virtual void SetNamedAutoIndexReference(HeapGraphEdge::Type type,
973 HeapThing parent_ptr,
974 HeapEntry* parent_entry,
975 HeapThing child_ptr,
951 HeapEntry* child_entry) = 0; 976 HeapEntry* child_entry) = 0;
952 virtual void SetStrongRootReference(Object* child_obj, 977 };
953 HeapEntry* child_entry) = 0;
954 };
955 978
956 HeapSnapshotGenerator(HeapSnapshot* snapshot, 979
957 v8::ActivityControl* control); 980 class SnapshottingProgressReportingInterface {
958 bool GenerateSnapshot(); 981 public:
982 virtual ~SnapshottingProgressReportingInterface() { }
983 virtual void ProgressStep() = 0;
984 virtual bool ProgressReport(bool force) = 0;
985 };
986
987
988 // An implementation of V8 heap graph extractor.
989 class V8HeapExplorer : public HeapEntriesAllocator {
990 public:
991 V8HeapExplorer(HeapSnapshot* snapshot,
992 SnapshottingProgressReportingInterface* progress);
993 ~V8HeapExplorer();
994 virtual HeapEntry* AllocateEntry(
995 HeapThing ptr, int children_count, int retainers_count);
996 void AddRootEntries(SnapshotFillerInterface* filler);
997 int EstimateObjectsCount();
998 bool IterateAndExtractReferences(SnapshotFillerInterface* filler);
959 999
960 private: 1000 private:
961 bool ApproximateRetainedSizes(); 1001 HeapEntry* AddEntry(
962 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, 1002 HeapObject* object, int children_count, int retainers_count);
963 Vector<HeapEntry*>* dominators); 1003 HeapEntry* AddEntry(HeapObject* object,
964 bool CountEntriesAndReferences(); 1004 HeapEntry::Type type,
965 HeapEntry* GetEntry(Object* obj); 1005 const char* name,
966 void IncProgressCounter() { ++progress_counter_; } 1006 int children_count,
1007 int retainers_count);
967 void ExtractReferences(HeapObject* obj); 1008 void ExtractReferences(HeapObject* obj);
968 void ExtractClosureReferences(JSObject* js_obj, HeapEntry* entry); 1009 void ExtractClosureReferences(JSObject* js_obj, HeapEntry* entry);
969 void ExtractPropertyReferences(JSObject* js_obj, HeapEntry* entry); 1010 void ExtractPropertyReferences(JSObject* js_obj, HeapEntry* entry);
970 void ExtractElementReferences(JSObject* js_obj, HeapEntry* entry); 1011 void ExtractElementReferences(JSObject* js_obj, HeapEntry* entry);
971 void ExtractInternalReferences(JSObject* js_obj, HeapEntry* entry); 1012 void ExtractInternalReferences(JSObject* js_obj, HeapEntry* entry);
972 bool FillReferences();
973 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries);
974 bool IterateAndExtractReferences();
975 inline bool ReportProgress(bool force = false);
976 bool SetEntriesDominators();
977 void SetClosureReference(HeapObject* parent_obj, 1013 void SetClosureReference(HeapObject* parent_obj,
978 HeapEntry* parent, 1014 HeapEntry* parent,
979 String* reference_name, 1015 String* reference_name,
980 Object* child); 1016 Object* child);
981 void SetElementReference(HeapObject* parent_obj, 1017 void SetElementReference(HeapObject* parent_obj,
982 HeapEntry* parent, 1018 HeapEntry* parent,
983 int index, 1019 int index,
984 Object* child); 1020 Object* child);
985 void SetInternalReference(HeapObject* parent_obj, 1021 void SetInternalReference(HeapObject* parent_obj,
986 HeapEntry* parent, 1022 HeapEntry* parent,
(...skipping 11 matching lines...) Expand all
998 HeapEntry* parent, 1034 HeapEntry* parent,
999 String* reference_name, 1035 String* reference_name,
1000 Object* child); 1036 Object* child);
1001 void SetPropertyShortcutReference(HeapObject* parent_obj, 1037 void SetPropertyShortcutReference(HeapObject* parent_obj,
1002 HeapEntry* parent, 1038 HeapEntry* parent,
1003 String* reference_name, 1039 String* reference_name,
1004 Object* child); 1040 Object* child);
1005 void SetRootShortcutReference(Object* child); 1041 void SetRootShortcutReference(Object* child);
1006 void SetRootGcRootsReference(); 1042 void SetRootGcRootsReference();
1007 void SetGcRootsReference(Object* child); 1043 void SetGcRootsReference(Object* child);
1044
1045 HeapEntry* GetEntry(Object* obj);
1046
1047 HeapSnapshot* snapshot_;
1048 HeapSnapshotsCollection* collection_;
1049 SnapshottingProgressReportingInterface* progress_;
1050 // Used during references extraction to mark heap objects that
1051 // are references via non-hidden properties.
1052 HeapObjectsSet known_references_;
1053 SnapshotFillerInterface* filler_;
1054
1055 static HeapObject* const kInternalRootObject;
1056 static HeapObject* const kGcRootsObject;
1057
1058 friend class IndexedReferencesExtractor;
1059 friend class RootsReferencesExtractor;
1060
1061 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer);
1062 };
1063
1064
1065 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface {
1066 public:
1067 HeapSnapshotGenerator(HeapSnapshot* snapshot,
1068 v8::ActivityControl* control);
1069 bool GenerateSnapshot();
1070
1071 private:
1072 bool ApproximateRetainedSizes();
1073 bool BuildDominatorTree(const Vector<HeapEntry*>& entries,
1074 Vector<HeapEntry*>* dominators);
1075 bool CountEntriesAndReferences();
1076 bool FillReferences();
1077 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries);
1078 void ProgressStep();
1079 bool ProgressReport(bool force = false);
1080 bool SetEntriesDominators();
1008 void SetProgressTotal(int iterations_count); 1081 void SetProgressTotal(int iterations_count);
1009 1082
1010 HeapSnapshot* snapshot_; 1083 HeapSnapshot* snapshot_;
1011 v8::ActivityControl* control_; 1084 v8::ActivityControl* control_;
1012 HeapSnapshotsCollection* collection_; 1085 V8HeapExplorer v8_heap_explorer_;
1013 // Mapping from HeapObject* pointers to HeapEntry* pointers. 1086 // Mapping from HeapThing pointers to HeapEntry* pointers.
1014 HeapEntriesMap entries_; 1087 HeapEntriesMap entries_;
1015 SnapshotFillerInterface* filler_;
1016 // Used during references extraction to mark heap objects that
1017 // are references via non-hidden properties.
1018 HeapObjectsSet known_references_;
1019 // Used during snapshot generation. 1088 // Used during snapshot generation.
1020 int progress_counter_; 1089 int progress_counter_;
1021 int progress_total_; 1090 int progress_total_;
1022 1091
1023 friend class IndexedReferencesExtractor;
1024 friend class RootsReferencesExtractor;
1025
1026 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); 1092 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator);
1027 }; 1093 };
1028 1094
1029 class OutputStreamWriter; 1095 class OutputStreamWriter;
1030 1096
1031 class HeapSnapshotJSONSerializer { 1097 class HeapSnapshotJSONSerializer {
1032 public: 1098 public:
1033 explicit HeapSnapshotJSONSerializer(HeapSnapshot* snapshot) 1099 explicit HeapSnapshotJSONSerializer(HeapSnapshot* snapshot)
1034 : snapshot_(snapshot), 1100 : snapshot_(snapshot),
1035 nodes_(ObjectsMatch), 1101 nodes_(ObjectsMatch),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 }; 1142 };
1077 1143
1078 1144
1079 String* GetConstructorNameForHeapProfile(JSObject* object); 1145 String* GetConstructorNameForHeapProfile(JSObject* object);
1080 1146
1081 } } // namespace v8::internal 1147 } } // namespace v8::internal
1082 1148
1083 #endif // ENABLE_LOGGING_AND_PROFILING 1149 #endif // ENABLE_LOGGING_AND_PROFILING
1084 1150
1085 #endif // V8_PROFILE_GENERATOR_H_ 1151 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/platform-win32.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698