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

Unified Diff: src/compiler/node-marker.h

Issue 838783002: [turbofan] Cleanup Graph and related classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Parameter pack causes compile errors. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/node.cc ('k') | src/compiler/node-marker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-marker.h
diff --git a/src/compiler/node-marker.h b/src/compiler/node-marker.h
new file mode 100644
index 0000000000000000000000000000000000000000..837c92cfc27557ee7262b38ff7adcc140fbb6b81
--- /dev/null
+++ b/src/compiler/node-marker.h
@@ -0,0 +1,62 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_COMPILER_NODE_MARKER_H_
+#define V8_COMPILER_NODE_MARKER_H_
+
+#include "src/base/macros.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+// Forward declarations.
+class Graph;
+class Node;
+
+
+// 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;
+
+
+// Base class for templatized NodeMarkers.
+class NodeMarkerBase {
+ public:
+ NodeMarkerBase(Graph* graph, uint32_t num_states);
+
+ Mark Get(Node* node);
+ void Set(Node* node, Mark mark);
+
+ private:
+ Mark mark_min_;
+ Mark mark_max_;
+
+ DISALLOW_COPY_AND_ASSIGN(NodeMarkerBase);
+};
+
+
+// A NodeMarker uses monotonically increasing marks to assign local "states"
+// to nodes. Only one NodeMarker per graph is valid at a given time.
+template <typename State>
+class NodeMarker : public NodeMarkerBase {
+ public:
+ NodeMarker(Graph* graph, uint32_t num_states)
+ : NodeMarkerBase(graph, num_states) {}
+
+ State Get(Node* node) {
+ return static_cast<State>(NodeMarkerBase::Get(node));
+ }
+
+ void Set(Node* node, State state) {
+ NodeMarkerBase::Set(node, static_cast<Mark>(state));
+ }
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_NODE_MARKER_H_
« no previous file with comments | « src/compiler/node.cc ('k') | src/compiler/node-marker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698