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

Side by Side Diff: src/compiler/generic-algorithm.h

Issue 765983002: Clean up node iteration (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment Created 6 years 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
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 #ifndef V8_COMPILER_GENERIC_ALGORITHM_H_ 5 #ifndef V8_COMPILER_GENERIC_ALGORITHM_H_
6 #define V8_COMPILER_GENERIC_ALGORITHM_H_ 6 #define V8_COMPILER_GENERIC_ALGORITHM_H_
7 7
8 #include <stack> 8 #include <stack>
9 9
10 #include "src/compiler/generic-graph.h" 10 #include "src/compiler/generic-graph.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 stack.pop(); 64 stack.pop();
65 if (stack.empty()) { 65 if (stack.empty()) {
66 if (++root_begin == root_end) return; 66 if (++root_begin == root_end) return;
67 current = *root_begin; 67 current = *root_begin;
68 break; 68 break;
69 } 69 }
70 post_order_node = Traits::from(stack.top().first); 70 post_order_node = Traits::from(stack.top().first);
71 visit = true; 71 visit = true;
72 } else { 72 } else {
73 visitor->PreEdge(Traits::from(top.first), top.first.edge().index(), 73 visitor->PreEdge(Traits::from(top.first), (*top.first).index(),
74 Traits::to(top.first)); 74 Traits::to(top.first));
75 current = Traits::to(top.first); 75 current = Traits::to(top.first);
76 if (!GetVisited(&visited, current->id())) break; 76 if (!GetVisited(&visited, current->id())) break;
77 } 77 }
78 top = stack.top(); 78 top = stack.top();
79 visitor->PostEdge(Traits::from(top.first), top.first.edge().index(), 79 visitor->PostEdge(Traits::from(top.first), (*top.first).index(),
80 Traits::to(top.first)); 80 Traits::to(top.first));
81 ++stack.top().first; 81 ++stack.top().first;
82 } 82 }
83 } 83 }
84 } 84 }
85 85
86 template <class Visitor, class Traits> 86 template <class Visitor, class Traits>
87 static void Visit(GenericGraphBase* graph, Zone* zone, 87 static void Visit(GenericGraphBase* graph, Zone* zone,
88 typename Traits::Node* current, Visitor* visitor) { 88 typename Traits::Node* current, Visitor* visitor) {
89 typename Traits::Node* array[] = {current}; 89 typename Traits::Node* array[] = {current};
(...skipping 20 matching lines...) Expand all
110 static bool GetVisited(BoolVector* visited, int id) { 110 static bool GetVisited(BoolVector* visited, int id) {
111 if (id >= static_cast<int>(visited->size())) return false; 111 if (id >= static_cast<int>(visited->size())) return false;
112 return visited->at(id); 112 return visited->at(id);
113 } 113 }
114 }; 114 };
115 } 115 }
116 } 116 }
117 } // namespace v8::internal::compiler 117 } // namespace v8::internal::compiler
118 118
119 #endif // V8_COMPILER_GENERIC_ALGORITHM_H_ 119 #endif // V8_COMPILER_GENERIC_ALGORITHM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698