OLD | NEW |
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 }; | 287 }; |
288 | 288 |
289 | 289 |
290 class HeapSnapshotsCollection { | 290 class HeapSnapshotsCollection { |
291 public: | 291 public: |
292 explicit HeapSnapshotsCollection(Heap* heap); | 292 explicit HeapSnapshotsCollection(Heap* heap); |
293 ~HeapSnapshotsCollection(); | 293 ~HeapSnapshotsCollection(); |
294 | 294 |
295 Heap* heap() const { return ids_.heap(); } | 295 Heap* heap() const { return ids_.heap(); } |
296 | 296 |
297 bool is_tracking_objects() { return is_tracking_objects_; } | |
298 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { | 297 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { |
299 return ids_.PushHeapObjectsStats(stream); | 298 return ids_.PushHeapObjectsStats(stream); |
300 } | 299 } |
301 void StartHeapObjectsTracking(); | 300 void StartHeapObjectsTracking(); |
302 void StopHeapObjectsTracking(); | 301 void StopHeapObjectsTracking(); |
303 | 302 |
304 HeapSnapshot* NewSnapshot(const char* name, unsigned uid); | 303 HeapSnapshot* NewSnapshot(const char* name, unsigned uid); |
305 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 304 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
306 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 305 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
307 void RemoveSnapshot(HeapSnapshot* snapshot); | 306 void RemoveSnapshot(HeapSnapshot* snapshot); |
(...skipping 15 matching lines...) Expand all Loading... |
323 void UpdateObjectSizeEvent(Address addr, int size) { | 322 void UpdateObjectSizeEvent(Address addr, int size) { |
324 ids_.UpdateObjectSize(addr, size); | 323 ids_.UpdateObjectSize(addr, size); |
325 } | 324 } |
326 SnapshotObjectId last_assigned_id() const { | 325 SnapshotObjectId last_assigned_id() const { |
327 return ids_.last_assigned_id(); | 326 return ids_.last_assigned_id(); |
328 } | 327 } |
329 size_t GetUsedMemorySize() const; | 328 size_t GetUsedMemorySize() const; |
330 | 329 |
331 int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); } | 330 int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); } |
332 | 331 |
333 void UpdateHeapObjectsMap() { ids_.UpdateHeapObjectsMap(); } | |
334 | |
335 private: | 332 private: |
336 bool is_tracking_objects_; // Whether tracking object moves is needed. | |
337 List<HeapSnapshot*> snapshots_; | 333 List<HeapSnapshot*> snapshots_; |
338 StringsStorage names_; | 334 StringsStorage names_; |
339 // Mapping from HeapObject addresses to objects' uids. | 335 // Mapping from HeapObject addresses to objects' uids. |
340 HeapObjectsMap ids_; | 336 HeapObjectsMap ids_; |
341 AllocationTracker* allocation_tracker_; | 337 AllocationTracker* allocation_tracker_; |
342 | 338 |
343 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); | 339 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); |
344 }; | 340 }; |
345 | 341 |
346 | 342 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 friend class HeapSnapshotJSONSerializerEnumerator; | 693 friend class HeapSnapshotJSONSerializerEnumerator; |
698 friend class HeapSnapshotJSONSerializerIterator; | 694 friend class HeapSnapshotJSONSerializerIterator; |
699 | 695 |
700 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 696 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
701 }; | 697 }; |
702 | 698 |
703 | 699 |
704 } } // namespace v8::internal | 700 } } // namespace v8::internal |
705 | 701 |
706 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ | 702 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ |
OLD | NEW |