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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 private: | 411 private: |
412 void PrintIndent(); | 412 void PrintIndent(); |
413 void PrintStringProperty(const char* name, const char* value); | 413 void PrintStringProperty(const char* name, const char* value); |
414 void PrintLongProperty(const char* name, int64_t value); | 414 void PrintLongProperty(const char* name, int64_t value); |
415 void PrintIntProperty(const char* name, int value); | 415 void PrintIntProperty(const char* name, int value); |
416 void PrintBlockProperty(const char* name, BasicBlock::Id block_id); | 416 void PrintBlockProperty(const char* name, BasicBlock::Id block_id); |
417 void PrintNodeId(Node* n); | 417 void PrintNodeId(Node* n); |
418 void PrintNode(Node* n); | 418 void PrintNode(Node* n); |
419 void PrintInputs(Node* n); | 419 void PrintInputs(Node* n); |
420 void PrintInputs(InputIter* i, int count, const char* prefix); | 420 template <typename InputIterator> |
| 421 void PrintInputs(InputIterator* i, int count, const char* prefix); |
421 void PrintType(Node* node); | 422 void PrintType(Node* node); |
422 | 423 |
423 void PrintLiveRange(LiveRange* range, const char* type); | 424 void PrintLiveRange(LiveRange* range, const char* type); |
424 class Tag FINAL BASE_EMBEDDED { | 425 class Tag FINAL BASE_EMBEDDED { |
425 public: | 426 public: |
426 Tag(GraphC1Visualizer* visualizer, const char* name) { | 427 Tag(GraphC1Visualizer* visualizer, const char* name) { |
427 name_ = name; | 428 name_ = name; |
428 visualizer_ = visualizer; | 429 visualizer_ = visualizer; |
429 visualizer->PrintIndent(); | 430 visualizer->PrintIndent(); |
430 visualizer_->os_ << "begin_" << name << "\n"; | 431 visualizer_->os_ << "begin_" << name << "\n"; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 void GraphC1Visualizer::PrintNodeId(Node* n) { os_ << "n" << SafeId(n); } | 510 void GraphC1Visualizer::PrintNodeId(Node* n) { os_ << "n" << SafeId(n); } |
510 | 511 |
511 | 512 |
512 void GraphC1Visualizer::PrintNode(Node* n) { | 513 void GraphC1Visualizer::PrintNode(Node* n) { |
513 PrintNodeId(n); | 514 PrintNodeId(n); |
514 os_ << " " << *n->op() << " "; | 515 os_ << " " << *n->op() << " "; |
515 PrintInputs(n); | 516 PrintInputs(n); |
516 } | 517 } |
517 | 518 |
518 | 519 |
519 void GraphC1Visualizer::PrintInputs(InputIter* i, int count, | 520 template <typename InputIterator> |
| 521 void GraphC1Visualizer::PrintInputs(InputIterator* i, int count, |
520 const char* prefix) { | 522 const char* prefix) { |
521 if (count > 0) { | 523 if (count > 0) { |
522 os_ << prefix; | 524 os_ << prefix; |
523 } | 525 } |
524 while (count > 0) { | 526 while (count > 0) { |
525 os_ << " "; | 527 os_ << " "; |
526 PrintNodeId(**i); | 528 PrintNodeId(**i); |
527 ++(*i); | 529 ++(*i); |
528 count--; | 530 count--; |
529 } | 531 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 825 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
824 } | 826 } |
825 os << ")" << std::endl; | 827 os << ")" << std::endl; |
826 } | 828 } |
827 } | 829 } |
828 return os; | 830 return os; |
829 } | 831 } |
830 } | 832 } |
831 } | 833 } |
832 } // namespace v8::internal::compiler | 834 } // namespace v8::internal::compiler |
OLD | NEW |