Commit 0ed433ce authored by dcarney's avatar dcarney Committed by Commit bot

dump compiler stats from d8 on direct exit from js

BUG=

Review URL: https://codereview.chromium.org/753483002

Cr-Commit-Position: refs/heads/master@{#25453}
parent 4c11d75d
...@@ -617,7 +617,7 @@ void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -617,7 +617,7 @@ void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) { void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
int exit_code = args[0]->Int32Value(); int exit_code = args[0]->Int32Value();
OnExit(); OnExit(args.GetIsolate());
exit(exit_code); exit(exit_code);
} }
...@@ -1054,10 +1054,11 @@ inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) { ...@@ -1054,10 +1054,11 @@ inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) {
#endif // !V8_SHARED #endif // !V8_SHARED
void Shell::OnExit() { void Shell::OnExit(v8::Isolate* isolate) {
LineEditor* line_editor = LineEditor::Get(); LineEditor* line_editor = LineEditor::Get();
if (line_editor) line_editor->Close(); if (line_editor) line_editor->Close();
#ifndef V8_SHARED #ifndef V8_SHARED
reinterpret_cast<i::Isolate*>(isolate)->DumpAndResetCompilationStats();
if (i::FLAG_dump_counters) { if (i::FLAG_dump_counters) {
int number_of_counters = 0; int number_of_counters = 0;
for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) { for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) {
...@@ -1746,7 +1747,7 @@ int Shell::Main(int argc, char* argv[]) { ...@@ -1746,7 +1747,7 @@ int Shell::Main(int argc, char* argv[]) {
RunShell(isolate); RunShell(isolate);
} }
} }
OnExit(); OnExit(isolate);
#ifndef V8_SHARED #ifndef V8_SHARED
// Dump basic block profiling data. // Dump basic block profiling data.
if (i::BasicBlockProfiler* profiler = if (i::BasicBlockProfiler* profiler =
......
...@@ -263,7 +263,7 @@ class Shell : public i::AllStatic { ...@@ -263,7 +263,7 @@ class Shell : public i::AllStatic {
static int RunMain(Isolate* isolate, int argc, char* argv[]); static int RunMain(Isolate* isolate, int argc, char* argv[]);
static int Main(int argc, char* argv[]); static int Main(int argc, char* argv[]);
static void Exit(int exit_code); static void Exit(int exit_code);
static void OnExit(); static void OnExit(Isolate* isolate);
#ifndef V8_SHARED #ifndef V8_SHARED
static Handle<Array> GetCompletions(Isolate* isolate, static Handle<Array> GetCompletions(Isolate* isolate,
......
...@@ -1743,11 +1743,7 @@ void Isolate::Deinit() { ...@@ -1743,11 +1743,7 @@ void Isolate::Deinit() {
heap_.mark_compact_collector()->EnsureSweepingCompleted(); heap_.mark_compact_collector()->EnsureSweepingCompleted();
} }
if (turbo_statistics() != NULL) { DumpAndResetCompilationStats();
OFStream os(stdout);
os << *turbo_statistics() << std::endl;
}
if (FLAG_hydrogen_stats) GetHStatistics()->Print();
if (FLAG_print_deopt_stress) { if (FLAG_print_deopt_stress) {
PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_);
...@@ -2249,6 +2245,19 @@ void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) { ...@@ -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() { HStatistics* Isolate::GetHStatistics() {
if (hstatistics() == NULL) set_hstatistics(new HStatistics()); if (hstatistics() == NULL) set_hstatistics(new HStatistics());
return hstatistics(); return hstatistics();
......
...@@ -1064,6 +1064,8 @@ class Isolate { ...@@ -1064,6 +1064,8 @@ class Isolate {
HTracer* GetHTracer(); HTracer* GetHTracer();
CodeTracer* GetCodeTracer(); CodeTracer* GetCodeTracer();
void DumpAndResetCompilationStats();
FunctionEntryHook function_entry_hook() { return function_entry_hook_; } FunctionEntryHook function_entry_hook() { return function_entry_hook_; }
void set_function_entry_hook(FunctionEntryHook function_entry_hook) { void set_function_entry_hook(FunctionEntryHook function_entry_hook) {
function_entry_hook_ = function_entry_hook; function_entry_hook_ = function_entry_hook;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment