OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/graph-visualizer.h" | 5 #include "src/compiler/graph-visualizer.h" |
6 | 6 |
7 #include "src/compiler/generic-algorithm.h" | 7 #include "src/compiler/generic-algorithm.h" |
8 #include "src/compiler/generic-node.h" | 8 #include "src/compiler/generic-node.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 Node* to = edge.to(); | 202 Node* to = edge.to(); |
203 bool unconstrained = IsLikelyBackEdge(from, index, to); | 203 bool unconstrained = IsLikelyBackEdge(from, index, to); |
204 os_ << " ID" << from->id(); | 204 os_ << " ID" << from->id(); |
205 if (all_nodes_.count(to) == 0) { | 205 if (all_nodes_.count(to) == 0) { |
206 os_ << ":I" << index << ":n -> DEAD_INPUT"; | 206 os_ << ":I" << index << ":n -> DEAD_INPUT"; |
207 } else if (OperatorProperties::IsBasicBlockBegin(from->op()) || | 207 } else if (OperatorProperties::IsBasicBlockBegin(from->op()) || |
208 GetControlCluster(from) == NULL || | 208 GetControlCluster(from) == NULL || |
209 (OperatorProperties::GetControlInputCount(from->op()) > 0 && | 209 (OperatorProperties::GetControlInputCount(from->op()) > 0 && |
210 NodeProperties::GetControlInput(from) != to)) { | 210 NodeProperties::GetControlInput(from) != to)) { |
211 os_ << ":I" << index << ":n -> ID" << to->id() << ":s" | 211 os_ << ":I" << index << ":n -> ID" << to->id() << ":s" |
212 << "[" << (unconstrained ? "constraint=false" : "") | 212 << "[" << (unconstrained ? "constraint=false, " : "") |
213 << (NodeProperties::IsControlEdge(edge) ? "style=bold" : "") | 213 << (NodeProperties::IsControlEdge(edge) ? "style=bold, " : "") |
214 << (NodeProperties::IsEffectEdge(edge) ? "style=dotted" : "") | 214 << (NodeProperties::IsEffectEdge(edge) ? "style=dotted, " : "") |
215 << (NodeProperties::IsContextEdge(edge) ? "style=dashed" : "") << "]"; | 215 << (NodeProperties::IsContextEdge(edge) ? "style=dashed, " : "") << "]"; |
Michael Starzinger
2014/09/02 14:34:03
Are trailing slashes OK for GraphViz? I am not a G
Michael Starzinger
2014/09/02 14:34:33
s/slashes/commas/
| |
216 } else { | 216 } else { |
217 os_ << " -> ID" << to->id() << ":s [color=transparent" | 217 os_ << " -> ID" << to->id() << ":s [color=transparent, " |
218 << (unconstrained ? ", constraint=false" : "") | 218 << (unconstrained ? "constraint=false, " : "") |
219 << (NodeProperties::IsControlEdge(edge) ? ", style=dashed" : "") << "]"; | 219 << (NodeProperties::IsControlEdge(edge) ? "style=dashed, " : "") << "]"; |
220 } | 220 } |
221 os_ << "\n"; | 221 os_ << "\n"; |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 void GraphVisualizer::Print() { | 225 void GraphVisualizer::Print() { |
226 os_ << "digraph D {\n" | 226 os_ << "digraph D {\n" |
227 << " node [fontsize=8,height=0.25]\n" | 227 << " node [fontsize=8,height=0.25]\n" |
228 << " rankdir=\"BT\"\n" | 228 << " rankdir=\"BT\"\n" |
229 << " ranksep=\"1.2 equally\"\n" | 229 << " ranksep=\"1.2 equally\"\n" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 | 273 |
274 | 274 |
275 OStream& operator<<(OStream& os, const AsDOT& ad) { | 275 OStream& operator<<(OStream& os, const AsDOT& ad) { |
276 Zone tmp_zone(ad.graph.zone()->isolate()); | 276 Zone tmp_zone(ad.graph.zone()->isolate()); |
277 GraphVisualizer(os, &tmp_zone, &ad.graph).Print(); | 277 GraphVisualizer(os, &tmp_zone, &ad.graph).Print(); |
278 return os; | 278 return os; |
279 } | 279 } |
280 } | 280 } |
281 } | 281 } |
282 } // namespace v8::internal::compiler | 282 } // namespace v8::internal::compiler |
OLD | NEW |