[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 <jianxiao.lu@intel.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Jianxiao Lu <jianxiao.lu@intel.com>
Cr-Commit-Position: refs/heads/main@{#78575}
This commit is contained in:
JianxiaoLuIntel 2022-01-11 08:55:51 +08:00 committed by V8 LUCI CQ
parent c4ebb5dc50
commit 5ab5555720

View File

@ -20,7 +20,8 @@ void HeapLayoutTracer::GCProloguePrintHeapLayout(v8::Isolate* isolate,
v8::GCCallbackFlags flags,
void* data) {
Heap* heap = reinterpret_cast<i::Isolate*>(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);
}