From 5ab5555720103b3cccd1be1800c951913de67350 Mon Sep 17 00:00:00 2001 From: JianxiaoLuIntel Date: Tue, 11 Jan 2022 08:55:51 +0800 Subject: [PATCH] [heap] gc_count manully add 1 in prologue callback To make sure print the correct gc_count in heap layout tracer. Change-Id: I790d9359acab188bbfd1f59b731531c58713d8f1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3361842 Auto-Submit: Jianxiao Lu Reviewed-by: Michael Lippautz Commit-Queue: Jianxiao Lu Cr-Commit-Position: refs/heads/main@{#78575} --- src/heap/heap-layout-tracer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/heap/heap-layout-tracer.cc b/src/heap/heap-layout-tracer.cc index 53ac5726a7..0e984ce761 100644 --- a/src/heap/heap-layout-tracer.cc +++ b/src/heap/heap-layout-tracer.cc @@ -20,7 +20,8 @@ void HeapLayoutTracer::GCProloguePrintHeapLayout(v8::Isolate* isolate, v8::GCCallbackFlags flags, void* data) { Heap* heap = reinterpret_cast(isolate)->heap(); - PrintF("Before GC:%d,", heap->gc_count()); + // gc_count_ will increase after this callback, manually add 1. + PrintF("Before GC:%d,", heap->gc_count() + 1); PrintF("collector_name:%s\n", Heap::CollectorName(gc_type)); PrintHeapLayout(std::cout, heap); }