| 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/compiler/types.h" | 10 #include "src/compiler/types.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 bool operator==(const iterator& other) const { | 403 bool operator==(const iterator& other) const { |
| 404 return input_ptr_ == other.input_ptr_; | 404 return input_ptr_ == other.input_ptr_; |
| 405 } | 405 } |
| 406 bool operator!=(const iterator& other) const { return !(*this == other); } | 406 bool operator!=(const iterator& other) const { return !(*this == other); } |
| 407 iterator& operator++() { | 407 iterator& operator++() { |
| 408 input_ptr_++; | 408 input_ptr_++; |
| 409 use_--; | 409 use_--; |
| 410 return *this; | 410 return *this; |
| 411 } | 411 } |
| 412 iterator operator++(int); | 412 iterator operator++(int); |
| 413 iterator& operator+=(difference_type offset) { |
| 414 input_ptr_ += offset; |
| 415 use_ -= offset; |
| 416 return *this; |
| 417 } |
| 418 iterator operator+(difference_type offset) const { |
| 419 return iterator(use_ - offset, input_ptr_ + offset); |
| 420 } |
| 421 difference_type operator-(const iterator& other) const { |
| 422 return static_cast<difference_type>(input_ptr_ - other.input_ptr_); |
| 423 } |
| 413 | 424 |
| 414 private: | 425 private: |
| 415 friend class Node; | 426 friend class Node; |
| 416 | 427 |
| 417 explicit iterator(Node* from, int index = 0) | 428 explicit iterator(Node* from, int index = 0) |
| 418 : use_(from->GetUsePtr(index)), input_ptr_(from->GetInputPtr(index)) {} | 429 : use_(from->GetUsePtr(index)), input_ptr_(from->GetInputPtr(index)) {} |
| 419 | 430 |
| 431 explicit iterator(Use* use, Node** input_ptr) |
| 432 : use_(use), input_ptr_(input_ptr) {} |
| 433 |
| 420 Use* use_; | 434 Use* use_; |
| 421 Node** input_ptr_; | 435 Node** input_ptr_; |
| 422 }; | 436 }; |
| 423 | 437 |
| 424 | 438 |
| 425 Node::InputEdges::iterator Node::InputEdges::begin() const { | 439 Node::InputEdges::iterator Node::InputEdges::begin() const { |
| 426 return Node::InputEdges::iterator(this->node_, 0); | 440 return Node::InputEdges::iterator(this->node_, 0); |
| 427 } | 441 } |
| 428 | 442 |
| 429 | 443 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 448 return iter_ == other.iter_; | 462 return iter_ == other.iter_; |
| 449 } | 463 } |
| 450 bool operator!=(const const_iterator& other) const { | 464 bool operator!=(const const_iterator& other) const { |
| 451 return !(*this == other); | 465 return !(*this == other); |
| 452 } | 466 } |
| 453 const_iterator& operator++() { | 467 const_iterator& operator++() { |
| 454 ++iter_; | 468 ++iter_; |
| 455 return *this; | 469 return *this; |
| 456 } | 470 } |
| 457 const_iterator operator++(int); | 471 const_iterator operator++(int); |
| 472 const_iterator& operator+=(difference_type offset) { |
| 473 iter_ += offset; |
| 474 return *this; |
| 475 } |
| 476 const_iterator operator+(difference_type offset) const { |
| 477 return const_iterator(iter_ + offset); |
| 478 } |
| 479 difference_type operator-(const const_iterator& other) const { |
| 480 return iter_ - other.iter_; |
| 481 } |
| 458 | 482 |
| 459 private: | 483 private: |
| 460 friend class Node::Inputs; | 484 friend class Node::Inputs; |
| 461 | 485 |
| 462 const_iterator(Node* node, int index) : iter_(node, index) {} | 486 const_iterator(Node* node, int index) : iter_(node, index) {} |
| 463 | 487 |
| 488 explicit const_iterator(Node::InputEdges::iterator iter) : iter_(iter) {} |
| 489 |
| 464 Node::InputEdges::iterator iter_; | 490 Node::InputEdges::iterator iter_; |
| 465 }; | 491 }; |
| 466 | 492 |
| 467 | 493 |
| 468 Node::Inputs::const_iterator Node::Inputs::begin() const { | 494 Node::Inputs::const_iterator Node::Inputs::begin() const { |
| 469 return const_iterator(this->node_, 0); | 495 return const_iterator(this->node_, 0); |
| 470 } | 496 } |
| 471 | 497 |
| 472 | 498 |
| 473 Node::Inputs::const_iterator Node::Inputs::end() const { | 499 Node::Inputs::const_iterator Node::Inputs::end() const { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 } | 583 } |
| 558 | 584 |
| 559 | 585 |
| 560 Node::Uses::const_iterator Node::Uses::end() const { return const_iterator(); } | 586 Node::Uses::const_iterator Node::Uses::end() const { return const_iterator(); } |
| 561 | 587 |
| 562 } // namespace compiler | 588 } // namespace compiler |
| 563 } // namespace internal | 589 } // namespace internal |
| 564 } // namespace v8 | 590 } // namespace v8 |
| 565 | 591 |
| 566 #endif // V8_COMPILER_NODE_H_ | 592 #endif // V8_COMPILER_NODE_H_ |
| OLD | NEW |