Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index fa0ff173b25703d3994b2d428160c953ee14c269..a7d2c7b3ccc8cfc3b83c47fa9e74ef8679d8e13c 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -22,6 +22,7 @@ |
#include "src/compiler/verifier.h" |
#include "src/hydrogen.h" |
#include "src/ostreams.h" |
+#include "src/utils.h" |
namespace v8 { |
namespace internal { |
@@ -73,9 +74,25 @@ class PhaseStats { |
void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) { |
if (FLAG_trace_turbo) { |
+ char buffer[256]; |
+ Vector<char> filename(buffer, sizeof(buffer)); |
+ SmartArrayPointer<char> functionname = |
+ info_->shared_info()->DebugName()->ToCString(); |
+ if (strlen(functionname.get()) > 0) { |
+ SNPrintF(filename, "turbo-%s-%s.dot", functionname.get(), phase); |
+ } else { |
+ SNPrintF(filename, "turbo-%p-%s.dot", static_cast<void*>(info_), phase); |
+ } |
+ std::replace(filename.start(), filename.start() + filename.length(), ' ', |
+ '_'); |
+ FILE* file = base::OS::FOpen(filename.start(), "w+"); |
+ OFStream of(file); |
+ of << AsDOT(*graph); |
+ fclose(file); |
+ |
OFStream os(stdout); |
- os << "-- " << phase << " graph -----------------------------------\n" |
- << AsDOT(*graph); |
+ os << "-- " << phase << " graph printed to file " << filename.start() |
+ << "\n"; |
} |
if (VerifyGraphs()) Verifier::Run(graph); |
} |