Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index 80b19809d338eece87ad6280c1e026e183857df0..0c923df9bc29bcf34b140be16223d7d55ee84ad4 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -18,7 +18,6 @@ |
#include "src/compiler/control-flow-optimizer.h" |
#include "src/compiler/control-reducer.h" |
#include "src/compiler/graph-replay.h" |
-#include "src/compiler/graph-visualizer.h" |
#include "src/compiler/instruction.h" |
#include "src/compiler/instruction-selector.h" |
#include "src/compiler/js-builtin-reducer.h" |
@@ -45,6 +44,7 @@ |
#include "src/compiler/typer.h" |
#include "src/compiler/value-numbering-reducer.h" |
#include "src/compiler/verifier.h" |
+#include "src/compiler/visualizer.h" |
#include "src/compiler/zone-pool.h" |
#include "src/ostreams.h" |
#include "src/utils.h" |
@@ -284,10 +284,28 @@ struct TurboCfgFile : public std::ofstream { |
}; |
-static void TraceSchedule(Schedule* schedule) { |
+static void TraceSchedule(CompilationInfo* info, |
+ SourcePositionTable* source_positions, |
+ Schedule* schedule) { |
+ if (FLAG_trace_turbo) { |
+ FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "a+"); |
+ if (json_file != nullptr) { |
+ OFStream json_of(json_file); |
+ json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; |
+ std::stringstream schedule_stream; |
+ schedule_stream << ScheduleAsJSON(*schedule, source_positions); |
+ std::string schedule_string(schedule_stream.str()); |
+ for (const auto& c : schedule_string) { |
+ json_of << AsEscapedUC16ForJSON(c); |
+ } |
+ json_of << "\"},\n"; |
+ fclose(json_file); |
+ } |
+ } |
if (!FLAG_trace_turbo_graph && !FLAG_trace_turbo_scheduler) return; |
OFStream os(stdout); |
- os << "-- Schedule --------------------------------------\n" << *schedule; |
+ os << "-- Schedule --------------------------------------\n" |
+ << ScheduleAsJSON(*schedule); |
} |
@@ -785,7 +803,7 @@ struct PrintGraphPhase { |
if (json_file == nullptr) return; |
OFStream json_of(json_file); |
json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":" |
- << AsJSON(*graph, data->source_positions()) << "},\n"; |
+ << GraphAsJSON(*graph, data->source_positions()) << "},\n"; |
fclose(json_file); |
} |
@@ -1052,7 +1070,7 @@ Handle<Code> Pipeline::ScheduleAndGenerateCode( |
CHECK(SupportedBackend()); |
if (data->schedule() == nullptr) Run<ComputeSchedulePhase>(); |
- TraceSchedule(data->schedule()); |
+ TraceSchedule(data->info(), data->source_positions(), data->schedule()); |
BasicBlockProfiler::Data* profiler_data = NULL; |
if (FLAG_turbo_profiling) { |