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 <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (first_node_) { | 122 if (first_node_) { |
123 first_node_ = false; | 123 first_node_ = false; |
124 } else { | 124 } else { |
125 os_ << ","; | 125 os_ << ","; |
126 } | 126 } |
127 std::ostringstream label; | 127 std::ostringstream label; |
128 label << *node->op(); | 128 label << *node->op(); |
129 os_ << "{\"id\":" << SafeId(node) << ",\"label\":\"" << Escaped(label, "\"") | 129 os_ << "{\"id\":" << SafeId(node) << ",\"label\":\"" << Escaped(label, "\"") |
130 << "\""; | 130 << "\""; |
131 IrOpcode::Value opcode = node->opcode(); | 131 IrOpcode::Value opcode = node->opcode(); |
132 if (opcode == IrOpcode::kPhi || opcode == IrOpcode::kEffectPhi) { | 132 if (IrOpcode::IsPhiOpcode(opcode)) { |
133 os_ << ",\"rankInputs\":[0," << NodeProperties::FirstControlIndex(node) | 133 os_ << ",\"rankInputs\":[0," << NodeProperties::FirstControlIndex(node) |
134 << "]"; | 134 << "]"; |
135 os_ << ",\"rankWithInput\":[" << NodeProperties::FirstControlIndex(node) | 135 os_ << ",\"rankWithInput\":[" << NodeProperties::FirstControlIndex(node) |
136 << "]"; | 136 << "]"; |
137 } else if (opcode == IrOpcode::kIfTrue || opcode == IrOpcode::kIfFalse || | 137 } else if (opcode == IrOpcode::kIfTrue || opcode == IrOpcode::kIfFalse || |
138 opcode == IrOpcode::kLoop) { | 138 opcode == IrOpcode::kLoop) { |
139 os_ << ",\"rankInputs\":[" << NodeProperties::FirstControlIndex(node) | 139 os_ << ",\"rankInputs\":[" << NodeProperties::FirstControlIndex(node) |
140 << "]"; | 140 << "]"; |
141 } | 141 } |
142 if (opcode == IrOpcode::kBranch) { | 142 if (opcode == IrOpcode::kBranch) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 os_ << "|" << Escaped(upper) << "|" << Escaped(lower); | 318 os_ << "|" << Escaped(upper) << "|" << Escaped(lower); |
319 } | 319 } |
320 os_ << "}\"\n"; | 320 os_ << "}\"\n"; |
321 | 321 |
322 os_ << " ]\n"; | 322 os_ << " ]\n"; |
323 if (control_cluster != NULL) os_ << " }\n"; | 323 if (control_cluster != NULL) os_ << " }\n"; |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 static bool IsLikelyBackEdge(Node* from, int index, Node* to) { | 327 static bool IsLikelyBackEdge(Node* from, int index, Node* to) { |
328 if (from->opcode() == IrOpcode::kPhi || | 328 if (IrOpcode::IsPhiOpcode(from->opcode())) { |
329 from->opcode() == IrOpcode::kEffectPhi) { | |
330 Node* control = NodeProperties::GetControlInput(from, 0); | 329 Node* control = NodeProperties::GetControlInput(from, 0); |
331 return control != NULL && control->opcode() != IrOpcode::kMerge && | 330 return control != NULL && control->opcode() != IrOpcode::kMerge && |
332 control != to && index != 0; | 331 control != to && index != 0; |
333 } else if (from->opcode() == IrOpcode::kLoop) { | 332 } else if (from->opcode() == IrOpcode::kLoop) { |
334 return index != 0; | 333 return index != 0; |
335 } else { | 334 } else { |
336 return false; | 335 return false; |
337 } | 336 } |
338 } | 337 } |
339 | 338 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 824 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
826 } | 825 } |
827 os << ")" << std::endl; | 826 os << ")" << std::endl; |
828 } | 827 } |
829 } | 828 } |
830 return os; | 829 return os; |
831 } | 830 } |
832 } | 831 } |
833 } | 832 } |
834 } // namespace v8::internal::compiler | 833 } // namespace v8::internal::compiler |
OLD | NEW |