Commit 6af89d92 authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[heap] Add --trace-pending-allocations

Traces calls to Heap::IsAllocationPending that return true. This is
useful when debugging concurrent Turbofan.

Bug: v8:7790
Change-Id: If10e6f40c3bf03c768ad8b74403007fe86f860fe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3060488Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76012}
parent fdabdb04
......@@ -720,6 +720,7 @@ DEFINE_BOOL(trace_heap_broker, false,
"trace the heap broker (reports on missing data only)")
DEFINE_IMPLICATION(trace_heap_broker_verbose, trace_heap_broker)
DEFINE_IMPLICATION(trace_heap_broker_memory, trace_heap_broker)
DEFINE_IMPLICATION(trace_heap_broker, trace_pending_allocations)
// Flags for stress-testing the compiler.
DEFINE_INT(stress_runs, 0, "number of stress runs")
......@@ -1130,6 +1131,8 @@ DEFINE_BOOL(
trace_allocations_origins, false,
"Show statistics about the origins of allocations. "
"Combine with --no-inline-new to track allocations from generated code")
DEFINE_BOOL(trace_pending_allocations, false,
"trace calls to Heap::IsAllocationPending that return true")
DEFINE_INT(trace_allocation_stack_interval, -1,
"print stack trace after <n> free-list allocations")
......
......@@ -45,6 +45,7 @@
#include "src/objects/struct-inl.h"
#include "src/profiler/heap-profiler.h"
#include "src/strings/string-hasher.h"
#include "src/utils/ostreams.h"
#include "src/zone/zone-list-inl.h"
namespace v8 {
......@@ -615,7 +616,7 @@ void Heap::UpdateAllocationSite(Map map, HeapObject object,
(*pretenuring_feedback)[AllocationSite::unchecked_cast(Object(key))]++;
}
bool Heap::IsPendingAllocation(HeapObject object) {
bool Heap::IsPendingAllocationInternal(HeapObject object) {
DCHECK(deserialization_complete());
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) {
......@@ -667,6 +668,15 @@ bool Heap::IsPendingAllocation(HeapObject object) {
UNREACHABLE();
}
bool Heap::IsPendingAllocation(HeapObject object) {
bool result = IsPendingAllocationInternal(object);
if (FLAG_trace_pending_allocations && result) {
StdoutStream{} << "Pending allocation: " << std::hex << "0x" << object.ptr()
<< "\n";
}
return result;
}
bool Heap::IsPendingAllocation(Object object) {
return object.IsHeapObject() && IsPendingAllocation(HeapObject::cast(object));
}
......
......@@ -2149,6 +2149,9 @@ class Heap {
force_gc_on_next_allocation_ = true;
}
// Helper for IsPendingAllocation.
inline bool IsPendingAllocationInternal(HeapObject object);
// ===========================================================================
// Retaining path tracing ====================================================
// ===========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment