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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void Revisit(Node* node) { | 96 void Revisit(Node* node) { |
97 DCHECK_NOT_NULL(editor_); | 97 DCHECK_NOT_NULL(editor_); |
98 editor_->Revisit(node); | 98 editor_->Revisit(node); |
99 } | 99 } |
100 void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr, | 100 void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr, |
101 Node* control = nullptr) { | 101 Node* control = nullptr) { |
102 DCHECK_NOT_NULL(editor_); | 102 DCHECK_NOT_NULL(editor_); |
103 editor_->ReplaceWithValue(node, value, effect, control); | 103 editor_->ReplaceWithValue(node, value, effect, control); |
104 } | 104 } |
105 | 105 |
| 106 // Relax the effects of {node} by immediately replacing effect and control |
| 107 // uses of {node} with the effect and control input to {node}. |
| 108 // TODO(turbofan): replace the effect input to {node} with {graph->start()}. |
| 109 void RelaxEffectsAndControls(Node* node) { |
| 110 DCHECK_NOT_NULL(editor_); |
| 111 editor_->ReplaceWithValue(node, node, nullptr, nullptr); |
| 112 } |
| 113 |
| 114 // Relax the control uses of {node} by immediately replacing them with the |
| 115 // control input to {node}. |
| 116 void RelaxControls(Node* node) { |
| 117 DCHECK_NOT_NULL(editor_); |
| 118 editor_->ReplaceWithValue(node, node, node, nullptr); |
| 119 } |
| 120 |
106 private: | 121 private: |
107 Editor* const editor_; | 122 Editor* const editor_; |
108 }; | 123 }; |
109 | 124 |
110 | 125 |
111 // Performs an iterative reduction of a node graph. | 126 // Performs an iterative reduction of a node graph. |
112 class GraphReducer final : public AdvancedReducer::Editor { | 127 class GraphReducer final : public AdvancedReducer::Editor { |
113 public: | 128 public: |
114 GraphReducer(Graph* graph, Zone* zone); | 129 GraphReducer(Graph* graph, Zone* zone); |
115 ~GraphReducer() final; | 130 ~GraphReducer() final; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ZoneStack<NodeState> stack_; | 179 ZoneStack<NodeState> stack_; |
165 | 180 |
166 DISALLOW_COPY_AND_ASSIGN(GraphReducer); | 181 DISALLOW_COPY_AND_ASSIGN(GraphReducer); |
167 }; | 182 }; |
168 | 183 |
169 } // namespace compiler | 184 } // namespace compiler |
170 } // namespace internal | 185 } // namespace internal |
171 } // namespace v8 | 186 } // namespace v8 |
172 | 187 |
173 #endif // V8_COMPILER_GRAPH_REDUCER_H_ | 188 #endif // V8_COMPILER_GRAPH_REDUCER_H_ |
OLD | NEW |