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 <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 private: | 232 private: |
233 std::ostream& os_; | 233 std::ostream& os_; |
234 AllNodes all_; | 234 AllNodes all_; |
235 bool first_edge_; | 235 bool first_edge_; |
236 | 236 |
237 DISALLOW_COPY_AND_ASSIGN(JSONGraphEdgeWriter); | 237 DISALLOW_COPY_AND_ASSIGN(JSONGraphEdgeWriter); |
238 }; | 238 }; |
239 | 239 |
240 | 240 |
241 std::ostream& operator<<(std::ostream& os, const AsJSON& ad) { | 241 std::ostream& operator<<(std::ostream& os, const AsJSON& ad) { |
242 base::AccountingAllocator allocator; | 242 AccountingAllocator allocator; |
243 Zone tmp_zone(&allocator); | 243 Zone tmp_zone(&allocator); |
244 os << "{\n\"nodes\":["; | 244 os << "{\n\"nodes\":["; |
245 JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print(); | 245 JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print(); |
246 os << "],\n\"edges\":["; | 246 os << "],\n\"edges\":["; |
247 JSONGraphEdgeWriter(os, &tmp_zone, &ad.graph).Print(); | 247 JSONGraphEdgeWriter(os, &tmp_zone, &ad.graph).Print(); |
248 os << "]}"; | 248 os << "]}"; |
249 return os; | 249 return os; |
250 } | 250 } |
251 | 251 |
252 | 252 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 622 } |
623 current_pos = current_pos->next(); | 623 current_pos = current_pos->next(); |
624 } | 624 } |
625 | 625 |
626 os_ << " \"\"\n"; | 626 os_ << " \"\"\n"; |
627 } | 627 } |
628 } | 628 } |
629 | 629 |
630 | 630 |
631 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) { | 631 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) { |
632 base::AccountingAllocator allocator; | 632 AccountingAllocator allocator; |
633 Zone tmp_zone(&allocator); | 633 Zone tmp_zone(&allocator); |
634 GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_); | 634 GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_); |
635 return os; | 635 return os; |
636 } | 636 } |
637 | 637 |
638 | 638 |
639 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { | 639 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { |
640 base::AccountingAllocator allocator; | 640 AccountingAllocator allocator; |
641 Zone tmp_zone(&allocator); | 641 Zone tmp_zone(&allocator); |
642 GraphC1Visualizer(os, &tmp_zone) | 642 GraphC1Visualizer(os, &tmp_zone) |
643 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); | 643 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); |
644 return os; | 644 return os; |
645 } | 645 } |
646 | 646 |
647 | 647 |
648 std::ostream& operator<<(std::ostream& os, | 648 std::ostream& operator<<(std::ostream& os, |
649 const AsC1VRegisterAllocationData& ac) { | 649 const AsC1VRegisterAllocationData& ac) { |
650 base::AccountingAllocator allocator; | 650 AccountingAllocator allocator; |
651 Zone tmp_zone(&allocator); | 651 Zone tmp_zone(&allocator); |
652 GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_); | 652 GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_); |
653 return os; | 653 return os; |
654 } | 654 } |
655 | 655 |
656 const int kUnvisited = 0; | 656 const int kUnvisited = 0; |
657 const int kOnStack = 1; | 657 const int kOnStack = 1; |
658 const int kVisited = 2; | 658 const int kVisited = 2; |
659 | 659 |
660 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { | 660 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
661 base::AccountingAllocator allocator; | 661 AccountingAllocator allocator; |
662 Zone local_zone(&allocator); | 662 Zone local_zone(&allocator); |
663 | 663 |
664 // Do a post-order depth-first search on the RPO graph. For every node, | 664 // Do a post-order depth-first search on the RPO graph. For every node, |
665 // print: | 665 // print: |
666 // | 666 // |
667 // - the node id | 667 // - the node id |
668 // - the operator mnemonic | 668 // - the operator mnemonic |
669 // - in square brackets its parameter (if present) | 669 // - in square brackets its parameter (if present) |
670 // - in parentheses the list of argument ids and their mnemonics | 670 // - in parentheses the list of argument ids and their mnemonics |
671 // - the node type (if it is typed) | 671 // - the node type (if it is typed) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 os << "]"; | 708 os << "]"; |
709 } | 709 } |
710 os << std::endl; | 710 os << std::endl; |
711 } | 711 } |
712 } | 712 } |
713 return os; | 713 return os; |
714 } | 714 } |
715 } // namespace compiler | 715 } // namespace compiler |
716 } // namespace internal | 716 } // namespace internal |
717 } // namespace v8 | 717 } // namespace v8 |
OLD | NEW |