Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 152c936b98cef04789b17e826b97d439ef672315..6caaf19c8a4ffed90ff61db56faf0fe5bb1ec563 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1951,8 +1951,12 @@ bool Isolate::Init(Deserializer* des) { |
if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); |
if (FLAG_trace_turbo) { |
- // Create an empty file. |
- std::ofstream(GetTurboCfgFileName(), std::ios_base::trunc); |
+ // 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 |
@@ -2368,11 +2372,13 @@ BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { |
} |
-std::string Isolate::GetTurboCfgFileName() { |
- return FLAG_trace_turbo_cfg_file == NULL |
- ? "turbo-" + std::to_string(base::OS::GetCurrentProcessId()) + |
- "-" + std::to_string(id()) + ".cfg" |
- : FLAG_trace_turbo_cfg_file; |
+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()); |
+ } |
} |