OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(bool track_allocations); | 56 void StartHeapObjectsTracking(bool track_allocations); |
57 void StopHeapObjectsTracking(); | 57 void StopHeapObjectsTracking(); |
58 AllocationTracker* allocation_tracker() { return *allocation_tracker_; } | 58 AllocationTracker* allocation_tracker() const { |
59 HeapObjectsMap* heap_object_map() { return *ids_; } | 59 return allocation_tracker_.get(); |
60 StringsStorage* names() { return *names_; } | 60 } |
| 61 HeapObjectsMap* heap_object_map() const { return ids_.get(); } |
| 62 StringsStorage* names() const { return names_.get(); } |
61 | 63 |
62 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); | 64 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); |
63 int GetSnapshotsCount(); | 65 int GetSnapshotsCount(); |
64 HeapSnapshot* GetSnapshot(int index); | 66 HeapSnapshot* GetSnapshot(int index); |
65 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); | 67 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); |
66 void DeleteAllSnapshots(); | 68 void DeleteAllSnapshots(); |
67 void RemoveSnapshot(HeapSnapshot* snapshot); | 69 void RemoveSnapshot(HeapSnapshot* snapshot); |
68 | 70 |
69 void ObjectMoveEvent(Address from, Address to, int size); | 71 void ObjectMoveEvent(Address from, Address to, int size); |
70 | 72 |
71 void AllocationEvent(Address addr, int size); | 73 void AllocationEvent(Address addr, int size); |
72 | 74 |
73 void UpdateObjectSizeEvent(Address addr, int size); | 75 void UpdateObjectSizeEvent(Address addr, int size); |
74 | 76 |
75 void DefineWrapperClass( | 77 void DefineWrapperClass( |
76 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); | 78 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); |
77 | 79 |
78 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, | 80 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, |
79 Object** wrapper); | 81 Object** wrapper); |
80 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); | 82 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); |
81 | 83 |
82 bool is_tracking_object_moves() const { return is_tracking_object_moves_; } | 84 bool is_tracking_object_moves() const { return is_tracking_object_moves_; } |
83 bool is_tracking_allocations() { return !allocation_tracker_.is_empty(); } | 85 bool is_tracking_allocations() const { |
| 86 return !allocation_tracker_.is_empty(); |
| 87 } |
84 | 88 |
85 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); | 89 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); |
86 | 90 |
87 private: | 91 private: |
88 Heap* heap() const { return ids_->heap(); } | 92 Heap* heap() const { return ids_->heap(); } |
89 | 93 |
90 // Mapping from HeapObject addresses to objects' uids. | 94 // Mapping from HeapObject addresses to objects' uids. |
91 SmartPointer<HeapObjectsMap> ids_; | 95 SmartPointer<HeapObjectsMap> ids_; |
92 List<HeapSnapshot*> snapshots_; | 96 List<HeapSnapshot*> snapshots_; |
93 SmartPointer<StringsStorage> names_; | 97 SmartPointer<StringsStorage> names_; |
94 unsigned next_snapshot_uid_; | 98 unsigned next_snapshot_uid_; |
95 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; | 99 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
96 SmartPointer<AllocationTracker> allocation_tracker_; | 100 SmartPointer<AllocationTracker> allocation_tracker_; |
97 bool is_tracking_object_moves_; | 101 bool is_tracking_object_moves_; |
98 }; | 102 }; |
99 | 103 |
100 } } // namespace v8::internal | 104 } } // namespace v8::internal |
101 | 105 |
102 #endif // V8_HEAP_PROFILER_H_ | 106 #endif // V8_HEAP_PROFILER_H_ |
OLD | NEW |