Commit 1fb17815 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Make --trace-turbo-graph independent from --trace-turbo.

Bug: v8:5267
Change-Id: Ib93b4e5110061a0dcae0a6879f5d0e878cf1bf3f
Reviewed-on: https://chromium-review.googlesource.com/640704
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47675}
parent 08e8bbaf
...@@ -533,7 +533,7 @@ void CodeGenerator::AssembleSourcePosition(SourcePosition source_position) { ...@@ -533,7 +533,7 @@ void CodeGenerator::AssembleSourcePosition(SourcePosition source_position) {
if (info->IsStub()) return; if (info->IsStub()) return;
std::ostringstream buffer; std::ostringstream buffer;
buffer << "-- "; buffer << "-- ";
if (FLAG_trace_turbo || if (FLAG_trace_turbo || FLAG_trace_turbo_graph ||
tasm()->isolate()->concurrent_recompilation_enabled()) { tasm()->isolate()->concurrent_recompilation_enabled()) {
buffer << source_position; buffer << source_position;
} else { } else {
......
...@@ -1566,7 +1566,7 @@ struct PrintGraphPhase { ...@@ -1566,7 +1566,7 @@ struct PrintGraphPhase {
CompilationInfo* info = data->info(); CompilationInfo* info = data->info();
Graph* graph = data->graph(); Graph* graph = data->graph();
{ // Print JSON. if (FLAG_trace_turbo) { // Print JSON.
AllowHandleDereference allow_deref; AllowHandleDereference allow_deref;
TurboJsonFile json_of(info, std::ios_base::app); TurboJsonFile json_of(info, std::ios_base::app);
json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":" json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":"
...@@ -1595,7 +1595,7 @@ struct VerifyGraphPhase { ...@@ -1595,7 +1595,7 @@ struct VerifyGraphPhase {
}; };
void PipelineImpl::RunPrintAndVerify(const char* phase, bool untyped) { void PipelineImpl::RunPrintAndVerify(const char* phase, bool untyped) {
if (FLAG_trace_turbo) { if (FLAG_trace_turbo || FLAG_trace_turbo_graph) {
Run<PrintGraphPhase>(phase); Run<PrintGraphPhase>(phase);
} }
if (FLAG_turbo_verify) { if (FLAG_turbo_verify) {
...@@ -1608,12 +1608,14 @@ bool PipelineImpl::CreateGraph() { ...@@ -1608,12 +1608,14 @@ bool PipelineImpl::CreateGraph() {
data->BeginPhaseKind("graph creation"); data->BeginPhaseKind("graph creation");
if (FLAG_trace_turbo) { if (FLAG_trace_turbo || FLAG_trace_turbo_graph) {
CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
os << "---------------------------------------------------\n" os << "---------------------------------------------------\n"
<< "Begin compiling method " << info()->GetDebugName().get() << "Begin compiling method " << info()->GetDebugName().get()
<< " using Turbofan" << std::endl; << " using Turbofan" << std::endl;
}
if (FLAG_trace_turbo) {
TurboCfgFile tcf(isolate()); TurboCfgFile tcf(isolate());
tcf << AsC1VCompilation(info()); tcf << AsC1VCompilation(info());
} }
...@@ -1778,14 +1780,12 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, ...@@ -1778,14 +1780,12 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate,
PipelineImpl pipeline(&data); PipelineImpl pipeline(&data);
DCHECK_NOT_NULL(data.schedule()); DCHECK_NOT_NULL(data.schedule());
if (FLAG_trace_turbo) { if (FLAG_trace_turbo || FLAG_trace_turbo_graph) {
{ CodeTracer::Scope tracing_scope(isolate->GetCodeTracer());
CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); OFStream os(tracing_scope.file());
OFStream os(tracing_scope.file()); os << "---------------------------------------------------\n"
os << "---------------------------------------------------\n" << "Begin compiling " << debug_name << " using Turbofan" << std::endl;
<< "Begin compiling " << debug_name << " using Turbofan" << std::endl; if (FLAG_trace_turbo) {
}
{
TurboJsonFile json_of(&info, std::ios_base::trunc); TurboJsonFile json_of(&info, std::ios_base::trunc);
json_of << "{\"function\":\"" << info.GetDebugName().get() json_of << "{\"function\":\"" << info.GetDebugName().get()
<< "\", \"source\":\"\",\n\"phases\":["; << "\", \"source\":\"\",\n\"phases\":[";
...@@ -2043,14 +2043,14 @@ Handle<Code> PipelineImpl::FinalizeCode() { ...@@ -2043,14 +2043,14 @@ Handle<Code> PipelineImpl::FinalizeCode() {
json_of << "\"nodePositions\":"; json_of << "\"nodePositions\":";
json_of << data->source_position_output(); json_of << data->source_position_output();
json_of << "}"; json_of << "}";
}
if (FLAG_trace_turbo || FLAG_trace_turbo_graph) {
CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
os << "---------------------------------------------------\n" os << "---------------------------------------------------\n"
<< "Finished compiling method " << info()->GetDebugName().get() << "Finished compiling method " << info()->GetDebugName().get()
<< " using Turbofan" << std::endl; << " using Turbofan" << std::endl;
} }
return code; return code;
} }
......
...@@ -366,7 +366,6 @@ DEFINE_BOOL(turbo_preprocess_ranges, true, ...@@ -366,7 +366,6 @@ DEFINE_BOOL(turbo_preprocess_ranges, true,
DEFINE_STRING(turbo_filter, "*", "optimization filter for TurboFan compiler") DEFINE_STRING(turbo_filter, "*", "optimization filter for TurboFan compiler")
DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR") DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")
DEFINE_BOOL(trace_turbo_graph, false, "trace generated TurboFan graphs") DEFINE_BOOL(trace_turbo_graph, false, "trace generated TurboFan graphs")
DEFINE_IMPLICATION(trace_turbo_graph, trace_turbo)
DEFINE_STRING(trace_turbo_cfg_file, NULL, DEFINE_STRING(trace_turbo_cfg_file, NULL,
"trace turbo cfg graph (for C1 visualizer) to a given file name") "trace turbo cfg graph (for C1 visualizer) to a given file name")
DEFINE_BOOL(trace_turbo_types, true, "trace TurboFan's types") DEFINE_BOOL(trace_turbo_types, true, "trace TurboFan's types")
......
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