Commit a53b9bf0 authored by mattloring's avatar mattloring Committed by Commit bot

Include file names in trace_turbo output

The trace turbo output will overwrite itself when functions in different
files share the same name. Output files now have the form
`turbo-<function_name>:<opt_file_name>-<opt_phase>.suffix`.

R=ofrobots@google.com
BUG=

Review-Url: https://codereview.chromium.org/2083863004
Cr-Commit-Position: refs/heads/master@{#37199}
parent 0e14baf7
...@@ -36,15 +36,32 @@ base::SmartArrayPointer<const char> GetVisualizerLogFileName( ...@@ -36,15 +36,32 @@ base::SmartArrayPointer<const char> GetVisualizerLogFileName(
} else { } else {
SNPrintF(filename, "turbo-none-%s", phase); 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(), ' ', std::replace(filename.start(), filename.start() + filename.length(), ' ',
'_'); '_');
EmbeddedVector<char, 256> full_filename; EmbeddedVector<char, 256> full_filename;
if (phase == nullptr) { if (phase == nullptr && source_file == nullptr) {
SNPrintF(full_filename, "%s.%s", filename.start(), suffix); 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); 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]; char* buffer = new char[full_filename.length() + 1];
memcpy(buffer, full_filename.start(), full_filename.length()); memcpy(buffer, full_filename.start(), full_filename.length());
......
...@@ -603,8 +603,7 @@ DEFINE_BOOL(mask_constants_with_cookie, true, ...@@ -603,8 +603,7 @@ DEFINE_BOOL(mask_constants_with_cookie, true,
DEFINE_BOOL(lazy, true, "use lazy compilation") DEFINE_BOOL(lazy, true, "use lazy compilation")
DEFINE_BOOL(trace_opt, false, "trace lazy optimization") DEFINE_BOOL(trace_opt, false, "trace lazy optimization")
DEFINE_BOOL(trace_opt_stats, false, "trace lazy optimization statistics") DEFINE_BOOL(trace_opt_stats, false, "trace lazy optimization statistics")
DEFINE_BOOL(trace_file_names, false, DEFINE_BOOL(trace_file_names, false, "include file names in trace output")
"include file names in trace-opt/trace-deopt output")
DEFINE_BOOL(opt, true, "use adaptive optimizations") DEFINE_BOOL(opt, true, "use adaptive optimizations")
DEFINE_BOOL(always_opt, false, "always try to optimize functions") DEFINE_BOOL(always_opt, false, "always try to optimize functions")
DEFINE_BOOL(always_osr, false, "always try to OSR functions") DEFINE_BOOL(always_osr, false, "always try to OSR functions")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment