| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 class Editor { | 67 class Editor { |
| 68 public: | 68 public: |
| 69 virtual ~Editor() {} | 69 virtual ~Editor() {} |
| 70 | 70 |
| 71 // Replace {node} with {replacement}. | 71 // Replace {node} with {replacement}. |
| 72 virtual void Replace(Node* node, Node* replacement) = 0; | 72 virtual void Replace(Node* node, Node* replacement) = 0; |
| 73 // Revisit the {node} again later. | 73 // Revisit the {node} again later. |
| 74 virtual void Revisit(Node* node) = 0; | 74 virtual void Revisit(Node* node) = 0; |
| 75 // Replace value uses of {node} with {value} and effect uses of {node} with | 75 // Replace value uses of {node} with {value} and effect uses of {node} with |
| 76 // {effect}. If {effect == nullptr}, then use the effect input to {node}. | 76 // {effect}. If {effect == nullptr}, then use the effect input to {node}. |
| 77 // All | 77 // All control uses will be relaxed assuming {node} cannot throw. |
| 78 // control uses will be relaxed assuming {node} cannot throw. | |
| 79 virtual void ReplaceWithValue(Node* node, Node* value, Node* effect, | 78 virtual void ReplaceWithValue(Node* node, Node* value, Node* effect, |
| 80 Node* control) = 0; | 79 Node* control) = 0; |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 explicit AdvancedReducer(Editor* editor) : editor_(editor) {} | 82 explicit AdvancedReducer(Editor* editor) : editor_(editor) {} |
| 84 | 83 |
| 85 protected: | 84 protected: |
| 86 // Helper functions for subclasses to produce reductions for a node. | 85 // Helper functions for subclasses to produce reductions for a node. |
| 87 static Reduction Replace(Node* node) { return Reducer::Replace(node); } | 86 static Reduction Replace(Node* node) { return Reducer::Replace(node); } |
| 88 | 87 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ZoneStack<NodeState> stack_; | 175 ZoneStack<NodeState> stack_; |
| 177 | 176 |
| 178 DISALLOW_COPY_AND_ASSIGN(GraphReducer); | 177 DISALLOW_COPY_AND_ASSIGN(GraphReducer); |
| 179 }; | 178 }; |
| 180 | 179 |
| 181 } // namespace compiler | 180 } // namespace compiler |
| 182 } // namespace internal | 181 } // namespace internal |
| 183 } // namespace v8 | 182 } // namespace v8 |
| 184 | 183 |
| 185 #endif // V8_COMPILER_GRAPH_REDUCER_H_ | 184 #endif // V8_COMPILER_GRAPH_REDUCER_H_ |
| OLD | NEW |