| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/adapters.h" | 10 #include "src/base/adapters.h" |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 }; | 993 }; |
| 994 | 994 |
| 995 | 995 |
| 996 struct PrintGraphPhase { | 996 struct PrintGraphPhase { |
| 997 static const char* phase_name() { return nullptr; } | 997 static const char* phase_name() { return nullptr; } |
| 998 | 998 |
| 999 void Run(PipelineData* data, Zone* temp_zone, const char* phase) { | 999 void Run(PipelineData* data, Zone* temp_zone, const char* phase) { |
| 1000 CompilationInfo* info = data->info(); | 1000 CompilationInfo* info = data->info(); |
| 1001 Graph* graph = data->graph(); | 1001 Graph* graph = data->graph(); |
| 1002 | 1002 |
| 1003 { // Print dot. | |
| 1004 FILE* dot_file = OpenVisualizerLogFile(info, phase, "dot", "w+"); | |
| 1005 if (dot_file == nullptr) return; | |
| 1006 OFStream dot_of(dot_file); | |
| 1007 dot_of << AsDOT(*graph); | |
| 1008 fclose(dot_file); | |
| 1009 } | |
| 1010 | |
| 1011 { // Print JSON. | 1003 { // Print JSON. |
| 1012 FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "a+"); | 1004 FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "a+"); |
| 1013 if (json_file == nullptr) return; | 1005 if (json_file == nullptr) return; |
| 1014 OFStream json_of(json_file); | 1006 OFStream json_of(json_file); |
| 1015 json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":" | 1007 json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":" |
| 1016 << AsJSON(*graph, data->source_positions()) << "},\n"; | 1008 << AsJSON(*graph, data->source_positions()) << "},\n"; |
| 1017 fclose(json_file); | 1009 fclose(json_file); |
| 1018 } | 1010 } |
| 1019 | 1011 |
| 1020 if (FLAG_trace_turbo_graph) { // Simple textual RPO. | 1012 if (FLAG_trace_turbo_graph) { // Simple textual RPO. |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 tcf << AsC1VRegisterAllocationData("CodeGen", | 1472 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1481 data->register_allocation_data()); | 1473 data->register_allocation_data()); |
| 1482 } | 1474 } |
| 1483 | 1475 |
| 1484 data->DeleteRegisterAllocationZone(); | 1476 data->DeleteRegisterAllocationZone(); |
| 1485 } | 1477 } |
| 1486 | 1478 |
| 1487 } // namespace compiler | 1479 } // namespace compiler |
| 1488 } // namespace internal | 1480 } // namespace internal |
| 1489 } // namespace v8 | 1481 } // namespace v8 |
| OLD | NEW |