Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index 3ea6c2ba812ef824b2ddadd4ee03040b062c3c94..c12853c3576254e9ca3425ef588ba26de041fa11 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -572,6 +572,8 @@ PipelineCompilationJob::Status PipelineCompilationJob::GenerateCodeImpl() { |
return SUCCEEDED; |
} |
+} // namespace |
+ |
class PipelineWasmCompilationJob final : public CompilationJob { |
public: |
explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph, |
@@ -602,6 +604,18 @@ PipelineWasmCompilationJob::CreateGraphImpl() { |
PipelineWasmCompilationJob::Status |
PipelineWasmCompilationJob::OptimizeGraphImpl() { |
+ if (FLAG_trace_turbo) { |
+ FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); |
+ if (json_file != nullptr) { |
+ OFStream json_of(json_file); |
+ json_of << "{\"function\":\"" << info()->GetDebugName().get() |
+ << "\", \"source\":\"\",\n\"phases\":["; |
+ fclose(json_file); |
+ } |
+ } |
+ |
+ pipeline_.RunPrintAndVerify("Machine", true); |
+ |
if (!pipeline_.ScheduleAndSelectInstructions(&linkage_)) return FAILED; |
return SUCCEEDED; |
} |
@@ -612,8 +626,6 @@ PipelineWasmCompilationJob::GenerateCodeImpl() { |
return SUCCEEDED; |
} |
-} // namespace |
- |
template <typename Phase> |
void Pipeline::Run() { |
@@ -1452,10 +1464,18 @@ Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, |
} |
Pipeline pipeline(&data); |
- if (data.schedule() == nullptr) { |
- // TODO(rossberg): Should this really be untyped? |
- pipeline.RunPrintAndVerify("Machine", true); |
+ |
+ if (FLAG_trace_turbo) { |
+ FILE* json_file = OpenVisualizerLogFile(info, nullptr, "json", "w+"); |
+ if (json_file != nullptr) { |
+ OFStream json_of(json_file); |
+ json_of << "{\"function\":\"" << info->GetDebugName().get() |
+ << "\", \"source\":\"\",\n\"phases\":["; |
+ fclose(json_file); |
+ } |
} |
+ // TODO(rossberg): Should this really be untyped? |
+ pipeline.RunPrintAndVerify("Machine", true); |
return pipeline.ScheduleAndGenerateCode(call_descriptor); |
} |