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

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

Issue 39973003: Merge bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: again 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/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 19 matching lines...) Expand all
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 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 class HeapSnapshot; 37 class HeapSnapshot;
38 class HeapSnapshotsCollection; 38 class HeapSnapshotsCollection;
39 39
40 #define HEAP_PROFILE(heap, call) \
41 do { \
42 v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \
43 if (profiler != NULL && profiler->is_profiling()) { \
44 profiler->call; \
45 } \
46 } while (false)
47
48 class HeapProfiler { 40 class HeapProfiler {
49 public: 41 public:
50 explicit HeapProfiler(Heap* heap); 42 explicit HeapProfiler(Heap* heap);
51 ~HeapProfiler(); 43 ~HeapProfiler();
52 44
53 size_t GetMemorySizeUsedByProfiler(); 45 size_t GetMemorySizeUsedByProfiler();
54 46
55 HeapSnapshot* TakeSnapshot( 47 HeapSnapshot* TakeSnapshot(
56 const char* name, 48 const char* name,
57 v8::ActivityControl* control, 49 v8::ActivityControl* control,
58 v8::HeapProfiler::ObjectNameResolver* resolver); 50 v8::HeapProfiler::ObjectNameResolver* resolver);
59 HeapSnapshot* TakeSnapshot( 51 HeapSnapshot* TakeSnapshot(
60 String* name, 52 String* name,
61 v8::ActivityControl* control, 53 v8::ActivityControl* control,
62 v8::HeapProfiler::ObjectNameResolver* resolver); 54 v8::HeapProfiler::ObjectNameResolver* resolver);
63 55
64 void StartHeapObjectsTracking(); 56 void StartHeapObjectsTracking();
65 void StopHeapObjectsTracking(); 57 void StopHeapObjectsTracking();
58
59 static void RecordObjectAllocationFromMasm(Isolate* isolate,
60 Address obj,
61 int size);
62
66 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 63 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
67 int GetSnapshotsCount(); 64 int GetSnapshotsCount();
68 HeapSnapshot* GetSnapshot(int index); 65 HeapSnapshot* GetSnapshot(int index);
69 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); 66 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
70 void DeleteAllSnapshots(); 67 void DeleteAllSnapshots();
71 68
72 void ObjectMoveEvent(Address from, Address to); 69 void ObjectMoveEvent(Address from, Address to, int size);
70
71 void NewObjectEvent(Address addr, int size);
72
73 void UpdateObjectSizeEvent(Address addr, int size);
73 74
74 void DefineWrapperClass( 75 void DefineWrapperClass(
75 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); 76 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
76 77
77 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, 78 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
78 Object** wrapper); 79 Object** wrapper);
79 INLINE(bool is_profiling()) { 80 INLINE(bool is_profiling()) {
80 return snapshots_->is_tracking_objects(); 81 return snapshots_->is_tracking_objects();
81 } 82 }
82 83
83 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); 84 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
84 85
86 bool is_tracking_allocations() {
87 return is_tracking_allocations_;
88 }
89
90 void StartHeapAllocationsRecording();
91 void StopHeapAllocationsRecording();
92
93 int FindUntrackedObjects() {
94 return snapshots_->FindUntrackedObjects();
95 }
96
97 void DropCompiledCode();
98
85 private: 99 private:
86 Heap* heap() const { return snapshots_->heap(); } 100 Heap* heap() const { return snapshots_->heap(); }
87 101
88 HeapSnapshotsCollection* snapshots_; 102 HeapSnapshotsCollection* snapshots_;
89 unsigned next_snapshot_uid_; 103 unsigned next_snapshot_uid_;
90 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 104 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
105 bool is_tracking_allocations_;
91 }; 106 };
92 107
93 } } // namespace v8::internal 108 } } // namespace v8::internal
94 109
95 #endif // V8_HEAP_PROFILER_H_ 110 #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