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

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

Issue 34523002: [Sheriff] Revert "Record allocation stack traces" and "Temporarily disable test-heap-profiler/Track… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/allocation-tracker.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 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_HEAP_SNAPSHOT_GENERATOR_H_ 28 #ifndef V8_HEAP_SNAPSHOT_GENERATOR_H_
29 #define V8_HEAP_SNAPSHOT_GENERATOR_H_ 29 #define V8_HEAP_SNAPSHOT_GENERATOR_H_
30 30
31 #include "profile-generator-inl.h" 31 #include "profile-generator-inl.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 class AllocationTracker;
37 class AllocationTraceNode;
38 class HeapEntry; 36 class HeapEntry;
39 class HeapSnapshot; 37 class HeapSnapshot;
40 38
41 class HeapGraphEdge BASE_EMBEDDED { 39 class HeapGraphEdge BASE_EMBEDDED {
42 public: 40 public:
43 enum Type { 41 enum Type {
44 kContextVariable = v8::HeapGraphEdge::kContextVariable, 42 kContextVariable = v8::HeapGraphEdge::kContextVariable,
45 kElement = v8::HeapGraphEdge::kElement, 43 kElement = v8::HeapGraphEdge::kElement,
46 kProperty = v8::HeapGraphEdge::kProperty, 44 kProperty = v8::HeapGraphEdge::kProperty,
47 kInternal = v8::HeapGraphEdge::kInternal, 45 kInternal = v8::HeapGraphEdge::kInternal,
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 public: 289 public:
292 explicit HeapSnapshotsCollection(Heap* heap); 290 explicit HeapSnapshotsCollection(Heap* heap);
293 ~HeapSnapshotsCollection(); 291 ~HeapSnapshotsCollection();
294 292
295 Heap* heap() const { return ids_.heap(); } 293 Heap* heap() const { return ids_.heap(); }
296 294
297 bool is_tracking_objects() { return is_tracking_objects_; } 295 bool is_tracking_objects() { return is_tracking_objects_; }
298 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { 296 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) {
299 return ids_.PushHeapObjectsStats(stream); 297 return ids_.PushHeapObjectsStats(stream);
300 } 298 }
301 void StartHeapObjectsTracking(); 299 void StartHeapObjectsTracking() { is_tracking_objects_ = true; }
302 void StopHeapObjectsTracking(); 300 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); }
303 301
304 HeapSnapshot* NewSnapshot(const char* name, unsigned uid); 302 HeapSnapshot* NewSnapshot(const char* name, unsigned uid);
305 void SnapshotGenerationFinished(HeapSnapshot* snapshot); 303 void SnapshotGenerationFinished(HeapSnapshot* snapshot);
306 List<HeapSnapshot*>* snapshots() { return &snapshots_; } 304 List<HeapSnapshot*>* snapshots() { return &snapshots_; }
307 void RemoveSnapshot(HeapSnapshot* snapshot); 305 void RemoveSnapshot(HeapSnapshot* snapshot);
308 306
309 StringsStorage* names() { return &names_; } 307 StringsStorage* names() { return &names_; }
310 AllocationTracker* allocation_tracker() { return allocation_tracker_; }
311 308
312 SnapshotObjectId FindObjectId(Address object_addr) { 309 SnapshotObjectId FindObjectId(Address object_addr) {
313 return ids_.FindEntry(object_addr); 310 return ids_.FindEntry(object_addr);
314 } 311 }
315 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { 312 SnapshotObjectId GetObjectId(Address object_addr, int object_size) {
316 return ids_.FindOrAddEntry(object_addr, object_size); 313 return ids_.FindOrAddEntry(object_addr, object_size);
317 } 314 }
318 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); 315 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
319 void ObjectMoveEvent(Address from, Address to, int size) { 316 void ObjectMoveEvent(Address from, Address to, int size) {
320 ids_.MoveObject(from, to, size); 317 ids_.MoveObject(from, to, size);
321 } 318 }
322 void NewObjectEvent(Address addr, int size); 319 void NewObjectEvent(Address addr, int size) { ids_.NewObject(addr, size); }
323 void UpdateObjectSizeEvent(Address addr, int size) { 320 void UpdateObjectSizeEvent(Address addr, int size) {
324 ids_.UpdateObjectSize(addr, size); 321 ids_.UpdateObjectSize(addr, size);
325 } 322 }
326 SnapshotObjectId last_assigned_id() const { 323 SnapshotObjectId last_assigned_id() const {
327 return ids_.last_assigned_id(); 324 return ids_.last_assigned_id();
328 } 325 }
329 size_t GetUsedMemorySize() const; 326 size_t GetUsedMemorySize() const;
330 327
331 int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); } 328 int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); }
332 329
333 void UpdateHeapObjectsMap() { ids_.UpdateHeapObjectsMap(); } 330 void UpdateHeapObjectsMap() { ids_.UpdateHeapObjectsMap(); }
334 331
335 private: 332 private:
336 bool is_tracking_objects_; // Whether tracking object moves is needed. 333 bool is_tracking_objects_; // Whether tracking object moves is needed.
337 List<HeapSnapshot*> snapshots_; 334 List<HeapSnapshot*> snapshots_;
338 StringsStorage names_; 335 StringsStorage names_;
339 // Mapping from HeapObject addresses to objects' uids. 336 // Mapping from HeapObject addresses to objects' uids.
340 HeapObjectsMap ids_; 337 HeapObjectsMap ids_;
341 AllocationTracker* allocation_tracker_;
342 338
343 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection); 339 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection);
344 }; 340 };
345 341
346 342
347 // A typedef for referencing anything that can be snapshotted living 343 // A typedef for referencing anything that can be snapshotted living
348 // in any kind of heap memory. 344 // in any kind of heap memory.
349 typedef void* HeapThing; 345 typedef void* HeapThing;
350 346
351 347
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 666 }
671 667
672 int GetStringId(const char* s); 668 int GetStringId(const char* s);
673 int entry_index(HeapEntry* e) { return e->index() * kNodeFieldsCount; } 669 int entry_index(HeapEntry* e) { return e->index() * kNodeFieldsCount; }
674 void SerializeEdge(HeapGraphEdge* edge, bool first_edge); 670 void SerializeEdge(HeapGraphEdge* edge, bool first_edge);
675 void SerializeEdges(); 671 void SerializeEdges();
676 void SerializeImpl(); 672 void SerializeImpl();
677 void SerializeNode(HeapEntry* entry); 673 void SerializeNode(HeapEntry* entry);
678 void SerializeNodes(); 674 void SerializeNodes();
679 void SerializeSnapshot(); 675 void SerializeSnapshot();
680 void SerializeTraceTree();
681 void SerializeTraceNode(AllocationTraceNode* node);
682 void SerializeTraceNodeInfos();
683 void SerializeString(const unsigned char* s); 676 void SerializeString(const unsigned char* s);
684 void SerializeStrings(); 677 void SerializeStrings();
685 678
686 static const int kEdgeFieldsCount; 679 static const int kEdgeFieldsCount;
687 static const int kNodeFieldsCount; 680 static const int kNodeFieldsCount;
688 681
689 HeapSnapshot* snapshot_; 682 HeapSnapshot* snapshot_;
690 HashMap strings_; 683 HashMap strings_;
691 int next_node_id_; 684 int next_node_id_;
692 int next_string_id_; 685 int next_string_id_;
693 OutputStreamWriter* writer_; 686 OutputStreamWriter* writer_;
694 687
695 friend class HeapSnapshotJSONSerializerEnumerator; 688 friend class HeapSnapshotJSONSerializerEnumerator;
696 friend class HeapSnapshotJSONSerializerIterator; 689 friend class HeapSnapshotJSONSerializerIterator;
697 690
698 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); 691 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
699 }; 692 };
700 693
701 694
702 } } // namespace v8::internal 695 } } // namespace v8::internal
703 696
704 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ 697 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_
705 698
OLDNEW
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698