Lines Matching refs:Node
24 // Each node has a mark which is a monotonically increasing integer, and a
25 // {NodeMarker} has a range of values that indicate states of a node.
30 // out-of-line data associated with each node.
34 // A Node is the basic primitive of graphs. Nodes are chained together by
42 // by the Node's id.
43 class V8_EXPORT_PRIVATE Node final {
45 static Node* New(Zone* zone, NodeId id, const Operator* op, int input_count,
46 Node* const* inputs, bool has_extensible_inputs);
47 static Node* Clone(Zone* zone, NodeId id, const Node* node);
71 V8_Fatal(__FILE__, __LINE__, "Node #%d:%s->InputAt(%d) out of bounds", \
83 Node* InputAt(int index) const {
88 void ReplaceInput(int index, Node* new_to) {
90 Node** input_ptr = GetInputPtr(index);
91 Node* old_to = *input_ptr;
102 void AppendInput(Zone* zone, Node* new_to);
103 void InsertInput(Zone* zone, int index, Node* new_to);
110 void ReplaceUses(Node* replace_to);
128 explicit UseEdges(Node* node) : node_(node) {}
131 Node* node_;
138 typedef Node* value_type;
146 explicit Uses(Node* node) : node_(node) {}
149 Node* node_;
154 // Returns true if {owner} is the user of {this} node.
155 bool OwnedBy(Node* owner) const {
159 // Returns true if {owner1} and {owner2} are the only users of {this} node.
160 bool OwnedBy(Node const* owner1, Node const* owner2) const;
163 // are the only users of {this} node.
172 Node* node_;
175 Node* inputs_[1];
178 void ExtractFrom(Use* use_ptr, Node** input_ptr, int count);
181 // A link in the use chain for a node. Every input {i} to a node {n} has an
182 // associated {Use} which is linked into the use chain of the {i} node.
190 Node** input_ptr() {
193 Node** inputs = is_inline_use()
194 ? reinterpret_cast<Node*>(start)->inputs_.inline_
199 Node* from() {
201 return is_inline_use() ? reinterpret_cast<Node*>(start)
215 // be able to map {Node} objects to {Use} objects and vice-versa in a
218 // {Use} links are laid out in memory directly before a {Node}, followed by
222 // |Use #N |Use #N-1|...|Use #1 |Use #0 |Node xxxx |I#0|I#1|...|I#N-1|I#N|
224 // + Use + Node + Input
227 // can compute the {Node}.
230 // |Node xxxx |
234 // v | node
240 // a node exceeds the maximum inline capacity.
242 Node(NodeId id, const Operator* op, int inline_count, int inline_capacity);
244 Node* const* GetInputPtrConst(int input_index) const {
248 Node** GetInputPtr(int input_index) {
294 Node* inline_[1];
302 DISALLOW_COPY_AND_ASSIGN(Node);
306 std::ostream& operator<<(std::ostream& os, const Node& n);
309 // Typedefs to shorten commonly used Node containers.
310 typedef ZoneDeque<Node*> NodeDeque;
311 typedef ZoneSet<Node*> NodeSet;
312 typedef ZoneVector<Node*> NodeVector;
318 static inline const T& OpParameter(const Node* node) {
319 return OpParameter<T>(node->op());
322 class Node::InputEdges final {
335 InputEdges(Node** input_root, Use* use_root, int count)
339 Node** input_root_;
344 class V8_EXPORT_PRIVATE Node::Inputs final {
346 typedef Node* value_type;
357 explicit Inputs(Node* const* input_root, int count)
361 Node* const* input_root_;
365 // An encapsulation for information associated with a single use of node as a
366 // input from another node, allowing access to both the defining node and
367 // the node having the input.
370 Node* from() const { return use_->from(); }
371 Node* to() const { return *input_ptr_; }
381 void UpdateTo(Node* new_to) {
382 Node* old_to = *input_ptr_;
391 friend class Node::UseEdges::iterator;
392 friend class Node::InputEdges;
393 friend class Node::InputEdges::iterator;
395 Edge(Node::Use* use, Node** input_ptr) : use_(use), input_ptr_(input_ptr) {
401 Node::Use* use_;
402 Node** input_ptr_;
405 bool Node::IsDead() const {
406 Node::Inputs inputs = this->inputs();
410 Node::InputEdges Node::input_edges() {
422 Node::Inputs Node::inputs() const {
431 // A forward iterator to visit the edges for the input dependencies of a node.
432 class Node::InputEdges::iterator final {
468 friend class Node;
470 explicit iterator(Use* use, Node** input_ptr)
474 Node** input_ptr_;
478 Node::InputEdges::iterator Node::InputEdges::begin() const {
479 return Node::InputEdges::iterator(use_root_, input_root_);
483 Node::InputEdges::iterator Node::InputEdges::end() const {
484 return Node::InputEdges::iterator(use_root_ - count_, input_root_ + count_);
487 Edge Node::InputEdges::operator[](int index) const {
491 // A forward iterator to visit the inputs of a node.
492 class Node::Inputs::const_iterator final {
496 typedef Node* value_type;
502 Node* operator*() const { return *input_ptr_; }
526 friend class Node::Inputs;
528 explicit const_iterator(Node* const* input_ptr) : input_ptr_(input_ptr) {}
530 Node* const* input_ptr_;
534 Node::Inputs::const_iterator Node::Inputs::begin() const {
539 Node::Inputs::const_iterator Node::Inputs::end() const {
543 Node* Node::Inputs::operator[](int index) const { return input_root_[index]; }
545 // A forward iterator to visit the uses edges of a node.
546 class Node::UseEdges::iterator final {
565 friend class Node::UseEdges;
568 explicit iterator(Node* node)
569 : current_(node->first_use_),
572 Node::Use* current_;
573 Node::Use* next_;
577 Node::UseEdges::iterator Node::UseEdges::begin() const {
578 return Node::UseEdges::iterator(this->node_);
582 Node::UseEdges::iterator Node::UseEdges::end() const {
583 return Node::UseEdges::iterator();
587 // A forward iterator to visit the uses of a node.
588 class Node::Uses::const_iterator final {
592 typedef Node* value_type;
593 typedef Node** pointer;
594 typedef Node*& reference;
598 Node* operator*() const { return current_->from(); }
613 friend class Node::Uses;
616 explicit const_iterator(Node* node) : current_(node->first_use_) {}
618 Node::Use* current_;
622 Node::Uses::const_iterator Node::Uses::begin() const {
627 Node::Uses::const_iterator Node::Uses::end() const { return const_iterator(); }