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

Unified Diff: src/heap-profiler.cc

Issue 23039014: Hook-allocation on bleeding edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap-profiler.h ('k') | src/heap-snapshot-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap-profiler.cc
diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc
index e66af3364d865b018bdb8110af24e1087555e8b9..166b0b13b4056724a88ab4bd97e74d8d1c48dd17 100644
--- a/src/heap-profiler.cc
+++ b/src/heap-profiler.cc
@@ -35,7 +35,8 @@ namespace internal {
HeapProfiler::HeapProfiler(Heap* heap)
: snapshots_(new HeapSnapshotsCollection(heap)),
- next_snapshot_uid_(1) {
+ next_snapshot_uid_(1),
+ is_tracking_allocations_(0) {
}
@@ -74,6 +75,7 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
const char* name,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) {
+ is_tracking_allocations_++;
HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++);
{
HeapSnapshotGenerator generator(result, control, resolver, heap());
@@ -96,7 +98,9 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
void HeapProfiler::StartHeapObjectsTracking() {
- snapshots_->StartHeapObjectsTracking();
+ if (++is_tracking_allocations_ == 1) {
+ snapshots_->StartHeapObjectsTracking();
+ }
}
@@ -107,6 +111,7 @@ SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) {
void HeapProfiler::StopHeapObjectsTracking() {
snapshots_->StopHeapObjectsTracking();
+ is_tracking_allocations_ = 0;
}
@@ -132,14 +137,31 @@ SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Object> obj) {
}
-void HeapProfiler::ObjectMoveEvent(Address from, Address to) {
- snapshots_->ObjectMoveEvent(from, to);
+void HeapProfiler::ObjectMoveEvent(Address from, Address to, int size) {
+ snapshots_->ObjectMoveEvent(from, to, size);
+}
+
+
+void HeapProfiler::NewObjectEvent(Address addr, int size) {
+ snapshots_->NewObjectEvent(addr, size);
}
+
void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
RetainedObjectInfo* info) {
// TODO(yurus, marja): Don't route this information through GlobalHandles.
heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info);
}
+
+int* HeapProfiler::is_tracking_allocations_address() {
+ return &is_tracking_allocations_;
+}
+
+
+int HeapProfiler::CheckAllocationsTracking() {
+ return snapshots_->CheckAllocationsTracking();
+}
+
+
} } // namespace v8::internal
« no previous file with comments | « src/heap-profiler.h ('k') | src/heap-snapshot-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698