OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_GRAPH_REDUCER_H_ | 5 #ifndef V8_COMPILER_GRAPH_REDUCER_H_ |
6 #define V8_COMPILER_GRAPH_REDUCER_H_ | 6 #define V8_COMPILER_GRAPH_REDUCER_H_ |
7 | 7 |
8 #include "src/compiler/node-marker.h" | 8 #include "src/compiler/node-marker.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 private: | 111 private: |
112 Editor* const editor_; | 112 Editor* const editor_; |
113 }; | 113 }; |
114 | 114 |
115 | 115 |
116 // Performs an iterative reduction of a node graph. | 116 // Performs an iterative reduction of a node graph. |
117 class GraphReducer : public AdvancedReducer::Editor { | 117 class GraphReducer : public AdvancedReducer::Editor { |
118 public: | 118 public: |
119 GraphReducer(Zone* zone, Graph* graph, Node* dead_value = nullptr, | 119 GraphReducer(Zone* zone, Graph* graph, Node* dead = nullptr); |
120 Node* dead_control = nullptr); | |
121 ~GraphReducer(); | 120 ~GraphReducer(); |
122 | 121 |
123 Graph* graph() const { return graph_; } | 122 Graph* graph() const { return graph_; } |
124 | 123 |
125 void AddReducer(Reducer* reducer); | 124 void AddReducer(Reducer* reducer); |
126 | 125 |
127 // Reduce a single node. | 126 // Reduce a single node. |
128 void ReduceNode(Node* const); | 127 void ReduceNode(Node* const); |
129 // Reduce the whole graph. | 128 // Reduce the whole graph. |
130 void ReduceGraph(); | 129 void ReduceGraph(); |
(...skipping 26 matching lines...) Expand all Loading... |
157 | 156 |
158 // Node stack operations. | 157 // Node stack operations. |
159 void Pop(); | 158 void Pop(); |
160 void Push(Node* node); | 159 void Push(Node* node); |
161 | 160 |
162 // Revisit queue operations. | 161 // Revisit queue operations. |
163 bool Recurse(Node* node); | 162 bool Recurse(Node* node); |
164 void Revisit(Node* node) final; | 163 void Revisit(Node* node) final; |
165 | 164 |
166 Graph* const graph_; | 165 Graph* const graph_; |
167 Node* dead_value_; | 166 Node* const dead_; |
168 Node* dead_control_; | |
169 NodeMarker<State> state_; | 167 NodeMarker<State> state_; |
170 ZoneVector<Reducer*> reducers_; | 168 ZoneVector<Reducer*> reducers_; |
171 ZoneStack<Node*> revisit_; | 169 ZoneStack<Node*> revisit_; |
172 ZoneStack<NodeState> stack_; | 170 ZoneStack<NodeState> stack_; |
173 | 171 |
174 DISALLOW_COPY_AND_ASSIGN(GraphReducer); | 172 DISALLOW_COPY_AND_ASSIGN(GraphReducer); |
175 }; | 173 }; |
176 | 174 |
177 } // namespace compiler | 175 } // namespace compiler |
178 } // namespace internal | 176 } // namespace internal |
179 } // namespace v8 | 177 } // namespace v8 |
180 | 178 |
181 #endif // V8_COMPILER_GRAPH_REDUCER_H_ | 179 #endif // V8_COMPILER_GRAPH_REDUCER_H_ |
OLD | NEW |