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

Unified Diff: src/compiler/pipeline.cc

Issue 985023002: [turbofan] Add schedule to visualizer output (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 5 years, 8 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 | « src/compiler/node-aux-data.h ('k') | src/compiler/source-position.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/compiler/node-aux-data.h ('k') | src/compiler/source-position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698