heap: Actually attach allocation tracker

Bug: v8:12616, v8:12615
Change-Id: I57ce784c4c9b7a9d75a6e139063b7ce0cac511ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3452024
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79033}
This commit is contained in:
Michael Lippautz 2022-02-10 14:54:26 +01:00 committed by V8 LUCI CQ
parent 1e6294d3c3
commit a5c7137e67

View File

@ -721,14 +721,16 @@ class Heap::AllocationTrackerForDebugging final
public:
static bool IsNeeded() {
return FLAG_verify_predictable || FLAG_fuzzer_gc_analysis ||
FLAG_trace_allocation_stack_interval;
(FLAG_trace_allocation_stack_interval > 0);
}
explicit AllocationTrackerForDebugging(Heap* heap) : heap_(heap) {
CHECK(IsNeeded());
heap_->AddHeapObjectAllocationTracker(this);
}
~AllocationTrackerForDebugging() final {
heap_->RemoveHeapObjectAllocationTracker(this);
if (FLAG_verify_predictable || FLAG_fuzzer_gc_analysis) {
PrintAllocationsHash();
}