Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: src/compiler/graph-visualizer.cc

Issue 2081323007: Reland of Include file names in trace_turbo output (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-visualizer.cc
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc
index cd3810f0197eee2ea22fb722e762f4999d1ff088..2e397648423635896aa29e289ac88197d4bef139 100644
--- a/src/compiler/graph-visualizer.cc
+++ b/src/compiler/graph-visualizer.cc
@@ -36,14 +36,34 @@ base::SmartArrayPointer<const char> GetVisualizerLogFileName(
} else {
SNPrintF(filename, "turbo-none-%s", phase);
}
+ EmbeddedVector<char, 256> source_file(0);
+ bool source_available = false;
+ 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) {
+ SNPrintF(source_file, "%s", str->ToCString().get());
+ std::replace(source_file.start(),
+ source_file.start() + source_file.length(), '/', '_');
+ source_available = true;
+ }
+ }
+ }
std::replace(filename.start(), filename.start() + filename.length(), ' ',
'_');
EmbeddedVector<char, 256> full_filename;
- if (phase == nullptr) {
+ if (phase == nullptr && !source_available) {
SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
- } else {
+ } else if (phase != nullptr && !source_available) {
SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
+ } else if (phase == nullptr && source_available) {
+ SNPrintF(full_filename, "%s_%s.%s", filename.start(), source_file.start(),
+ suffix);
+ } else {
+ SNPrintF(full_filename, "%s_%s-%s.%s", filename.start(),
+ source_file.start(), phase, suffix);
}
char* buffer = new char[full_filename.length() + 1];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698