Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index e8e1d66602b90606e3728f3590af7af3aecc9511..2874c168b74bdcc9e769b189e27020d3830f40ed 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -4,6 +4,8 @@ |
#include <stdlib.h> |
+#include <fstream> // NOLINT(readability/streams) |
+ |
#include "src/v8.h" |
#include "src/ast.h" |
@@ -1951,6 +1953,16 @@ bool Isolate::Init(Deserializer* des) { |
runtime_profiler_ = new RuntimeProfiler(this); |
+ if (FLAG_trace_turbo) { |
+ // Erase the file. |
+ char buffer[512]; |
+ Vector<char> filename(buffer, sizeof(buffer)); |
+ GetTurboCfgFileName(filename); |
+ std::ofstream turbo_cfg_stream(filename.start(), |
+ std::fstream::out | std::fstream::trunc); |
+ } |
+ |
+ |
// If we are deserializing, log non-function code objects and compiled |
// functions found in the snapshot. |
if (!create_heap_objects && |
@@ -2364,6 +2376,16 @@ BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { |
} |
+void Isolate::GetTurboCfgFileName(Vector<char> filename) { |
+ if (FLAG_trace_turbo_cfg_file == NULL) { |
+ SNPrintF(filename, "turbo-%d-%d.cfg", base::OS::GetCurrentProcessId(), |
+ id()); |
+ } else { |
+ StrNCpy(filename, FLAG_trace_turbo_cfg_file, filename.length()); |
+ } |
+} |
+ |
+ |
bool StackLimitCheck::JsHasOverflowed() const { |
StackGuard* stack_guard = isolate_->stack_guard(); |
#ifdef USE_SIMULATOR |