| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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_NODE_MARKER_H_ | 5 #ifndef V8_COMPILER_NODE_MARKER_H_ |
| 6 #define V8_COMPILER_NODE_MARKER_H_ | 6 #define V8_COMPILER_NODE_MARKER_H_ |
| 7 | 7 |
| 8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 node->set_mark(mark_min_); | 27 node->set_mark(mark_min_); |
| 28 } | 28 } |
| 29 DCHECK_LT(mark, mark_max_); | 29 DCHECK_LT(mark, mark_max_); |
| 30 return mark - mark_min_; | 30 return mark - mark_min_; |
| 31 } | 31 } |
| 32 V8_INLINE void Set(Node* node, Mark mark) { | 32 V8_INLINE void Set(Node* node, Mark mark) { |
| 33 DCHECK_LT(mark, mark_max_ - mark_min_); | 33 DCHECK_LT(mark, mark_max_ - mark_min_); |
| 34 DCHECK_LT(node->mark(), mark_max_); | 34 DCHECK_LT(node->mark(), mark_max_); |
| 35 node->set_mark(mark + mark_min_); | 35 node->set_mark(mark + mark_min_); |
| 36 } | 36 } |
| 37 void Reset(Graph* graph); | |
| 38 | 37 |
| 39 private: | 38 private: |
| 40 Mark mark_min_; | 39 Mark const mark_min_; |
| 41 Mark mark_max_; | 40 Mark const mark_max_; |
| 42 | 41 |
| 43 DISALLOW_COPY_AND_ASSIGN(NodeMarkerBase); | 42 DISALLOW_COPY_AND_ASSIGN(NodeMarkerBase); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 | 45 |
| 47 // A NodeMarker uses monotonically increasing marks to assign local "states" | 46 // A NodeMarker uses monotonically increasing marks to assign local "states" |
| 48 // to nodes. Only one NodeMarker per graph is valid at a given time. | 47 // to nodes. Only one NodeMarker per graph is valid at a given time. |
| 49 template <typename State> | 48 template <typename State> |
| 50 class NodeMarker : public NodeMarkerBase { | 49 class NodeMarker : public NodeMarkerBase { |
| 51 public: | 50 public: |
| 52 V8_INLINE NodeMarker(Graph* graph, uint32_t num_states) | 51 V8_INLINE NodeMarker(Graph* graph, uint32_t num_states) |
| 53 : NodeMarkerBase(graph, num_states) {} | 52 : NodeMarkerBase(graph, num_states) {} |
| 54 | 53 |
| 55 V8_INLINE State Get(Node* node) { | 54 V8_INLINE State Get(Node* node) { |
| 56 return static_cast<State>(NodeMarkerBase::Get(node)); | 55 return static_cast<State>(NodeMarkerBase::Get(node)); |
| 57 } | 56 } |
| 58 | 57 |
| 59 V8_INLINE void Set(Node* node, State state) { | 58 V8_INLINE void Set(Node* node, State state) { |
| 60 NodeMarkerBase::Set(node, static_cast<Mark>(state)); | 59 NodeMarkerBase::Set(node, static_cast<Mark>(state)); |
| 61 } | 60 } |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 } // namespace compiler | 63 } // namespace compiler |
| 65 } // namespace internal | 64 } // namespace internal |
| 66 } // namespace v8 | 65 } // namespace v8 |
| 67 | 66 |
| 68 #endif // V8_COMPILER_NODE_MARKER_H_ | 67 #endif // V8_COMPILER_NODE_MARKER_H_ |
| OLD | NEW |