| 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 12 matching lines...) Expand all Loading... |
| 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 "arguments.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 class HeapSnapshotsCollection; |
| 39 | 40 |
| 40 class HeapProfiler { | 41 class HeapProfiler { |
| 41 public: | 42 public: |
| 42 explicit HeapProfiler(Heap* heap); | 43 explicit HeapProfiler(Heap* heap); |
| 43 ~HeapProfiler(); | 44 ~HeapProfiler(); |
| 44 | 45 |
| 45 size_t GetMemorySizeUsedByProfiler(); | 46 size_t GetMemorySizeUsedByProfiler(); |
| 46 | 47 |
| 47 HeapSnapshot* TakeSnapshot( | 48 HeapSnapshot* TakeSnapshot( |
| 48 const char* name, | 49 const char* name, |
| 49 v8::ActivityControl* control, | 50 v8::ActivityControl* control, |
| 50 v8::HeapProfiler::ObjectNameResolver* resolver); | 51 v8::HeapProfiler::ObjectNameResolver* resolver); |
| 51 HeapSnapshot* TakeSnapshot( | 52 HeapSnapshot* TakeSnapshot( |
| 52 String* name, | 53 String* name, |
| 53 v8::ActivityControl* control, | 54 v8::ActivityControl* control, |
| 54 v8::HeapProfiler::ObjectNameResolver* resolver); | 55 v8::HeapProfiler::ObjectNameResolver* resolver); |
| 55 | 56 |
| 56 void StartHeapObjectsTracking(); | 57 void StartHeapObjectsTracking(); |
| 57 void StopHeapObjectsTracking(); | 58 void StopHeapObjectsTracking(); |
| 58 | 59 |
| 59 static void RecordObjectAllocationFromMasm(Isolate* isolate, | |
| 60 Address obj, | |
| 61 int size); | |
| 62 | |
| 63 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); | 60 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); |
| 64 int GetSnapshotsCount(); | 61 int GetSnapshotsCount(); |
| 65 HeapSnapshot* GetSnapshot(int index); | 62 HeapSnapshot* GetSnapshot(int index); |
| 66 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); | 63 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); |
| 67 void DeleteAllSnapshots(); | 64 void DeleteAllSnapshots(); |
| 68 | 65 |
| 69 void ObjectMoveEvent(Address from, Address to, int size); | 66 void ObjectMoveEvent(Address from, Address to, int size); |
| 70 | 67 |
| 71 void NewObjectEvent(Address addr, int size); | 68 void NewObjectEvent(Address addr, int size); |
| 72 | 69 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 98 | 95 |
| 99 private: | 96 private: |
| 100 Heap* heap() const { return snapshots_->heap(); } | 97 Heap* heap() const { return snapshots_->heap(); } |
| 101 | 98 |
| 102 HeapSnapshotsCollection* snapshots_; | 99 HeapSnapshotsCollection* snapshots_; |
| 103 unsigned next_snapshot_uid_; | 100 unsigned next_snapshot_uid_; |
| 104 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; | 101 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
| 105 bool is_tracking_allocations_; | 102 bool is_tracking_allocations_; |
| 106 }; | 103 }; |
| 107 | 104 |
| 105 |
| 106 DECLARE_RUNTIME_FUNCTION(MaybeObject*, HeapProfiler_RecordObjectAllocation); |
| 107 |
| 108 |
| 108 } } // namespace v8::internal | 109 } } // namespace v8::internal |
| 109 | 110 |
| 110 #endif // V8_HEAP_PROFILER_H_ | 111 #endif // V8_HEAP_PROFILER_H_ |
| OLD | NEW |