| 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
|
|
|