OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef V8_COMPILER_NODE_H_ |
6 #define V8_COMPILER_NODE_H_ | 6 #define V8_COMPILER_NODE_H_ |
7 | 7 |
8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "src/types-inl.h" | 10 #include "src/types-inl.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 Node::Inputs::const_iterator Node::Inputs::begin() const { | 379 Node::Inputs::const_iterator Node::Inputs::begin() const { |
380 return const_iterator(this->node_, 0); | 380 return const_iterator(this->node_, 0); |
381 } | 381 } |
382 | 382 |
383 | 383 |
384 Node::Inputs::const_iterator Node::Inputs::end() const { | 384 Node::Inputs::const_iterator Node::Inputs::end() const { |
385 return const_iterator(this->node_, this->node_->InputCount()); | 385 return const_iterator(this->node_, this->node_->InputCount()); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 // A forward iterator to visit the uses edges of a node. The edges are returned | 389 // A forward iterator to visit the uses edges of a node. |
390 // in | |
391 // the order in which they were added as inputs. | |
392 class Node::UseEdges::iterator final { | 390 class Node::UseEdges::iterator final { |
393 public: | 391 public: |
394 iterator(const iterator& other) | 392 iterator(const iterator& other) |
395 : current_(other.current_), next_(other.next_) {} | 393 : current_(other.current_), next_(other.next_) {} |
396 | 394 |
397 Edge operator*() const { | 395 Edge operator*() const { |
398 return Edge(current_->from->GetInputRecordPtr(current_->input_index)); | 396 return Edge(current_->from->GetInputRecordPtr(current_->input_index)); |
399 } | 397 } |
400 | 398 |
401 bool operator==(const iterator& other) const { | 399 bool operator==(const iterator& other) const { |
(...skipping 24 matching lines...) Expand all Loading... |
426 Node::UseEdges::iterator Node::UseEdges::begin() const { | 424 Node::UseEdges::iterator Node::UseEdges::begin() const { |
427 return Node::UseEdges::iterator(this->node_); | 425 return Node::UseEdges::iterator(this->node_); |
428 } | 426 } |
429 | 427 |
430 | 428 |
431 Node::UseEdges::iterator Node::UseEdges::end() const { | 429 Node::UseEdges::iterator Node::UseEdges::end() const { |
432 return Node::UseEdges::iterator(); | 430 return Node::UseEdges::iterator(); |
433 } | 431 } |
434 | 432 |
435 | 433 |
436 // A forward iterator to visit the uses of a node. The uses are returned in | 434 // A forward iterator to visit the uses of a node. |
437 // the order in which they were added as inputs. | |
438 class Node::Uses::const_iterator final { | 435 class Node::Uses::const_iterator final { |
439 public: | 436 public: |
440 typedef std::forward_iterator_tag iterator_category; | 437 typedef std::forward_iterator_tag iterator_category; |
441 typedef int difference_type; | 438 typedef int difference_type; |
442 typedef Node* value_type; | 439 typedef Node* value_type; |
443 typedef Node** pointer; | 440 typedef Node** pointer; |
444 typedef Node*& reference; | 441 typedef Node*& reference; |
445 | 442 |
446 const_iterator(const const_iterator& other) : current_(other.current_) {} | 443 const_iterator(const const_iterator& other) : current_(other.current_) {} |
447 | 444 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 476 |
480 void Node::ReplaceInput(int index, Node* new_to) { | 477 void Node::ReplaceInput(int index, Node* new_to) { |
481 GetInputRecordPtr(index)->Update(new_to); | 478 GetInputRecordPtr(index)->Update(new_to); |
482 } | 479 } |
483 | 480 |
484 } // namespace compiler | 481 } // namespace compiler |
485 } // namespace internal | 482 } // namespace internal |
486 } // namespace v8 | 483 } // namespace v8 |
487 | 484 |
488 #endif // V8_COMPILER_NODE_H_ | 485 #endif // V8_COMPILER_NODE_H_ |
OLD | NEW |