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 = nullptr); | 119 GraphReducer(Zone* zone, Graph* graph, Node* dead_value = nullptr, |
| 120 Node* dead_control = nullptr); |
120 ~GraphReducer(); | 121 ~GraphReducer(); |
121 | 122 |
122 Graph* graph() const { return graph_; } | 123 Graph* graph() const { return graph_; } |
123 | 124 |
124 void AddReducer(Reducer* reducer); | 125 void AddReducer(Reducer* reducer); |
125 | 126 |
126 // Reduce a single node. | 127 // Reduce a single node. |
127 void ReduceNode(Node* const); | 128 void ReduceNode(Node* const); |
128 // Reduce the whole graph. | 129 // Reduce the whole graph. |
129 void ReduceGraph(); | 130 void ReduceGraph(); |
(...skipping 26 matching lines...) Expand all Loading... |
156 | 157 |
157 // Node stack operations. | 158 // Node stack operations. |
158 void Pop(); | 159 void Pop(); |
159 void Push(Node* node); | 160 void Push(Node* node); |
160 | 161 |
161 // Revisit queue operations. | 162 // Revisit queue operations. |
162 bool Recurse(Node* node); | 163 bool Recurse(Node* node); |
163 void Revisit(Node* node) final; | 164 void Revisit(Node* node) final; |
164 | 165 |
165 Graph* const graph_; | 166 Graph* const graph_; |
166 Node* const dead_; | 167 Node* dead_value_; |
| 168 Node* dead_control_; |
167 NodeMarker<State> state_; | 169 NodeMarker<State> state_; |
168 ZoneVector<Reducer*> reducers_; | 170 ZoneVector<Reducer*> reducers_; |
169 ZoneStack<Node*> revisit_; | 171 ZoneStack<Node*> revisit_; |
170 ZoneStack<NodeState> stack_; | 172 ZoneStack<NodeState> stack_; |
171 | 173 |
172 DISALLOW_COPY_AND_ASSIGN(GraphReducer); | 174 DISALLOW_COPY_AND_ASSIGN(GraphReducer); |
173 }; | 175 }; |
174 | 176 |
175 } // namespace compiler | 177 } // namespace compiler |
176 } // namespace internal | 178 } // namespace internal |
177 } // namespace v8 | 179 } // namespace v8 |
178 | 180 |
179 #endif // V8_COMPILER_GRAPH_REDUCER_H_ | 181 #endif // V8_COMPILER_GRAPH_REDUCER_H_ |
OLD | NEW |