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

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

Issue 768763002: [turbofan] Add TraversalState and GraphTraversal and use them in GraphReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: base embedded. Created 6 years 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.cc ('k') | src/compiler/graph-reducer.cc » ('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/compiler/graph.h"
8 #include "src/zone-containers.h" 9 #include "src/zone-containers.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 namespace compiler { 13 namespace compiler {
13 14
14 // Forward declarations.
15 class Graph;
16 class Node;
17
18
19 // Represents the result of trying to reduce a node in the graph. 15 // Represents the result of trying to reduce a node in the graph.
20 class Reduction FINAL { 16 class Reduction FINAL {
21 public: 17 public:
22 explicit Reduction(Node* replacement = NULL) : replacement_(replacement) {} 18 explicit Reduction(Node* replacement = NULL) : replacement_(replacement) {}
23 19
24 Node* replacement() const { return replacement_; } 20 Node* replacement() const { return replacement_; }
25 bool Changed() const { return replacement() != NULL; } 21 bool Changed() const { return replacement() != NULL; }
26 22
27 private: 23 private:
28 Node* replacement_; 24 Node* replacement_;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 int input_index; 69 int input_index;
74 }; 70 };
75 71
76 // Reduce a single node. 72 // Reduce a single node.
77 Reduction Reduce(Node* const); 73 Reduction Reduce(Node* const);
78 // Reduce the node on top of the stack. 74 // Reduce the node on top of the stack.
79 void ReduceTop(); 75 void ReduceTop();
80 76
81 // Node stack operations. 77 // Node stack operations.
82 void Pop(); 78 void Pop();
83 void Push(Node* const); 79 void Push(Node* node);
84 80
85 // Revisit queue operations. 81 // Revisit queue operations.
86 bool Recurse(Node* const); 82 bool Recurse(Node* node);
87 void Revisit(Node* const); 83 void Revisit(Node* node);
88 84
89 Graph* graph_; 85 Graph* graph_;
86 NodeMarker<State> state_;
90 ZoneVector<Reducer*> reducers_; 87 ZoneVector<Reducer*> reducers_;
91 ZoneStack<Node*> revisit_; 88 ZoneStack<Node*> revisit_;
92 ZoneStack<NodeState> stack_; 89 ZoneStack<NodeState> stack_;
93 ZoneDeque<State> state_;
94 90
95 DISALLOW_COPY_AND_ASSIGN(GraphReducer); 91 DISALLOW_COPY_AND_ASSIGN(GraphReducer);
96 }; 92 };
97 93
98 } // namespace compiler 94 } // namespace compiler
99 } // namespace internal 95 } // namespace internal
100 } // namespace v8 96 } // namespace v8
101 97
102 #endif // V8_COMPILER_GRAPH_REDUCER_H_ 98 #endif // V8_COMPILER_GRAPH_REDUCER_H_
OLDNEW
« no previous file with comments | « src/compiler/graph.cc ('k') | src/compiler/graph-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698