Reviewers: Michael Starzinger,

Message:
PTAL

Description:
Inprove graph visualizer for deoptimization and readablity.

[email protected]

Please review this at https://codereview.chromium.org/523593002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+20, -8 lines):
  M src/compiler/graph-visualizer.cc
  M src/compiler/operator-properties-inl.h


Index: src/compiler/graph-visualizer.cc
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc index df45d8f11e59d9a1464eea17b8dbf28951c8e129..587da55e252cb715fe732b8577e7529f486d25a3 100644
--- a/src/compiler/graph-visualizer.cc
+++ b/src/compiler/graph-visualizer.cc
@@ -33,7 +33,7 @@ class GraphVisualizer : public NullNodeVisitor {

  private:
   void AnnotateNode(Node* node);
-  void PrintEdge(Node* from, int index, Node* to);
+  void PrintEdge(Node::Edge edge);

   Zone* zone_;
   NodeSet all_nodes_;
@@ -168,7 +168,7 @@ void GraphVisualizer::AnnotateNode(Node* node) {
   }
for (int j = OperatorProperties::GetFrameStateInputCount(node->op()); j
0;
        ++i, j--) {
-    os_ << "|<I" << i.index() << ">X #" << (*i)->id();
+    os_ << "|<I" << i.index() << ">F #" << (*i)->id();
   }
   for (int j = OperatorProperties::GetEffectInputCount(node->op()); j > 0;
        ++i, j--) {
@@ -196,7 +196,10 @@ void GraphVisualizer::AnnotateNode(Node* node) {
 }


-void GraphVisualizer::PrintEdge(Node* from, int index, Node* to) {
+void GraphVisualizer::PrintEdge(Node::Edge edge) {
+  Node* from = edge.from();
+  int index = edge.index();
+  Node* to = edge.to();
   bool unconstrained = IsLikelyBackEdge(from, index, to);
   os_ << "  ID" << from->id();
   if (all_nodes_.count(to) == 0) {
@@ -205,11 +208,15 @@ void GraphVisualizer::PrintEdge(Node* from, int index, Node* to) {
              GetControlCluster(from) == NULL ||
              (OperatorProperties::GetControlInputCount(from->op()) > 0 &&
               NodeProperties::GetControlInput(from) != to)) {
-    os_ << ":I" << index << ":n -> ID" << to->id() << ":s";
-    if (unconstrained) os_ << " [constraint=false,style=dotted]";
+    os_ << ":I" << index << ":n -> ID" << to->id() << ":s"
+        << "[" << (unconstrained ? "constraint=false" : "")
+        << (NodeProperties::IsControlEdge(edge) ? "style=dashed" : "")
+        << (NodeProperties::IsEffectEdge(edge) ? "style=dotted" : "")
+ << (NodeProperties::IsContextEdge(edge) ? "style=bold" : "") << "]";
   } else {
     os_ << " -> ID" << to->id() << ":s [color=transparent"
-        << (unconstrained ? ", constraint=false" : "") << "]";
+        << (unconstrained ? ", constraint=false" : "")
+ << (NodeProperties::IsControlEdge(edge) ? ", style=dashed" : "") << "]";
   }
   os_ << "\n";
 }
@@ -219,6 +226,10 @@ void GraphVisualizer::Print() {
   os_ << "digraph D {\n"
       << "  node [fontsize=8,height=0.25]\n"
       << "  rankdir=\"BT\"\n"
+      << "  ranksep=\"1.2 equally\"\n"
+      << "  overlap=\"false\"\n"
+      << "  splines=\"true\"\n"
+      << "  concentrate=\"true\"\n"
       << "  \n";

   // Make sure all nodes have been output before writing out the edges.
@@ -244,7 +255,7 @@ void GraphVisualizer::Print() {
     Node::Inputs inputs = (*i)->inputs();
     for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
          ++iter) {
-      PrintEdge(iter.edge().from(), iter.edge().index(), iter.edge().to());
+      PrintEdge(iter.edge());
     }
   }
   os_ << "}\n";
Index: src/compiler/operator-properties-inl.h
diff --git a/src/compiler/operator-properties-inl.h b/src/compiler/operator-properties-inl.h index 9d8cc0424e05f9be54c4f5654490b66e9a9fba06..59396973a4cc513bf8d7b5e7cf833b54552b0d8e 100644
--- a/src/compiler/operator-properties-inl.h
+++ b/src/compiler/operator-properties-inl.h
@@ -155,7 +155,8 @@ inline bool OperatorProperties::IsBasicBlockBegin(Operator* op) {
   return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd ||
          opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop ||
          opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue ||
-         opcode == IrOpcode::kIfFalse;
+ opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kContinuation ||
+         opcode == IrOpcode::kLazyDeoptimization;
 }

 inline bool OperatorProperties::CanLazilyDeoptimize(Operator* op) {


--
--
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