void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
int exit_code = args[0]->Int32Value();
- OnExit();
+ OnExit(args.GetIsolate());
exit(exit_code);
}
#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()) {
RunShell(isolate);
}
}
- OnExit();
+ OnExit(isolate);
#ifndef V8_SHARED
// Dump basic block profiling data.
if (i::BasicBlockProfiler* profiler =
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,
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_);
}
+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();
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;