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

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: Remove redundant cdoe Created 5 years, 9 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
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) {
« no previous file with comments | « src/compiler/osr.cc ('k') | src/compiler/schedule.h » ('j') | src/compiler/visualizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698