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

Side by Side Diff: src/heap-snapshot-generator.h

Issue 12475016: Maintain API compatibility with older versions of V8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/heap-profiler.cc ('k') | src/heap-snapshot-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 class HeapSnapshotsCollection; 151 class HeapSnapshotsCollection;
152 152
153 // HeapSnapshot represents a single heap snapshot. It is stored in 153 // HeapSnapshot represents a single heap snapshot. It is stored in
154 // HeapSnapshotsCollection, which is also a factory for 154 // HeapSnapshotsCollection, which is also a factory for
155 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap 155 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap
156 // to be able to return them even if they were collected. 156 // to be able to return them even if they were collected.
157 // HeapSnapshotGenerator fills in a HeapSnapshot. 157 // HeapSnapshotGenerator fills in a HeapSnapshot.
158 class HeapSnapshot { 158 class HeapSnapshot {
159 public: 159 public:
160 enum Type {
161 kFull = v8::HeapSnapshot::kFull
162 };
163
160 HeapSnapshot(HeapSnapshotsCollection* collection, 164 HeapSnapshot(HeapSnapshotsCollection* collection,
165 Type type,
161 const char* title, 166 const char* title,
162 unsigned uid); 167 unsigned uid);
163 void Delete(); 168 void Delete();
164 169
165 HeapSnapshotsCollection* collection() { return collection_; } 170 HeapSnapshotsCollection* collection() { return collection_; }
171 Type type() { return type_; }
166 const char* title() { return title_; } 172 const char* title() { return title_; }
167 unsigned uid() { return uid_; } 173 unsigned uid() { return uid_; }
168 size_t RawSnapshotSize() const; 174 size_t RawSnapshotSize() const;
169 HeapEntry* root() { return &entries_[root_index_]; } 175 HeapEntry* root() { return &entries_[root_index_]; }
170 HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; } 176 HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; }
171 HeapEntry* natives_root() { return &entries_[natives_root_index_]; } 177 HeapEntry* natives_root() { return &entries_[natives_root_index_]; }
172 HeapEntry* gc_subroot(int index) { 178 HeapEntry* gc_subroot(int index) {
173 return &entries_[gc_subroot_indexes_[index]]; 179 return &entries_[gc_subroot_indexes_[index]];
174 } 180 }
175 List<HeapEntry>& entries() { return entries_; } 181 List<HeapEntry>& entries() { return entries_; }
(...skipping 14 matching lines...) Expand all
190 HeapEntry* AddNativesRootEntry(); 196 HeapEntry* AddNativesRootEntry();
191 HeapEntry* GetEntryById(SnapshotObjectId id); 197 HeapEntry* GetEntryById(SnapshotObjectId id);
192 List<HeapEntry*>* GetSortedEntriesList(); 198 List<HeapEntry*>* GetSortedEntriesList();
193 void FillChildren(); 199 void FillChildren();
194 200
195 void Print(int max_depth); 201 void Print(int max_depth);
196 void PrintEntriesSize(); 202 void PrintEntriesSize();
197 203
198 private: 204 private:
199 HeapSnapshotsCollection* collection_; 205 HeapSnapshotsCollection* collection_;
206 Type type_;
200 const char* title_; 207 const char* title_;
201 unsigned uid_; 208 unsigned uid_;
202 int root_index_; 209 int root_index_;
203 int gc_roots_index_; 210 int gc_roots_index_;
204 int natives_root_index_; 211 int natives_root_index_;
205 int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags]; 212 int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags];
206 List<HeapEntry> entries_; 213 List<HeapEntry> entries_;
207 List<HeapGraphEdge> edges_; 214 List<HeapGraphEdge> edges_;
208 List<HeapGraphEdge*> children_; 215 List<HeapGraphEdge*> children_;
209 List<HeapEntry*> sorted_entries_; 216 List<HeapEntry*> sorted_entries_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 298
292 Heap* heap() const { return ids_.heap(); } 299 Heap* heap() const { return ids_.heap(); }
293 300
294 bool is_tracking_objects() { return is_tracking_objects_; } 301 bool is_tracking_objects() { return is_tracking_objects_; }
295 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { 302 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) {
296 return ids_.PushHeapObjectsStats(stream); 303 return ids_.PushHeapObjectsStats(stream);
297 } 304 }
298 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } 305 void StartHeapObjectsTracking() { is_tracking_objects_ = true; }
299 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } 306 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); }
300 307
301 HeapSnapshot* NewSnapshot(const char* name, unsigned uid); 308 HeapSnapshot* NewSnapshot(
309 HeapSnapshot::Type type, const char* name, unsigned uid);
302 void SnapshotGenerationFinished(HeapSnapshot* snapshot); 310 void SnapshotGenerationFinished(HeapSnapshot* snapshot);
303 List<HeapSnapshot*>* snapshots() { return &snapshots_; } 311 List<HeapSnapshot*>* snapshots() { return &snapshots_; }
304 HeapSnapshot* GetSnapshot(unsigned uid); 312 HeapSnapshot* GetSnapshot(unsigned uid);
305 void RemoveSnapshot(HeapSnapshot* snapshot); 313 void RemoveSnapshot(HeapSnapshot* snapshot);
306 314
307 StringsStorage* names() { return &names_; } 315 StringsStorage* names() { return &names_; }
308 TokenEnumerator* token_enumerator() { return token_enumerator_; } 316 TokenEnumerator* token_enumerator() { return token_enumerator_; }
309 317
310 SnapshotObjectId FindObjectId(Address object_addr) { 318 SnapshotObjectId FindObjectId(Address object_addr) {
311 return ids_.FindEntry(object_addr); 319 return ids_.FindEntry(object_addr);
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 friend class HeapSnapshotJSONSerializerIterator; 689 friend class HeapSnapshotJSONSerializerIterator;
682 690
683 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); 691 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
684 }; 692 };
685 693
686 694
687 } } // namespace v8::internal 695 } } // namespace v8::internal
688 696
689 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ 697 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_
690 698
OLDNEW
« no previous file with comments | « src/heap-profiler.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698