Chromium Code Reviews| Index: src/compiler/graph-visualizer.cc |
| diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc |
| index f2368931fa21ec3283c84f9260673b8e8b64464c..158f8e426bb4bc91bd432426afd1a2ce47197572 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); |
|
Benedikt Meurer
2016/06/22 17:37:44
Nit: Can we not use colon, but maybe underscore? T
|
| + } 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()); |