Commit bd3edf37 authored by Benedikt Meurer's avatar Benedikt Meurer

[turbofan] Inline hot functions for NodeMarkerBase.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1184693002.

Cr-Commit-Position: refs/heads/master@{#28983}
parent 068008e9
......@@ -5,7 +5,6 @@
#include "src/compiler/node-marker.h"
#include "src/compiler/graph.h"
#include "src/compiler/node.h"
namespace v8 {
namespace internal {
......@@ -18,24 +17,6 @@ NodeMarkerBase::NodeMarkerBase(Graph* graph, uint32_t num_states)
}
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_);
}
void NodeMarkerBase::Reset(Graph* graph) {
uint32_t const num_states = mark_max_ - mark_min_;
mark_min_ = graph->mark_max_;
......
......@@ -5,7 +5,7 @@
#ifndef V8_COMPILER_NODE_MARKER_H_
#define V8_COMPILER_NODE_MARKER_H_
#include "src/base/macros.h"
#include "src/compiler/node.h"
namespace v8 {
namespace internal {
......@@ -13,13 +13,6 @@ 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.
......@@ -27,8 +20,20 @@ class NodeMarkerBase {
public:
NodeMarkerBase(Graph* graph, uint32_t num_states);
Mark Get(Node* node);
void Set(Node* node, Mark mark);
V8_INLINE Mark 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_;
}
V8_INLINE void Set(Node* node, Mark mark) {
DCHECK_LT(mark, mark_max_ - mark_min_);
DCHECK_LT(node->mark(), mark_max_);
node->set_mark(mark + mark_min_);
}
void Reset(Graph* graph);
private:
......@@ -44,14 +49,14 @@ class NodeMarkerBase {
template <typename State>
class NodeMarker : public NodeMarkerBase {
public:
NodeMarker(Graph* graph, uint32_t num_states)
V8_INLINE NodeMarker(Graph* graph, uint32_t num_states)
: NodeMarkerBase(graph, num_states) {}
State Get(Node* node) {
V8_INLINE State Get(Node* node) {
return static_cast<State>(NodeMarkerBase::Get(node));
}
void Set(Node* node, State state) {
V8_INLINE void Set(Node* node, State state) {
NodeMarkerBase::Set(node, static_cast<Mark>(state));
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment