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}
This commit is contained in:
dcarney 2014-11-21 01:53:04 -08:00 committed by Commit bot
parent 4c11d75dbd
commit 0ed433ce30
4 changed files with 21 additions and 9 deletions

View File

@ -617,7 +617,7 @@ void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
int exit_code = args[0]->Int32Value();
OnExit();
OnExit(args.GetIsolate());
exit(exit_code);
}
@ -1054,10 +1054,11 @@ inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) {
#endif // !V8_SHARED
void Shell::OnExit() {
void Shell::OnExit(v8::Isolate* isolate) {
LineEditor* line_editor = LineEditor::Get();
if (line_editor) line_editor->Close();
#ifndef V8_SHARED
reinterpret_cast<i::Isolate*>(isolate)->DumpAndResetCompilationStats();
if (i::FLAG_dump_counters) {
int number_of_counters = 0;
for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) {
@ -1746,7 +1747,7 @@ int Shell::Main(int argc, char* argv[]) {
RunShell(isolate);
}
}
OnExit();
OnExit(isolate);
#ifndef V8_SHARED
// Dump basic block profiling data.
if (i::BasicBlockProfiler* profiler =

View File

@ -263,7 +263,7 @@ class Shell : public i::AllStatic {
static int RunMain(Isolate* isolate, int argc, char* argv[]);
static int Main(int argc, char* argv[]);
static void Exit(int exit_code);
static void OnExit();
static void OnExit(Isolate* isolate);
#ifndef V8_SHARED
static Handle<Array> GetCompletions(Isolate* isolate,

View File

@ -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();

View File

@ -1064,6 +1064,8 @@ class Isolate {
HTracer* GetHTracer();
CodeTracer* GetCodeTracer();
void DumpAndResetCompilationStats();
FunctionEntryHook function_entry_hook() { return function_entry_hook_; }
void set_function_entry_hook(FunctionEntryHook function_entry_hook) {
function_entry_hook_ = function_entry_hook;