| Index: src/compiler/graph-visualizer.cc
|
| diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc
|
| index f2368931fa21ec3283c84f9260673b8e8b64464c..de47a35583365a4e250fc35adb47c8e50a90f952 100644
|
| --- a/src/compiler/graph-visualizer.cc
|
| +++ b/src/compiler/graph-visualizer.cc
|
| @@ -36,15 +36,32 @@ base::SmartArrayPointer<const char> GetVisualizerLogFileName(
|
| } else {
|
| SNPrintF(filename, "turbo-none-%s", phase);
|
| }
|
| + char* source_file = nullptr;
|
| + if (FLAG_trace_file_names && info->parse_info()) {
|
| + Object* source_name = info->script()->name();
|
| + if (source_name->IsString()) {
|
| + String* str = String::cast(source_name);
|
| + if (str->length() > 0) {
|
| + source_file = str->ToCString().get();
|
| + }
|
| + }
|
| + }
|
| std::replace(filename.start(), filename.start() + filename.length(), ' ',
|
| '_');
|
|
|
| EmbeddedVector<char, 256> full_filename;
|
| - if (phase == nullptr) {
|
| + if (phase == nullptr && source_file == nullptr) {
|
| SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
|
| - } else {
|
| + } else if (phase != nullptr && source_file == nullptr) {
|
| SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
|
| + } else if (phase == nullptr && source_file != nullptr) {
|
| + SNPrintF(full_filename, "%s_%s.%s", filename.start(), source_file, suffix);
|
| + } else {
|
| + SNPrintF(full_filename, "%s_%s-%s.%s", filename.start(), source_file, phase,
|
| + suffix);
|
| }
|
| + std::replace(full_filename.start(),
|
| + full_filename.start() + full_filename.length(), '/', '_');
|
|
|
| char* buffer = new char[full_filename.length() + 1];
|
| memcpy(buffer, full_filename.start(), full_filename.length());
|
|
|