diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc index 6e2d92151f..2c528ea987 100644 --- a/src/execution/isolate.cc +++ b/src/execution/isolate.cc @@ -3115,8 +3115,6 @@ void Isolate::Deinit() { // All client isolates should already be detached. DCHECK_NULL(client_isolate_head_); - DumpAndResetStats(); - if (FLAG_print_deopt_stress) { PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); } @@ -3156,6 +3154,10 @@ void Isolate::Deinit() { // This stops cancelable tasks (i.e. concurrent marking tasks) cancelable_task_manager()->CancelAndWait(); + // After all concurrent tasks are stopped, we know for sure that stats aren't + // updated anymore. + DumpAndResetStats(); + main_thread_local_isolate_->heap()->FreeLinearAllocationArea(); if (shared_isolate_) { diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc index a6a5ba7a74..88f7d33dd7 100644 --- a/test/cctest/heap/test-heap.cc +++ b/test/cctest/heap/test-heap.cc @@ -7318,7 +7318,6 @@ TEST(Regress11181) { v8::HandleScope scope(CcTest::isolate()); GenerateGarbage(); CcTest::CollectAllAvailableGarbage(); - TracingFlags::runtime_stats.store(0, std::memory_order_relaxed); } TEST(LongTaskStatsFullAtomic) {