5#ifndef V8_COMPILER_NODE_H_
6#define V8_COMPILER_NODE_H_
44 Node*
const* inputs,
bool has_extensible_inputs);
47 inline bool IsDead()
const;
53 DCHECK_GE(IrOpcode::kLast, op_->opcode());
60 return has_inline_inputs() ? InlineCountField::decode(
bit_field_)
61 : outline_inputs()->count_;
73 return *GetInputPtrConst(index);
80 Node* old_to = *input_ptr;
81 if (old_to != new_to) {
82 Use* use = GetUsePtr(index);
89 void AppendInput(
Zone* zone,
Node* new_to);
90 void InsertInput(
Zone* zone,
int index,
Node* new_to);
91 void InsertInputs(
Zone* zone,
int index,
int count);
93 Node* RemoveInput(
int index);
95 void TrimInputCount(
int new_input_count);
97 void EnsureInputCount(
Zone* zone,
int new_input_count);
100 int BranchUseCount()
const;
101 void ReplaceUses(
Node* replace_to);
104 inline InputEdges input_edges();
107 inline Inputs inputs()
const;
147 bool OwnedBy(
Node const* owner)
const;
150 bool OwnedBy(
Node const* owner1,
Node const* owner2)
const;
153 void Print(
int depth)
const;
154 void Print(std::ostream&,
int depth = 1)
const;
157 template <
typename NodePtrT>
159 int input_count, NodePtrT
const* inputs,
160 bool has_extensible_inputs);
190 int index = input_index();
193 is_inline_use() ?
reinterpret_cast<Node*
>(
start)->inline_inputs()
195 return &inputs[
index];
199 Use*
start =
this + 1 + input_index();
200 return is_inline_use() ?
reinterpret_cast<Node*
>(
start)
243 inline Address inputs_location()
const;
246 return reinterpret_cast<ZoneNodePtr*
>(inputs_location());
256 return has_inline_inputs() ? &(inline_inputs()[input_index])
257 : &(outline_inputs()->inputs()[input_index]);
260 return has_inline_inputs() ? &(inline_inputs()[input_index])
261 : &(outline_inputs()->inputs()[input_index]);
264 Use* ptr = has_inline_inputs() ?
reinterpret_cast<Use*
>(
this)
265 :
reinterpret_cast<Use*
>(outline_inputs());
266 return &ptr[-1 - input_index];
269 void AppendUse(Use* use);
270 void RemoveUse(Use* use);
272 void*
operator new(
size_t,
void* location) {
return location; }
286 return InlineCountField::decode(
bit_field_) != kOutlineMarker;
294 static const int kOutlineMarker = InlineCountField::kMax;
295 static const int kMaxInlineCapacity = InlineCapacityField::kMax - 1;
309 return reinterpret_cast<Address>(
this) +
sizeof(
Node);
343 SLOW_DCHECK(node ==
nullptr || node->op()->opcode() == IrOpcode::kEnd ||
344 node->op()->EffectOutputCount() > 0);
349 DCHECK_GT(value->op()->EffectOutputCount(), 0);
359 SLOW_DCHECK(node ==
nullptr || node->opcode() == IrOpcode::kEnd ||
360 node->op()->ControlOutputCount() > 0);
365 DCHECK_GT(value->op()->ControlOutputCount(), 0);
388 inline value_type operator[](
int index)
const;
391 : input_root_(input_root), use_root_(use_root),
count_(
count) {}
410 inline value_type operator[](
int index)
const;
428 int const index = use_->input_index();
429 DCHECK_LT(index, use_->from()->InputCount());
437 Node* old_to = *input_ptr_;
438 if (old_to != new_to) {
440 *input_ptr_ = new_to;
451 : use_(use), input_ptr_(input_ptr) {
511 return input_ptr_ == other.input_ptr_;
529 return input_ptr_ - other.input_ptr_;
536 : use_(use), input_ptr_(input_ptr) {}
553 return Edge(use_root_ + index, input_root_ + index);
569 return input_ptr_ == other.input_ptr_;
572 return !(*
this == other);
587 return input_ptr_ - other.input_ptr_;
594 : input_ptr_(input_ptr) {}
#define SLOW_DCHECK(condition)
static constexpr T decode(U value)
Node * operator=(Node *value)
constexpr Control(Node *node)
bool operator==(const Edge &other)
bool operator!=(const Edge &other)
Edge(Node::Use *use, ZoneNodePtr *input_ptr)
void UpdateTo(Node *new_to)
Node * operator=(Node *value)
constexpr Effect(Node *node)
void set_node(Node *node)
Node * operator->() const
constexpr NodeWrapper(Node *node)
bool operator==(const iterator &other) const
iterator(const iterator &other)=default
bool operator!=(const iterator &other) const
bool operator==(const const_iterator &other) const
std::forward_iterator_tag iterator_category
const_iterator(Node *node)
const_iterator & operator++()
bool operator!=(const const_iterator &other) const
const_iterator begin() const
const_iterator end() const
base::Vector< Node * > inputs_vector() const
ZoneNodePtr * GetInputPtr(int input_index)
GraphZoneTraits::Ptr< OutOfLineInputs > ZoneOutOfLineInputsPtr
GraphZoneTraits::Ptr< Use > ZoneUsePtr
bool has_inline_inputs() const
constexpr IrOpcode::Value opcode() const
ZoneNodePtr * inline_inputs() const
Address inputs_location() const
Use * GetUsePtr(int input_index)
ZoneNodePtr const * GetInputPtrConst(int input_index) const
OutOfLineInputs * outline_inputs() const
Node & operator=(const Node &)=delete
void set_op(const Operator *op)
const Operator * op() const
void set_outline_inputs(OutOfLineInputs *outline)
void ReplaceInput(int index, Node *new_to)
Node * InputAt(int index) const
Node(const Node &)=delete
static const int kOutlineMarker
constexpr Vector< T > VectorOf(T *start, size_t size)
GraphZoneTraits::Ptr< Node > ZoneNodePtr
std::ostream & operator<<(std::ostream &os, AccessMode access_mode)
Node::Uses::const_iterator begin(const Node::Uses &uses)
V8_INLINE Builtin operator++(Builtin &builtin)
#define DCHECK_LE(v1, v2)
#define DCHECK_NOT_NULL(val)
#define DCHECK_GE(v1, v2)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
#define V8_EXPORT_PRIVATE
ZoneNodePtr * input_ptr()
bool is_inline_use() const
std::unique_ptr< ValueMirror > value