| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 bool is_tracking_objects() { return is_tracking_objects_; } | 296 bool is_tracking_objects() { return is_tracking_objects_; } |
| 297 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { | 297 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { |
| 298 return ids_.PushHeapObjectsStats(stream); | 298 return ids_.PushHeapObjectsStats(stream); |
| 299 } | 299 } |
| 300 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } | 300 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } |
| 301 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } | 301 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } |
| 302 | 302 |
| 303 HeapSnapshot* NewSnapshot(const char* name, unsigned uid); | 303 HeapSnapshot* NewSnapshot(const char* name, unsigned uid); |
| 304 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 304 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
| 305 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 305 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
| 306 HeapSnapshot* GetSnapshot(unsigned uid); | |
| 307 void RemoveSnapshot(HeapSnapshot* snapshot); | 306 void RemoveSnapshot(HeapSnapshot* snapshot); |
| 308 | 307 |
| 309 StringsStorage* names() { return &names_; } | 308 StringsStorage* names() { return &names_; } |
| 310 TokenEnumerator* token_enumerator() { return token_enumerator_; } | 309 TokenEnumerator* token_enumerator() { return token_enumerator_; } |
| 311 | 310 |
| 312 SnapshotObjectId FindObjectId(Address object_addr) { | 311 SnapshotObjectId FindObjectId(Address object_addr) { |
| 313 return ids_.FindEntry(object_addr); | 312 return ids_.FindEntry(object_addr); |
| 314 } | 313 } |
| 315 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { | 314 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { |
| 316 return ids_.FindOrAddEntry(object_addr, object_size); | 315 return ids_.FindOrAddEntry(object_addr, object_size); |
| 317 } | 316 } |
| 318 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); | 317 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); |
| 319 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 318 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
| 320 SnapshotObjectId last_assigned_id() const { | 319 SnapshotObjectId last_assigned_id() const { |
| 321 return ids_.last_assigned_id(); | 320 return ids_.last_assigned_id(); |
| 322 } | 321 } |
| 323 size_t GetUsedMemorySize() const; | 322 size_t GetUsedMemorySize() const; |
| 324 | 323 |
| 325 private: | 324 private: |
| 326 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { | |
| 327 return key1 == key2; | |
| 328 } | |
| 329 | |
| 330 bool is_tracking_objects_; // Whether tracking object moves is needed. | 325 bool is_tracking_objects_; // Whether tracking object moves is needed. |
| 331 List<HeapSnapshot*> snapshots_; | 326 List<HeapSnapshot*> snapshots_; |
| 332 // Mapping from snapshots' uids to HeapSnapshot* pointers. | |
| 333 HashMap snapshots_uids_; | |
| 334 StringsStorage names_; | 327 StringsStorage names_; |
| 335 TokenEnumerator* token_enumerator_; | 328 TokenEnumerator* token_enumerator_; |
| 336 // Mapping from HeapObject addresses to objects' uids. | 329 // Mapping from HeapObject addresses to objects' uids. |
| 337 HeapObjectsMap ids_; | 330 HeapObjectsMap ids_; |
| 338 | 331 |
| 339 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); | 332 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); |
| 340 }; | 333 }; |
| 341 | 334 |
| 342 | 335 |
| 343 // A typedef for referencing anything that can be snapshotted living | 336 // A typedef for referencing anything that can be snapshotted living |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 friend class HeapSnapshotJSONSerializerIterator; | 679 friend class HeapSnapshotJSONSerializerIterator; |
| 687 | 680 |
| 688 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 681 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
| 689 }; | 682 }; |
| 690 | 683 |
| 691 | 684 |
| 692 } } // namespace v8::internal | 685 } } // namespace v8::internal |
| 693 | 686 |
| 694 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ | 687 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ |
| 695 | 688 |
| OLD | NEW |