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

Side by Side Diff: src/heap-profiler.h

Issue 136643008: A64: Synchronize with r18256. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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/heap-inl.h ('k') | src/heap-profiler.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 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-2010 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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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_PROFILER_H_ 28 #ifndef V8_HEAP_PROFILER_H_
29 #define V8_HEAP_PROFILER_H_ 29 #define V8_HEAP_PROFILER_H_
30 30
31 #include "heap-snapshot-generator-inl.h" 31 #include "heap-snapshot-generator-inl.h"
32 #include "isolate.h" 32 #include "isolate.h"
33 #include "smart-pointers.h"
33 34
34 namespace v8 { 35 namespace v8 {
35 namespace internal { 36 namespace internal {
36 37
37 class HeapSnapshot; 38 class HeapSnapshot;
38 class HeapSnapshotsCollection;
39 39
40 class HeapProfiler { 40 class HeapProfiler {
41 public: 41 public:
42 explicit HeapProfiler(Heap* heap); 42 explicit HeapProfiler(Heap* heap);
43 ~HeapProfiler(); 43 ~HeapProfiler();
44 44
45 size_t GetMemorySizeUsedByProfiler(); 45 size_t GetMemorySizeUsedByProfiler();
46 46
47 HeapSnapshot* TakeSnapshot( 47 HeapSnapshot* TakeSnapshot(
48 const char* name, 48 const char* name,
49 v8::ActivityControl* control, 49 v8::ActivityControl* control,
50 v8::HeapProfiler::ObjectNameResolver* resolver); 50 v8::HeapProfiler::ObjectNameResolver* resolver);
51 HeapSnapshot* TakeSnapshot( 51 HeapSnapshot* TakeSnapshot(
52 String* name, 52 String* name,
53 v8::ActivityControl* control, 53 v8::ActivityControl* control,
54 v8::HeapProfiler::ObjectNameResolver* resolver); 54 v8::HeapProfiler::ObjectNameResolver* resolver);
55 55
56 void StartHeapObjectsTracking(); 56 void StartHeapObjectsTracking(bool track_allocations);
57 void StopHeapObjectsTracking(); 57 void StopHeapObjectsTracking();
58 AllocationTracker* allocation_tracker() { return *allocation_tracker_; }
59 HeapObjectsMap* heap_object_map() { return *ids_; }
60 StringsStorage* names() { return *names_; }
58 61
59 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 62 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
60 int GetSnapshotsCount(); 63 int GetSnapshotsCount();
61 HeapSnapshot* GetSnapshot(int index); 64 HeapSnapshot* GetSnapshot(int index);
62 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); 65 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
63 void DeleteAllSnapshots(); 66 void DeleteAllSnapshots();
67 void RemoveSnapshot(HeapSnapshot* snapshot);
64 68
65 void ObjectMoveEvent(Address from, Address to, int size); 69 void ObjectMoveEvent(Address from, Address to, int size);
66 70
67 void NewObjectEvent(Address addr, int size); 71 void AllocationEvent(Address addr, int size);
68 72
69 void UpdateObjectSizeEvent(Address addr, int size); 73 void UpdateObjectSizeEvent(Address addr, int size);
70 74
71 void DefineWrapperClass( 75 void DefineWrapperClass(
72 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); 76 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
73 77
74 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, 78 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
75 Object** wrapper); 79 Object** wrapper);
76 INLINE(bool is_profiling()) {
77 return snapshots_->is_tracking_objects();
78 }
79
80 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); 80 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
81 81
82 bool is_tracking_allocations() { 82 bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
83 return is_tracking_allocations_; 83 bool is_tracking_allocations() { return !allocation_tracker_.is_empty(); }
84 }
85 84
86 void StartHeapAllocationsRecording(); 85 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
87 void StopHeapAllocationsRecording();
88
89 int FindUntrackedObjects() {
90 return snapshots_->FindUntrackedObjects();
91 }
92 86
93 private: 87 private:
94 Heap* heap() const { return snapshots_->heap(); } 88 Heap* heap() const { return ids_->heap(); }
95 89
96 HeapSnapshotsCollection* snapshots_; 90 // Mapping from HeapObject addresses to objects' uids.
91 SmartPointer<HeapObjectsMap> ids_;
92 List<HeapSnapshot*> snapshots_;
93 SmartPointer<StringsStorage> names_;
97 unsigned next_snapshot_uid_; 94 unsigned next_snapshot_uid_;
98 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 95 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
99 bool is_tracking_allocations_; 96 SmartPointer<AllocationTracker> allocation_tracker_;
97 bool is_tracking_object_moves_;
100 }; 98 };
101 99
102 } } // namespace v8::internal 100 } } // namespace v8::internal
103 101
104 #endif // V8_HEAP_PROFILER_H_ 102 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698