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

Unified Diff: src/compiler/node.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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node.h
diff --git a/src/compiler/node.h b/src/compiler/node.h
index 8a442cedbc7aed407eda1e7f88d6388df58cdba3..93dc78a9073089cf8e9b0d705f99fb980c0763e7 100644
--- a/src/compiler/node.h
+++ b/src/compiler/node.h
@@ -21,6 +21,11 @@ namespace v8 {
namespace internal {
namespace compiler {
+// Marks are used during traversal of the graph to distinguish states of nodes.
+// Each node has a mark which is a monotonically increasing integer, and a
+// {NodeMarker} has a range of values that indicate states of a node.
+typedef uint32_t Mark;
+
class NodeData {
public:
const Operator* op() const { return op_; }
@@ -34,11 +39,19 @@ class NodeData {
protected:
const Operator* op_;
Bounds bounds_;
+ Mark mark_;
explicit NodeData(Zone* zone) {}
friend class NodeProperties;
+ template <typename State>
+ friend class NodeMarker;
+
Bounds bounds() { return bounds_; }
void set_bounds(Bounds b) { bounds_ = b; }
+
+ // Only NodeMarkers should manipulate the marks on nodes.
+ Mark mark() { return mark_; }
+ void set_mark(Mark mark) { mark_ = mark; }
};
// A Node is the basic primitive of an IR graph. In addition to the members
@@ -51,7 +64,10 @@ class Node FINAL : public GenericNode<NodeData, Node> {
Node(GenericGraphBase* graph, int input_count, int reserve_input_count)
: GenericNode<NodeData, Node>(graph, input_count, reserve_input_count) {}
- void Initialize(const Operator* op) { set_op(op); }
+ void Initialize(const Operator* op) {
+ set_op(op);
+ set_mark(0);
+ }
bool IsDead() const { return InputCount() > 0 && InputAt(0) == NULL; }
void Kill();
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698