[api] Add v8::Isolate::DumpAndResetStats

Chrome no longer calls v8::Isolate::Dispose on shutdown, essentially preventing
the use of V8 stats within chrome/content_shell. This CL adds a basic hook to
the api that is then used to only print the stats.

Chrome change: https://codereview.chromium.org/2693353002

Change-Id: I1481c14afe611e9c08ae67c815201a45940daa57
Reviewed-on: https://chromium-review.googlesource.com/452338
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43706}
This commit is contained in:
Camillo Bruni 2017-03-09 14:44:22 +01:00 committed by Commit Bot
parent 0fb37ad007
commit 9ac64ca191
4 changed files with 13 additions and 4 deletions

View File

@ -6638,6 +6638,12 @@ class V8_EXPORT Isolate {
*/
void Dispose();
/**
* Dumps activated low-level V8 internal stats. This can be used instead
* of performing a full isolate disposal.
*/
void DumpAndResetStats();
/**
* Discards all V8 thread-specific data for the Isolate. Should be used
* if a thread is terminating and it has used an Isolate that will outlive

View File

@ -8201,6 +8201,10 @@ void Isolate::Dispose() {
isolate->TearDown();
}
void Isolate::DumpAndResetStats() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->DumpAndResetStats();
}
void Isolate::DiscardThreadSpecificMetadata() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);

View File

@ -2387,7 +2387,7 @@ void Isolate::Deinit() {
heap_.mark_compact_collector()->EnsureSweepingCompleted();
DumpAndResetCompilationStats();
DumpAndResetStats();
if (FLAG_print_deopt_stress) {
PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_);
@ -2884,8 +2884,7 @@ void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) {
}
}
void Isolate::DumpAndResetCompilationStats() {
void Isolate::DumpAndResetStats() {
if (turbo_statistics() != nullptr) {
DCHECK(FLAG_turbo_stats || FLAG_turbo_stats_nvp);

View File

@ -1065,7 +1065,7 @@ class Isolate {
HTracer* GetHTracer();
CodeTracer* GetCodeTracer();
void DumpAndResetCompilationStats();
void DumpAndResetStats();
FunctionEntryHook function_entry_hook() { return function_entry_hook_; }
void set_function_entry_hook(FunctionEntryHook function_entry_hook) {