| Index: src/heap-snapshot-generator.h
|
| diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h
|
| index e55513f890dad9366f79f7017490eddb9ac5d396..b33b7f001b550ca90092fe0852290fbcf5b9bcbd 100644
|
| --- a/src/heap-snapshot-generator.h
|
| +++ b/src/heap-snapshot-generator.h
|
| @@ -154,21 +154,19 @@ class HeapEntry BASE_EMBEDDED {
|
| };
|
|
|
|
|
| -class HeapSnapshotsCollection;
|
| -
|
| // HeapSnapshot represents a single heap snapshot. It is stored in
|
| -// HeapSnapshotsCollection, which is also a factory for
|
| +// HeapProfiler, which is also a factory for
|
| // HeapSnapshots. All HeapSnapshots share strings copied from JS heap
|
| // to be able to return them even if they were collected.
|
| // HeapSnapshotGenerator fills in a HeapSnapshot.
|
| class HeapSnapshot {
|
| public:
|
| - HeapSnapshot(HeapSnapshotsCollection* collection,
|
| + HeapSnapshot(HeapProfiler* profiler,
|
| const char* title,
|
| unsigned uid);
|
| void Delete();
|
|
|
| - HeapSnapshotsCollection* collection() { return collection_; }
|
| + HeapProfiler* profiler() { return profiler_; }
|
| const char* title() { return title_; }
|
| unsigned uid() { return uid_; }
|
| size_t RawSnapshotSize() const;
|
| @@ -202,7 +200,7 @@ class HeapSnapshot {
|
| void PrintEntriesSize();
|
|
|
| private:
|
| - HeapSnapshotsCollection* collection_;
|
| + HeapProfiler* profiler_;
|
| const char* title_;
|
| unsigned uid_;
|
| int root_index_;
|
| @@ -227,7 +225,6 @@ class HeapObjectsMap {
|
|
|
| Heap* heap() const { return heap_; }
|
|
|
| - void SnapshotGenerationFinished();
|
| SnapshotObjectId FindEntry(Address addr);
|
| SnapshotObjectId FindOrAddEntry(Address addr,
|
| unsigned int size,
|
| @@ -242,7 +239,7 @@ class HeapObjectsMap {
|
| SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
|
| size_t GetUsedMemorySize() const;
|
|
|
| - static SnapshotObjectId GenerateId(Heap* heap, v8::RetainedObjectInfo* info);
|
| + SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info);
|
| static inline SnapshotObjectId GetNthGcSubrootId(int delta);
|
|
|
| static const int kObjectIdStep = 2;
|
| @@ -255,6 +252,7 @@ class HeapObjectsMap {
|
| int FindUntrackedObjects();
|
|
|
| void UpdateHeapObjectsMap();
|
| + void RemoveDeadEntries();
|
|
|
| private:
|
| struct EntryInfo {
|
| @@ -274,8 +272,6 @@ class HeapObjectsMap {
|
| uint32_t count;
|
| };
|
|
|
| - void RemoveDeadEntries();
|
| -
|
| SnapshotObjectId next_id_;
|
| HashMap entries_map_;
|
| List<EntryInfo> entries_;
|
| @@ -286,59 +282,6 @@ class HeapObjectsMap {
|
| };
|
|
|
|
|
| -class HeapSnapshotsCollection {
|
| - public:
|
| - explicit HeapSnapshotsCollection(Heap* heap);
|
| - ~HeapSnapshotsCollection();
|
| -
|
| - Heap* heap() const { return ids_.heap(); }
|
| -
|
| - SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) {
|
| - return ids_.PushHeapObjectsStats(stream);
|
| - }
|
| - void StartHeapObjectsTracking(bool track_allocations);
|
| - void StopHeapObjectsTracking();
|
| -
|
| - HeapSnapshot* NewSnapshot(const char* name, unsigned uid);
|
| - void SnapshotGenerationFinished(HeapSnapshot* snapshot);
|
| - List<HeapSnapshot*>* snapshots() { return &snapshots_; }
|
| - void RemoveSnapshot(HeapSnapshot* snapshot);
|
| -
|
| - StringsStorage* names() { return &names_; }
|
| - AllocationTracker* allocation_tracker() { return allocation_tracker_; }
|
| -
|
| - SnapshotObjectId FindObjectId(Address object_addr) {
|
| - return ids_.FindEntry(object_addr);
|
| - }
|
| - SnapshotObjectId GetObjectId(Address object_addr, int object_size) {
|
| - return ids_.FindOrAddEntry(object_addr, object_size);
|
| - }
|
| - Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
|
| - void ObjectMoveEvent(Address from, Address to, int size) {
|
| - ids_.MoveObject(from, to, size);
|
| - }
|
| - void AllocationEvent(Address addr, int size);
|
| - void UpdateObjectSizeEvent(Address addr, int size) {
|
| - ids_.UpdateObjectSize(addr, size);
|
| - }
|
| - SnapshotObjectId last_assigned_id() const {
|
| - return ids_.last_assigned_id();
|
| - }
|
| - size_t GetUsedMemorySize() const;
|
| -
|
| - int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); }
|
| -
|
| - private:
|
| - List<HeapSnapshot*> snapshots_;
|
| - StringsStorage names_;
|
| - // Mapping from HeapObject addresses to objects' uids.
|
| - HeapObjectsMap ids_;
|
| - AllocationTracker* allocation_tracker_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection);
|
| -};
|
| -
|
| -
|
| // A typedef for referencing anything that can be snapshotted living
|
| // in any kind of heap memory.
|
| typedef void* HeapThing;
|
| @@ -531,7 +474,8 @@ class V8HeapExplorer : public HeapEntriesAllocator {
|
|
|
| Heap* heap_;
|
| HeapSnapshot* snapshot_;
|
| - HeapSnapshotsCollection* collection_;
|
| + StringsStorage* names_;
|
| + HeapObjectsMap* heap_object_map_;
|
| SnapshottingProgressReportingInterface* progress_;
|
| SnapshotFillerInterface* filler_;
|
| HeapObjectsSet objects_tags_;
|
| @@ -592,7 +536,7 @@ class NativeObjectsExplorer {
|
|
|
| Isolate* isolate_;
|
| HeapSnapshot* snapshot_;
|
| - HeapSnapshotsCollection* collection_;
|
| + StringsStorage* names_;
|
| SnapshottingProgressReportingInterface* progress_;
|
| bool embedder_queried_;
|
| HeapObjectsSet in_groups_;
|
|
|