Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index f5f83d6cfa96d2acf7f740ccf53d04c684d07a74..d7bfad6f16a18e58f08e0ae4a40e7bf1c1ddc23e 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1743,11 +1743,7 @@ void Isolate::Deinit() { |
heap_.mark_compact_collector()->EnsureSweepingCompleted(); |
} |
- if (turbo_statistics() != NULL) { |
- OFStream os(stdout); |
- os << *turbo_statistics() << std::endl; |
- } |
- if (FLAG_hydrogen_stats) GetHStatistics()->Print(); |
+ DumpAndResetCompilationStats(); |
if (FLAG_print_deopt_stress) { |
PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); |
@@ -2249,6 +2245,19 @@ void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) { |
} |
+void Isolate::DumpAndResetCompilationStats() { |
+ if (turbo_statistics() != nullptr) { |
+ OFStream os(stdout); |
+ os << *turbo_statistics() << std::endl; |
+ } |
+ if (hstatistics() != nullptr) hstatistics()->Print(); |
+ delete turbo_statistics_; |
+ turbo_statistics_ = nullptr; |
+ delete hstatistics_; |
+ hstatistics_ = nullptr; |
+} |
+ |
+ |
HStatistics* Isolate::GetHStatistics() { |
if (hstatistics() == NULL) set_hstatistics(new HStatistics()); |
return hstatistics(); |