Revision: 23080
Author:   [email protected]
Date:     Tue Aug 12 13:09:09 2014 UTC
Log:      Add print-to-file for turbofan tracing.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/460723002
http://code.google.com/p/v8/source/detail?r=23080

Modified:
 /branches/bleeding_edge/src/compiler/pipeline.cc

=======================================
--- /branches/bleeding_edge/src/compiler/pipeline.cc Tue Aug 12 12:30:22 2014 UTC +++ /branches/bleeding_edge/src/compiler/pipeline.cc Tue Aug 12 13:09:09 2014 UTC
@@ -23,6 +23,7 @@
 #include "src/compiler/verifier.h"
 #include "src/hydrogen.h"
 #include "src/ostreams.h"
+#include "src/utils.h"

 namespace v8 {
 namespace internal {
@@ -74,9 +75,25 @@

 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);
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to