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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 private: | 190 private: |
191 std::ostream& os_; | 191 std::ostream& os_; |
192 AllNodes all_; | 192 AllNodes all_; |
193 bool first_edge_; | 193 bool first_edge_; |
194 | 194 |
195 DISALLOW_COPY_AND_ASSIGN(JSONGraphEdgeWriter); | 195 DISALLOW_COPY_AND_ASSIGN(JSONGraphEdgeWriter); |
196 }; | 196 }; |
197 | 197 |
198 | 198 |
199 std::ostream& operator<<(std::ostream& os, const AsJSON& ad) { | 199 std::ostream& operator<<(std::ostream& os, const AsJSON& ad) { |
200 Zone tmp_zone; | 200 base::AccountingAllocator allocator; |
| 201 Zone tmp_zone(&allocator); |
201 os << "{\n\"nodes\":["; | 202 os << "{\n\"nodes\":["; |
202 JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print(); | 203 JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print(); |
203 os << "],\n\"edges\":["; | 204 os << "],\n\"edges\":["; |
204 JSONGraphEdgeWriter(os, &tmp_zone, &ad.graph).Print(); | 205 JSONGraphEdgeWriter(os, &tmp_zone, &ad.graph).Print(); |
205 os << "]}"; | 206 os << "]}"; |
206 return os; | 207 return os; |
207 } | 208 } |
208 | 209 |
209 | 210 |
210 class GraphC1Visualizer { | 211 class GraphC1Visualizer { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 577 } |
577 current_pos = current_pos->next(); | 578 current_pos = current_pos->next(); |
578 } | 579 } |
579 | 580 |
580 os_ << " \"\"\n"; | 581 os_ << " \"\"\n"; |
581 } | 582 } |
582 } | 583 } |
583 | 584 |
584 | 585 |
585 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) { | 586 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) { |
586 Zone tmp_zone; | 587 base::AccountingAllocator allocator; |
| 588 Zone tmp_zone(&allocator); |
587 GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_); | 589 GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_); |
588 return os; | 590 return os; |
589 } | 591 } |
590 | 592 |
591 | 593 |
592 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { | 594 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { |
593 Zone tmp_zone; | 595 base::AccountingAllocator allocator; |
| 596 Zone tmp_zone(&allocator); |
594 GraphC1Visualizer(os, &tmp_zone) | 597 GraphC1Visualizer(os, &tmp_zone) |
595 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); | 598 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); |
596 return os; | 599 return os; |
597 } | 600 } |
598 | 601 |
599 | 602 |
600 std::ostream& operator<<(std::ostream& os, | 603 std::ostream& operator<<(std::ostream& os, |
601 const AsC1VRegisterAllocationData& ac) { | 604 const AsC1VRegisterAllocationData& ac) { |
602 Zone tmp_zone; | 605 base::AccountingAllocator allocator; |
| 606 Zone tmp_zone(&allocator); |
603 GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_); | 607 GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_); |
604 return os; | 608 return os; |
605 } | 609 } |
606 | 610 |
607 const int kUnvisited = 0; | 611 const int kUnvisited = 0; |
608 const int kOnStack = 1; | 612 const int kOnStack = 1; |
609 const int kVisited = 2; | 613 const int kVisited = 2; |
610 | 614 |
611 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { | 615 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
612 Zone local_zone; | 616 base::AccountingAllocator allocator; |
| 617 Zone local_zone(&allocator); |
613 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); | 618 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); |
614 ZoneStack<Node*> stack(&local_zone); | 619 ZoneStack<Node*> stack(&local_zone); |
615 | 620 |
616 stack.push(ar.graph.end()); | 621 stack.push(ar.graph.end()); |
617 state[ar.graph.end()->id()] = kOnStack; | 622 state[ar.graph.end()->id()] = kOnStack; |
618 while (!stack.empty()) { | 623 while (!stack.empty()) { |
619 Node* n = stack.top(); | 624 Node* n = stack.top(); |
620 bool pop = true; | 625 bool pop = true; |
621 for (Node* const i : n->inputs()) { | 626 for (Node* const i : n->inputs()) { |
622 if (state[i->id()] == kUnvisited) { | 627 if (state[i->id()] == kUnvisited) { |
(...skipping 13 matching lines...) Expand all Loading... |
636 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 641 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
637 } | 642 } |
638 os << ")" << std::endl; | 643 os << ")" << std::endl; |
639 } | 644 } |
640 } | 645 } |
641 return os; | 646 return os; |
642 } | 647 } |
643 } // namespace compiler | 648 } // namespace compiler |
644 } // namespace internal | 649 } // namespace internal |
645 } // namespace v8 | 650 } // namespace v8 |
OLD | NEW |