OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/compiler/node-marker.h" |
| 6 |
| 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/node.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 namespace compiler { |
| 13 |
| 14 NodeMarkerBase::NodeMarkerBase(Graph* graph, uint32_t num_states) |
| 15 : mark_min_(graph->mark_max_), mark_max_(graph->mark_max_ += num_states) { |
| 16 DCHECK(num_states > 0); // user error! |
| 17 DCHECK(mark_max_ > mark_min_); // check for wraparound. |
| 18 } |
| 19 |
| 20 |
| 21 Mark NodeMarkerBase::Get(Node* node) { |
| 22 Mark mark = node->mark(); |
| 23 if (mark < mark_min_) { |
| 24 mark = mark_min_; |
| 25 node->set_mark(mark_min_); |
| 26 } |
| 27 DCHECK_LT(mark, mark_max_); |
| 28 return mark - mark_min_; |
| 29 } |
| 30 |
| 31 |
| 32 void NodeMarkerBase::Set(Node* node, Mark mark) { |
| 33 DCHECK_LT(mark, mark_max_ - mark_min_); |
| 34 DCHECK_LT(node->mark(), mark_max_); |
| 35 node->set_mark(mark + mark_min_); |
| 36 } |
| 37 |
| 38 } // namespace compiler |
| 39 } // namespace internal |
| 40 } // namespace v8 |
OLD | NEW |