Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler/graph-visualizer.cc

Issue 1846933002: [turbofan] Handle dead diamonds in scheduling and add a test. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/scheduler.cc » ('j') | src/compiler/scheduler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 605 }
606 606
607 const int kUnvisited = 0; 607 const int kUnvisited = 0;
608 const int kOnStack = 1; 608 const int kOnStack = 1;
609 const int kVisited = 2; 609 const int kVisited = 2;
610 610
611 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { 611 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) {
612 Zone local_zone; 612 Zone local_zone;
613 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); 613 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone);
614 ZoneStack<Node*> stack(&local_zone); 614 ZoneStack<Node*> stack(&local_zone);
615 ZoneVector<Node*> all(&local_zone);
615 616
616 stack.push(ar.graph.end()); 617 stack.push(ar.graph.end());
617 state[ar.graph.end()->id()] = kOnStack; 618 state[ar.graph.end()->id()] = kOnStack;
618 while (!stack.empty()) { 619 while (!stack.empty()) {
619 Node* n = stack.top(); 620 Node* n = stack.top();
620 bool pop = true; 621 bool pop = true;
621 for (Node* const i : n->inputs()) { 622 for (Node* const i : n->inputs()) {
622 if (state[i->id()] == kUnvisited) { 623 if (state[i->id()] == kUnvisited) {
623 state[i->id()] = kOnStack; 624 state[i->id()] = kOnStack;
624 stack.push(i); 625 stack.push(i);
625 pop = false; 626 pop = false;
626 break; 627 break;
627 } 628 }
628 } 629 }
629 if (pop) { 630 if (pop) {
631 all.push_back(n);
630 state[n->id()] = kVisited; 632 state[n->id()] = kVisited;
631 stack.pop(); 633 stack.pop();
632 os << "#" << n->id() << ":" << *n->op() << "("; 634 os << "#" << n->id() << ":" << *n->op() << "(";
633 int j = 0; 635 int j = 0;
634 for (Node* const i : n->inputs()) { 636 for (Node* const i : n->inputs()) {
635 if (j++ > 0) os << ", "; 637 if (j++ > 0) os << ", ";
636 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); 638 os << "#" << SafeId(i) << ":" << SafeMnemonic(i);
637 } 639 }
638 os << ")" << std::endl; 640 os << ")" << std::endl;
639 } 641 }
640 } 642 }
643
644 bool first = true;
645
646 for (size_t i = 0; i < all.size(); i++) {
647 Node* l = all[i];
648 for (Node* n : l->uses()) {
649 if (state[n->id()] == kUnvisited) {
650 state[n->id()] = kVisited;
651 all.push_back(n);
652 if (first) {
653 os << "Gray nodes:" << std::endl;
654 first = false;
655 }
656 os << "#" << n->id() << ":" << *n->op() << "(";
657 int j = 0;
658 for (Node* const i : n->inputs()) {
659 if (j++ > 0) os << ", ";
660 os << "#" << SafeId(i) << ":" << SafeMnemonic(i);
661 }
662 os << ")" << std::endl;
663 }
664 }
665 }
641 return os; 666 return os;
642 } 667 }
643 } // namespace compiler 668 } // namespace compiler
644 } // namespace internal 669 } // namespace internal
645 } // namespace v8 670 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/scheduler.cc » ('j') | src/compiler/scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698