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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void RemoveSnapshot(HeapSnapshot* snapshot); | 306 void RemoveSnapshot(HeapSnapshot* snapshot); |
307 | 307 |
308 StringsStorage* names() { return &names_; } | 308 StringsStorage* names() { return &names_; } |
309 TokenEnumerator* token_enumerator() { return token_enumerator_; } | |
310 | 309 |
311 SnapshotObjectId FindObjectId(Address object_addr) { | 310 SnapshotObjectId FindObjectId(Address object_addr) { |
312 return ids_.FindEntry(object_addr); | 311 return ids_.FindEntry(object_addr); |
313 } | 312 } |
314 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { | 313 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { |
315 return ids_.FindOrAddEntry(object_addr, object_size); | 314 return ids_.FindOrAddEntry(object_addr, object_size); |
316 } | 315 } |
317 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); | 316 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); |
318 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 317 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
319 SnapshotObjectId last_assigned_id() const { | 318 SnapshotObjectId last_assigned_id() const { |
320 return ids_.last_assigned_id(); | 319 return ids_.last_assigned_id(); |
321 } | 320 } |
322 size_t GetUsedMemorySize() const; | 321 size_t GetUsedMemorySize() const; |
323 | 322 |
324 private: | 323 private: |
325 bool is_tracking_objects_; // Whether tracking object moves is needed. | 324 bool is_tracking_objects_; // Whether tracking object moves is needed. |
326 List<HeapSnapshot*> snapshots_; | 325 List<HeapSnapshot*> snapshots_; |
327 StringsStorage names_; | 326 StringsStorage names_; |
328 TokenEnumerator* token_enumerator_; | |
329 // Mapping from HeapObject addresses to objects' uids. | 327 // Mapping from HeapObject addresses to objects' uids. |
330 HeapObjectsMap ids_; | 328 HeapObjectsMap ids_; |
331 | 329 |
332 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); | 330 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); |
333 }; | 331 }; |
334 | 332 |
335 | 333 |
336 // A typedef for referencing anything that can be snapshotted living | 334 // A typedef for referencing anything that can be snapshotted living |
337 // in any kind of heap memory. | 335 // in any kind of heap memory. |
338 typedef void* HeapThing; | 336 typedef void* HeapThing; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 friend class HeapSnapshotJSONSerializerIterator; | 677 friend class HeapSnapshotJSONSerializerIterator; |
680 | 678 |
681 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 679 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
682 }; | 680 }; |
683 | 681 |
684 | 682 |
685 } } // namespace v8::internal | 683 } } // namespace v8::internal |
686 | 684 |
687 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ | 685 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ |
688 | 686 |
OLD | NEW |