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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 os_ << ",\"rankInputs\":[0]"; | 120 os_ << ",\"rankInputs\":[0]"; |
121 } | 121 } |
122 SourcePosition position = positions_->GetSourcePosition(node); | 122 SourcePosition position = positions_->GetSourcePosition(node); |
123 if (position.IsKnown()) { | 123 if (position.IsKnown()) { |
124 os_ << ",\"pos\":" << position.raw(); | 124 os_ << ",\"pos\":" << position.raw(); |
125 } | 125 } |
126 os_ << ",\"opcode\":\"" << IrOpcode::Mnemonic(node->opcode()) << "\""; | 126 os_ << ",\"opcode\":\"" << IrOpcode::Mnemonic(node->opcode()) << "\""; |
127 os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true" | 127 os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true" |
128 : "false"); | 128 : "false"); |
129 if (NodeProperties::IsTyped(node)) { | 129 if (NodeProperties::IsTyped(node)) { |
130 Bounds bounds = NodeProperties::GetBounds(node); | 130 Type* type = NodeProperties::GetType(node); |
131 std::ostringstream upper; | 131 std::ostringstream type_out; |
132 bounds.upper->PrintTo(upper); | 132 type->PrintTo(type_out); |
133 std::ostringstream lower; | 133 os_ << ",\"type\":\"" << Escaped(type_out, "\"") << "\""; |
134 bounds.lower->PrintTo(lower); | |
135 os_ << ",\"upper_type\":\"" << Escaped(upper, "\"") << "\""; | |
136 os_ << ",\"lower_type\":\"" << Escaped(lower, "\"") << "\""; | |
137 } | 134 } |
138 os_ << "}"; | 135 os_ << "}"; |
139 } | 136 } |
140 | 137 |
141 private: | 138 private: |
142 std::ostream& os_; | 139 std::ostream& os_; |
143 AllNodes all_; | 140 AllNodes all_; |
144 const SourcePositionTable* positions_; | 141 const SourcePositionTable* positions_; |
145 bool first_node_; | 142 bool first_node_; |
146 | 143 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 292 |
296 if (OperatorProperties::IsBasicBlockBegin(node->op()) || | 293 if (OperatorProperties::IsBasicBlockBegin(node->op()) || |
297 GetControlCluster(node) == NULL) { | 294 GetControlCluster(node) == NULL) { |
298 for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) { | 295 for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) { |
299 os_ << "|<I" << (*i).index() << ">C #" << SafeId((*i).to()); | 296 os_ << "|<I" << (*i).index() << ">C #" << SafeId((*i).to()); |
300 } | 297 } |
301 } | 298 } |
302 os_ << "}"; | 299 os_ << "}"; |
303 | 300 |
304 if (FLAG_trace_turbo_types && NodeProperties::IsTyped(node)) { | 301 if (FLAG_trace_turbo_types && NodeProperties::IsTyped(node)) { |
305 Bounds bounds = NodeProperties::GetBounds(node); | 302 Type* type = NodeProperties::GetType(node); |
306 std::ostringstream upper; | 303 std::ostringstream type_out; |
307 bounds.upper->PrintTo(upper); | 304 type->PrintTo(type_out); |
308 std::ostringstream lower; | 305 os_ << "|" << Escaped(type_out); |
309 bounds.lower->PrintTo(lower); | |
310 os_ << "|" << Escaped(upper) << "|" << Escaped(lower); | |
311 } | 306 } |
312 os_ << "}\"\n"; | 307 os_ << "}\"\n"; |
313 | 308 |
314 os_ << " ]\n"; | 309 os_ << " ]\n"; |
315 if (control_cluster != NULL) os_ << " }\n"; | 310 if (control_cluster != NULL) os_ << " }\n"; |
316 } | 311 } |
317 | 312 |
318 | 313 |
319 static bool IsLikelyBackEdge(Node* from, int index, Node* to) { | 314 static bool IsLikelyBackEdge(Node* from, int index, Node* to) { |
320 if (NodeProperties::IsPhi(from)) { | 315 if (NodeProperties::IsPhi(from)) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 " Ctx:"); | 533 " Ctx:"); |
539 PrintInputs(&i, OperatorProperties::GetFrameStateInputCount(node->op()), | 534 PrintInputs(&i, OperatorProperties::GetFrameStateInputCount(node->op()), |
540 " FS:"); | 535 " FS:"); |
541 PrintInputs(&i, node->op()->EffectInputCount(), " Eff:"); | 536 PrintInputs(&i, node->op()->EffectInputCount(), " Eff:"); |
542 PrintInputs(&i, node->op()->ControlInputCount(), " Ctrl:"); | 537 PrintInputs(&i, node->op()->ControlInputCount(), " Ctrl:"); |
543 } | 538 } |
544 | 539 |
545 | 540 |
546 void GraphC1Visualizer::PrintType(Node* node) { | 541 void GraphC1Visualizer::PrintType(Node* node) { |
547 if (NodeProperties::IsTyped(node)) { | 542 if (NodeProperties::IsTyped(node)) { |
548 Bounds bounds = NodeProperties::GetBounds(node); | 543 Type* type = NodeProperties::GetType(node); |
549 os_ << " type:"; | 544 os_ << " type:"; |
550 bounds.upper->PrintTo(os_); | 545 type->PrintTo(os_); |
551 os_ << ".."; | |
552 bounds.lower->PrintTo(os_); | |
553 } | 546 } |
554 } | 547 } |
555 | 548 |
556 | 549 |
557 void GraphC1Visualizer::PrintSchedule(const char* phase, | 550 void GraphC1Visualizer::PrintSchedule(const char* phase, |
558 const Schedule* schedule, | 551 const Schedule* schedule, |
559 const SourcePositionTable* positions, | 552 const SourcePositionTable* positions, |
560 const InstructionSequence* instructions) { | 553 const InstructionSequence* instructions) { |
561 Tag tag(this, "cfg"); | 554 Tag tag(this, "cfg"); |
562 PrintStringProperty("name", phase); | 555 PrintStringProperty("name", phase); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 820 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
828 } | 821 } |
829 os << ")" << std::endl; | 822 os << ")" << std::endl; |
830 } | 823 } |
831 } | 824 } |
832 return os; | 825 return os; |
833 } | 826 } |
834 } // namespace compiler | 827 } // namespace compiler |
835 } // namespace internal | 828 } // namespace internal |
836 } // namespace v8 | 829 } // namespace v8 |
OLD | NEW |