| Index: src/compiler/pipeline.cc
|
| diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
|
| index 7b1f61f30e8d858bf7882d0edcbc337cebc01aa8..fb03b71ddf1df8c1dc1afb9ddc2bcce898e3964a 100644
|
| --- a/src/compiler/pipeline.cc
|
| +++ b/src/compiler/pipeline.cc
|
| @@ -294,7 +294,22 @@ struct TurboCfgFile : public std::ofstream {
|
| };
|
|
|
|
|
| -static void TraceSchedule(Schedule* schedule) {
|
| +static void TraceSchedule(CompilationInfo* info, 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 << *schedule;
|
| + 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;
|
| @@ -1092,7 +1107,7 @@ Handle<Code> Pipeline::ScheduleAndGenerateCode(
|
| CHECK(SupportedBackend());
|
|
|
| if (data->schedule() == nullptr) Run<ComputeSchedulePhase>();
|
| - TraceSchedule(data->schedule());
|
| + TraceSchedule(data->info(), data->schedule());
|
|
|
| BasicBlockProfiler::Data* profiler_data = NULL;
|
| if (FLAG_turbo_profiling) {
|
| @@ -1112,6 +1127,12 @@ Handle<Code> Pipeline::ScheduleAndGenerateCode(
|
| data->sequence());
|
| }
|
|
|
| + std::ostringstream source_position_output;
|
| + if (FLAG_trace_turbo) {
|
| + // Output source position information before the graph is deleted.
|
| + data_->source_positions()->Print(source_position_output);
|
| + }
|
| +
|
| data->DeleteGraphZone();
|
|
|
| BeginPhaseKind("register allocation");
|
| @@ -1160,7 +1181,10 @@ Handle<Code> Pipeline::ScheduleAndGenerateCode(
|
| json_of << AsEscapedUC16ForJSON(c);
|
| }
|
| #endif // ENABLE_DISASSEMBLER
|
| - json_of << "\"}\n]}";
|
| + json_of << "\"}\n],\n";
|
| + json_of << "\"nodePositions\":";
|
| + json_of << source_position_output.str();
|
| + json_of << "}";
|
| fclose(json_file);
|
| }
|
| OFStream os(stdout);
|
|
|