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 FATAL("Node #%d:%s->InputAt(%d) out of bounds", id(), op()->mnemonic(), \
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;
169 Node* node_;
172 Node* inputs_[1];
175 void ExtractFrom(Use* use_ptr, Node** input_ptr, int count);
178 // A link in the use chain for a node. Every input {i} to a node {n} has an
179 // associated {Use} which is linked into the use chain of the {i} node.
187 Node** input_ptr() {
190 Node** inputs = is_inline_use()
191 ? reinterpret_cast<Node*>(start)->inputs_.inline_
196 Node* from() {
198 return is_inline_use() ? reinterpret_cast<Node*>(start)
212 // be able to map {Node} objects to {Use} objects and vice-versa in a
215 // {Use} links are laid out in memory directly before a {Node}, followed by
219 // |Use #N |Use #N-1|...|Use #1 |Use #0 |Node xxxx |I#0|I#1|...|I#N-1|I#N|
221 // + Use + Node + Input
224 // can compute the {Node}.
227 // |Node xxxx |
231 // v | node
237 // a node exceeds the maximum inline capacity.
239 Node(NodeId id, const Operator* op, int inline_count, int inline_capacity);
241 Node* const* GetInputPtrConst(int input_index) const {
245 Node** GetInputPtr(int input_index) {
291 Node* inline_[1];
299 DISALLOW_COPY_AND_ASSIGN(Node);
303 std::ostream& operator<<(std::ostream& os, const Node& n);
306 // Typedefs to shorten commonly used Node containers.
307 typedef ZoneDeque<Node*> NodeDeque;
308 typedef ZoneSet<Node*> NodeSet;
309 typedef ZoneVector<Node*> NodeVector;
313 class Node::InputEdges final {
326 InputEdges(Node** input_root, Use* use_root, int count)
330 Node** input_root_;
335 class V8_EXPORT_PRIVATE Node::Inputs final {
337 typedef Node* value_type;
348 explicit Inputs(Node* const* input_root, int count)
352 Node* const* input_root_;
356 // An encapsulation for information associated with a single use of node as a
357 // input from another node, allowing access to both the defining node and
358 // the node having the input.
361 Node* from() const { return use_->from(); }
362 Node* to() const { return *input_ptr_; }
372 void UpdateTo(Node* new_to) {
373 Node* old_to = *input_ptr_;
382 friend class Node::UseEdges::iterator;
383 friend class Node::InputEdges;
384 friend class Node::InputEdges::iterator;
386 Edge(Node::Use* use, Node** input_ptr) : use_(use), input_ptr_(input_ptr) {
392 Node::Use* use_;
393 Node** input_ptr_;
396 bool Node::IsDead() const {
397 Node::Inputs inputs = this->inputs();
401 Node::InputEdges Node::input_edges() {
413 Node::Inputs Node::inputs() const {
422 // A forward iterator to visit the edges for the input dependencies of a node.
423 class Node::InputEdges::iterator final {
459 friend class Node;
461 explicit iterator(Use* use, Node** input_ptr)
465 Node** input_ptr_;
469 Node::InputEdges::iterator Node::InputEdges::begin() const {
470 return Node::InputEdges::iterator(use_root_, input_root_);
474 Node::InputEdges::iterator Node::InputEdges::end() const {
475 return Node::InputEdges::iterator(use_root_ - count_, input_root_ + count_);
478 Edge Node::InputEdges::operator[](int index) const {
482 // A forward iterator to visit the inputs of a node.
483 class Node::Inputs::const_iterator final {
487 typedef Node* value_type;
493 Node* operator*() const { return *input_ptr_; }
517 friend class Node::Inputs;
519 explicit const_iterator(Node* const* input_ptr) : input_ptr_(input_ptr) {}
521 Node* const* input_ptr_;
525 Node::Inputs::const_iterator Node::Inputs::begin() const {
530 Node::Inputs::const_iterator Node::Inputs::end() const {
534 Node* Node::Inputs::operator[](int index) const { return input_root_[index]; }
536 // A forward iterator to visit the uses edges of a node.
537 class Node::UseEdges::iterator final {
556 friend class Node::UseEdges;
559 explicit iterator(Node* node)
560 : current_(node->first_use_),
563 Node::Use* current_;
564 Node::Use* next_;
568 Node::UseEdges::iterator Node::UseEdges::begin() const {
569 return Node::UseEdges::iterator(this->node_);
573 Node::UseEdges::iterator Node::UseEdges::end() const {
574 return Node::UseEdges::iterator();
578 // A forward iterator to visit the uses of a node.
579 class Node::Uses::const_iterator final {
583 typedef Node* value_type;
584 typedef Node** pointer;
585 typedef Node*& reference;
596 Node* operator*() const { return current_->from(); }
617 friend class Node::Uses;
620 explicit const_iterator(Node* node)
621 : current_(node->first_use_)
629 Node::Use* current_;
631 Node::Use* next_;
636 Node::Uses::const_iterator Node::Uses::begin() const {
641 Node::Uses::const_iterator Node::Uses::end() const { return const_iterator(); }