FixedArrayBase* new_elms = FixedArrayBase::cast(HeapObject::FromAddress(
elms->address() + size_delta));
HeapProfiler* profiler = heap->isolate()->heap_profiler();
- if (profiler->is_profiling()) {
+ if (profiler->is_tracking_object_moves()) {
profiler->ObjectMoveEvent(elms->address(),
new_elms->address(),
new_elms->Size());
- if (profiler->is_tracking_allocations()) {
- // Report filler object as a new allocation.
- // Otherwise it will become an untracked object.
- profiler->NewObjectEvent(elms->address(), elms->Size());
- }
+ }
+ if (profiler->is_tracking_allocations()) {
+ // Report filler object as a new allocation.
+ // Otherwise it will become an untracked object.
+ profiler->NewObjectEvent(elms->address(), elms->Size());
}
return new_elms;
}
HeapProfiler::HeapProfiler(Heap* heap)
: snapshots_(new HeapSnapshotsCollection(heap)),
next_snapshot_uid_(1),
- is_tracking_allocations_(false) {
+ is_tracking_allocations_(false),
+ is_tracking_object_moves_(false) {
}
}
}
snapshots_->SnapshotGenerationFinished(result);
+ is_tracking_object_moves_ = true;
return result;
}
void HeapProfiler::StartHeapObjectsTracking() {
snapshots_->StartHeapObjectsTracking();
+ is_tracking_object_moves_ = true;
}
StartHeapObjectsTracking();
heap()->DisableInlineAllocation();
is_tracking_allocations_ = true;
- snapshots_->UpdateHeapObjectsMap();
}
v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
Object** wrapper);
- INLINE(bool is_profiling()) {
- return snapshots_->is_tracking_objects();
- }
-
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
- bool is_tracking_allocations() {
- return is_tracking_allocations_;
- }
+ bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
+ bool is_tracking_allocations() const { return is_tracking_allocations_; }
void StartHeapAllocationsRecording();
void StopHeapAllocationsRecording();
unsigned next_snapshot_uid_;
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
bool is_tracking_allocations_;
+ bool is_tracking_object_moves_;
};
} } // namespace v8::internal
HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap)
- : is_tracking_objects_(false),
- names_(heap),
+ : names_(heap),
ids_(heap),
allocation_tracker_(NULL) {
}
if (allocation_tracker_ == NULL) {
allocation_tracker_ = new AllocationTracker(&ids_, names());
}
- is_tracking_objects_ = true;
}
HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name,
unsigned uid) {
- is_tracking_objects_ = true; // Start watching for heap objects moves.
return new HeapSnapshot(this, name, uid);
}
Heap* heap() const { return ids_.heap(); }
- bool is_tracking_objects() { return is_tracking_objects_; }
SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) {
return ids_.PushHeapObjectsStats(stream);
}
int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); }
- void UpdateHeapObjectsMap() { ids_.UpdateHeapObjectsMap(); }
-
private:
- bool is_tracking_objects_; // Whether tracking object moves is needed.
List<HeapSnapshot*> snapshots_;
StringsStorage names_;
// Mapping from HeapObject addresses to objects' uids.
RecordCopiedObject(heap, target);
Isolate* isolate = heap->isolate();
HeapProfiler* heap_profiler = isolate->heap_profiler();
- if (heap_profiler->is_profiling()) {
+ if (heap_profiler->is_tracking_object_moves()) {
heap_profiler->ObjectMoveEvent(source->address(), target->address(),
size);
}
isolate()->logger()->is_logging() ||
isolate()->cpu_profiler()->is_profiling() ||
(isolate()->heap_profiler() != NULL &&
- isolate()->heap_profiler()->is_profiling());
+ isolate()->heap_profiler()->is_tracking_object_moves());
if (!incremental_marking()->IsMarking()) {
if (!logging_and_profiling) {
int size,
AllocationSpace dest) {
HeapProfiler* heap_profiler = heap()->isolate()->heap_profiler();
- if (heap_profiler->is_profiling()) {
+ if (heap_profiler->is_tracking_object_moves()) {
heap_profiler->ObjectMoveEvent(src, dst, size);
}
ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest));