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

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

Issue 676353002: [turbofan] Merge GenericNode with Node. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Win64 build Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « BUILD.gn ('k') | src/compiler/generic-algorithm-inl.h » ('j') | no next file with comments »
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 #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"
11 #include "src/compiler/generic-node.h"
12 #include "src/zone-containers.h" 11 #include "src/zone-containers.h"
13 12
14 namespace v8 { 13 namespace v8 {
15 namespace internal { 14 namespace internal {
16 namespace compiler { 15 namespace compiler {
17 16
18 // GenericGraphVisit allows visitation of graphs of nodes and edges in pre- and 17 // GenericGraphVisit allows visitation of graphs of nodes and edges in pre- and
19 // post-order. Visitation uses an explicitly allocated stack rather than the 18 // post-order. Visitation uses an explicitly allocated stack rather than the
20 // execution stack to avoid stack overflow. Although GenericGraphVisit is 19 // execution stack to avoid stack overflow. Although GenericGraphVisit is
21 // primarily intended to traverse networks of nodes through their 20 // primarily intended to traverse networks of nodes through their
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 91 }
93 } 92 }
94 93
95 template <class Visitor, class Traits> 94 template <class Visitor, class Traits>
96 static void Visit(GenericGraphBase* graph, Zone* zone, 95 static void Visit(GenericGraphBase* graph, Zone* zone,
97 typename Traits::Node* current, Visitor* visitor) { 96 typename Traits::Node* current, Visitor* visitor) {
98 typename Traits::Node* array[] = {current}; 97 typename Traits::Node* array[] = {current};
99 Visit<Visitor, Traits>(graph, zone, &array[0], &array[1], visitor); 98 Visit<Visitor, Traits>(graph, zone, &array[0], &array[1], visitor);
100 } 99 }
101 100
102 template <class B, class S> 101 template <class Node>
103 struct NullNodeVisitor { 102 struct NullNodeVisitor {
104 Control Pre(GenericNode<B, S>* node) { return CONTINUE; } 103 Control Pre(Node* node) { return CONTINUE; }
105 Control Post(GenericNode<B, S>* node) { return CONTINUE; } 104 Control Post(Node* node) { return CONTINUE; }
106 void PreEdge(GenericNode<B, S>* from, int index, GenericNode<B, S>* to) {} 105 void PreEdge(Node* from, int index, Node* to) {}
107 void PostEdge(GenericNode<B, S>* from, int index, GenericNode<B, S>* to) {} 106 void PostEdge(Node* from, int index, Node* to) {}
108 }; 107 };
109 108
110 private: 109 private:
111 static bool IsSkip(Control c) { return c & SKIP; } 110 static bool IsSkip(Control c) { return c & SKIP; }
112 static bool IsReenter(Control c) { return c & REENTER; } 111 static bool IsReenter(Control c) { return c & REENTER; }
113 112
114 // TODO(turbofan): resizing could be optionally templatized away. 113 // TODO(turbofan): resizing could be optionally templatized away.
115 static void SetVisited(BoolVector* visited, int id, bool value) { 114 static void SetVisited(BoolVector* visited, int id, bool value) {
116 if (id >= static_cast<int>(visited->size())) { 115 if (id >= static_cast<int>(visited->size())) {
117 // Resize and set all values to unvisited. 116 // Resize and set all values to unvisited.
118 visited->resize((3 * id) / 2, false); 117 visited->resize((3 * id) / 2, false);
119 } 118 }
120 visited->at(id) = value; 119 visited->at(id) = value;
121 } 120 }
122 121
123 static bool GetVisited(BoolVector* visited, int id) { 122 static bool GetVisited(BoolVector* visited, int id) {
124 if (id >= static_cast<int>(visited->size())) return false; 123 if (id >= static_cast<int>(visited->size())) return false;
125 return visited->at(id); 124 return visited->at(id);
126 } 125 }
127 }; 126 };
128 } 127 }
129 } 128 }
130 } // namespace v8::internal::compiler 129 } // namespace v8::internal::compiler
131 130
132 #endif // V8_COMPILER_GENERIC_ALGORITHM_H_ 131 #endif // V8_COMPILER_GENERIC_ALGORITHM_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/generic-algorithm-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698