| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 bool operator==(const Edge& other) { return input_ == other.input_; } | 276 bool operator==(const Edge& other) { return input_ == other.input_; } |
| 277 bool operator!=(const Edge& other) { return !(*this == other); } | 277 bool operator!=(const Edge& other) { return !(*this == other); } |
| 278 | 278 |
| 279 void UpdateTo(Node* new_to) { input_->Update(new_to); } | 279 void UpdateTo(Node* new_to) { input_->Update(new_to); } |
| 280 | 280 |
| 281 private: | 281 private: |
| 282 friend class Node::UseEdges::iterator; | 282 friend class Node::UseEdges::iterator; |
| 283 friend class Node::InputEdges::iterator; | 283 friend class Node::InputEdges::iterator; |
| 284 | 284 |
| 285 explicit Edge(Node::Input* input) : input_(input) { DCHECK_NOT_NULL(input); } | 285 explicit Edge(Node::Input* input) : input_(input) { DCHECK(input); } |
| 286 | 286 |
| 287 Node::Input* input_; | 287 Node::Input* input_; |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 | 290 |
| 291 // A forward iterator to visit the edges for the input dependencies of a node. | 291 // A forward iterator to visit the edges for the input dependencies of a node. |
| 292 class Node::InputEdges::iterator FINAL { | 292 class Node::InputEdges::iterator FINAL { |
| 293 public: | 293 public: |
| 294 typedef std::forward_iterator_tag iterator_category; | 294 typedef std::forward_iterator_tag iterator_category; |
| 295 typedef int difference_type; | 295 typedef int difference_type; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 Edge operator*() const { | 395 Edge operator*() const { |
| 396 return Edge(current_->from->GetInputRecordPtr(current_->input_index)); | 396 return Edge(current_->from->GetInputRecordPtr(current_->input_index)); |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool operator==(const iterator& other) const { | 399 bool operator==(const iterator& other) const { |
| 400 return current_ == other.current_; | 400 return current_ == other.current_; |
| 401 } | 401 } |
| 402 bool operator!=(const iterator& other) const { return !(*this == other); } | 402 bool operator!=(const iterator& other) const { return !(*this == other); } |
| 403 iterator& operator++() { | 403 iterator& operator++() { |
| 404 DCHECK_NOT_NULL(current_); | 404 DCHECK(current_); |
| 405 current_ = next_; | 405 current_ = next_; |
| 406 next_ = current_ ? current_->next : nullptr; | 406 next_ = current_ ? current_->next : nullptr; |
| 407 return *this; | 407 return *this; |
| 408 } | 408 } |
| 409 iterator operator++(int); | 409 iterator operator++(int); |
| 410 | 410 |
| 411 private: | 411 private: |
| 412 friend class Node::UseEdges; | 412 friend class Node::UseEdges; |
| 413 | 413 |
| 414 iterator() : current_(nullptr), next_(nullptr) {} | 414 iterator() : current_(nullptr), next_(nullptr) {} |
| (...skipping 29 matching lines...) Expand all Loading... |
| 444 const_iterator(const const_iterator& other) : current_(other.current_) {} | 444 const_iterator(const const_iterator& other) : current_(other.current_) {} |
| 445 | 445 |
| 446 Node* operator*() const { return current_->from; } | 446 Node* operator*() const { return current_->from; } |
| 447 bool operator==(const const_iterator& other) const { | 447 bool operator==(const const_iterator& other) const { |
| 448 return other.current_ == current_; | 448 return other.current_ == current_; |
| 449 } | 449 } |
| 450 bool operator!=(const const_iterator& other) const { | 450 bool operator!=(const const_iterator& other) const { |
| 451 return other.current_ != current_; | 451 return other.current_ != current_; |
| 452 } | 452 } |
| 453 const_iterator& operator++() { | 453 const_iterator& operator++() { |
| 454 DCHECK_NOT_NULL(current_); | 454 DCHECK(current_); |
| 455 current_ = current_->next; | 455 current_ = current_->next; |
| 456 return *this; | 456 return *this; |
| 457 } | 457 } |
| 458 const_iterator operator++(int); | 458 const_iterator operator++(int); |
| 459 | 459 |
| 460 private: | 460 private: |
| 461 friend class Node::Uses; | 461 friend class Node::Uses; |
| 462 | 462 |
| 463 const_iterator() : current_(nullptr) {} | 463 const_iterator() : current_(nullptr) {} |
| 464 explicit const_iterator(Node* node) : current_(node->first_use_) {} | 464 explicit const_iterator(Node* node) : current_(node->first_use_) {} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 477 | 477 |
| 478 void Node::ReplaceInput(int index, Node* new_to) { | 478 void Node::ReplaceInput(int index, Node* new_to) { |
| 479 GetInputRecordPtr(index)->Update(new_to); | 479 GetInputRecordPtr(index)->Update(new_to); |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace compiler | 482 } // namespace compiler |
| 483 } // namespace internal | 483 } // namespace internal |
| 484 } // namespace v8 | 484 } // namespace v8 |
| 485 | 485 |
| 486 #endif // V8_COMPILER_NODE_H_ | 486 #endif // V8_COMPILER_NODE_H_ |
| OLD | NEW |