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

Side by Side Diff: src/compiler/graph-reducer.h

Issue 2416243002: Make unittests work in component build (Closed)
Patch Set: updates Created 4 years, 2 months 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
« no previous file with comments | « src/compiler/graph.h ('k') | src/compiler/graph-trimmer.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 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/base/compiler-specific.h"
8 #include "src/compiler/node-marker.h" 9 #include "src/compiler/node-marker.h"
10 #include "src/globals.h"
9 #include "src/zone/zone-containers.h" 11 #include "src/zone/zone-containers.h"
10 12
11 namespace v8 { 13 namespace v8 {
12 namespace internal { 14 namespace internal {
13 namespace compiler { 15 namespace compiler {
14 16
15 // Forward declarations. 17 // Forward declarations.
16 class Graph; 18 class Graph;
17 class Node; 19 class Node;
18 20
(...skipping 14 matching lines...) Expand all
33 private: 35 private:
34 Node* replacement_; 36 Node* replacement_;
35 }; 37 };
36 38
37 39
38 // A reducer can reduce or simplify a given node based on its operator and 40 // A reducer can reduce or simplify a given node based on its operator and
39 // inputs. This class functions as an extension point for the graph reducer for 41 // inputs. This class functions as an extension point for the graph reducer for
40 // language-specific reductions (e.g. reduction based on types or constant 42 // language-specific reductions (e.g. reduction based on types or constant
41 // folding of low-level operators) can be integrated into the graph reduction 43 // folding of low-level operators) can be integrated into the graph reduction
42 // phase. 44 // phase.
43 class Reducer { 45 class V8_EXPORT_PRIVATE Reducer {
44 public: 46 public:
45 virtual ~Reducer() {} 47 virtual ~Reducer() {}
46 48
47 // Try to reduce a node if possible. 49 // Try to reduce a node if possible.
48 virtual Reduction Reduce(Node* node) = 0; 50 virtual Reduction Reduce(Node* node) = 0;
49 51
50 // Invoked by the {GraphReducer} when all nodes are done. Can be used to 52 // Invoked by the {GraphReducer} when all nodes are done. Can be used to
51 // do additional reductions at the end, which in turn can cause a new round 53 // do additional reductions at the end, which in turn can cause a new round
52 // of reductions. 54 // of reductions.
53 virtual void Finalize(); 55 virtual void Finalize();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void RelaxControls(Node* node) { 114 void RelaxControls(Node* node) {
113 ReplaceWithValue(node, node, node, nullptr); 115 ReplaceWithValue(node, node, node, nullptr);
114 } 116 }
115 117
116 private: 118 private:
117 Editor* const editor_; 119 Editor* const editor_;
118 }; 120 };
119 121
120 122
121 // Performs an iterative reduction of a node graph. 123 // Performs an iterative reduction of a node graph.
122 class GraphReducer : public AdvancedReducer::Editor { 124 class V8_EXPORT_PRIVATE GraphReducer
125 : public NON_EXPORTED_BASE(AdvancedReducer::Editor) {
123 public: 126 public:
124 GraphReducer(Zone* zone, Graph* graph, Node* dead = nullptr); 127 GraphReducer(Zone* zone, Graph* graph, Node* dead = nullptr);
125 ~GraphReducer(); 128 ~GraphReducer();
126 129
127 Graph* graph() const { return graph_; } 130 Graph* graph() const { return graph_; }
128 131
129 void AddReducer(Reducer* reducer); 132 void AddReducer(Reducer* reducer);
130 133
131 // Reduce a single node. 134 // Reduce a single node.
132 void ReduceNode(Node* const); 135 void ReduceNode(Node* const);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ZoneStack<NodeState> stack_; 178 ZoneStack<NodeState> stack_;
176 179
177 DISALLOW_COPY_AND_ASSIGN(GraphReducer); 180 DISALLOW_COPY_AND_ASSIGN(GraphReducer);
178 }; 181 };
179 182
180 } // namespace compiler 183 } // namespace compiler
181 } // namespace internal 184 } // namespace internal
182 } // namespace v8 185 } // namespace v8
183 186
184 #endif // V8_COMPILER_GRAPH_REDUCER_H_ 187 #endif // V8_COMPILER_GRAPH_REDUCER_H_
OLDNEW
« no previous file with comments | « src/compiler/graph.h ('k') | src/compiler/graph-trimmer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698