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

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

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-marker.h ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-marker.cc
diff --git a/src/compiler/node-marker.cc b/src/compiler/node-marker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4bf12f9751b62f89cbc65d6f585690a26a5f94b9
--- /dev/null
+++ b/src/compiler/node-marker.cc
@@ -0,0 +1,40 @@
+// 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.
+
+#include "src/compiler/node-marker.h"
+
+#include "src/compiler/graph.h"
+#include "src/compiler/node.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+NodeMarkerBase::NodeMarkerBase(Graph* graph, uint32_t num_states)
+ : mark_min_(graph->mark_max_), mark_max_(graph->mark_max_ += num_states) {
+ DCHECK(num_states > 0); // user error!
+ DCHECK(mark_max_ > mark_min_); // check for wraparound.
+}
+
+
+Mark NodeMarkerBase::Get(Node* node) {
+ Mark mark = node->mark();
+ if (mark < mark_min_) {
+ mark = mark_min_;
+ node->set_mark(mark_min_);
+ }
+ DCHECK_LT(mark, mark_max_);
+ return mark - mark_min_;
+}
+
+
+void NodeMarkerBase::Set(Node* node, Mark mark) {
+ DCHECK_LT(mark, mark_max_ - mark_min_);
+ DCHECK_LT(node->mark(), mark_max_);
+ node->set_mark(mark + mark_min_);
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/compiler/node-marker.h ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698