OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_MATCHERS_H_ | 5 #ifndef V8_COMPILER_NODE_MATCHERS_H_ |
6 #define V8_COMPILER_NODE_MATCHERS_H_ | 6 #define V8_COMPILER_NODE_MATCHERS_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 // TODO(turbofan): Move ExternalReference out of assembler.h | 10 // TODO(turbofan): Move ExternalReference out of assembler.h |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 bool Matched() const { return branch_; } | 563 bool Matched() const { return branch_; } |
564 bool IfProjectionsAreOwned() const { | 564 bool IfProjectionsAreOwned() const { |
565 return if_true_->OwnedBy(node()) && if_false_->OwnedBy(node()); | 565 return if_true_->OwnedBy(node()) && if_false_->OwnedBy(node()); |
566 } | 566 } |
567 | 567 |
568 Node* Branch() const { return branch_; } | 568 Node* Branch() const { return branch_; } |
569 Node* IfTrue() const { return if_true_; } | 569 Node* IfTrue() const { return if_true_; } |
570 Node* IfFalse() const { return if_false_; } | 570 Node* IfFalse() const { return if_false_; } |
571 Node* Merge() const { return node(); } | 571 Node* Merge() const { return node(); } |
572 | 572 |
| 573 Node* TrueInputOf(Node* phi) const { |
| 574 DCHECK(IrOpcode::IsPhiOpcode(phi->opcode())); |
| 575 DCHECK_EQ(3, phi->InputCount()); |
| 576 DCHECK_EQ(Merge(), phi->InputAt(2)); |
| 577 return phi->InputAt(if_true_ == Merge()->InputAt(0) ? 0 : 1); |
| 578 } |
| 579 |
| 580 Node* FalseInputOf(Node* phi) const { |
| 581 DCHECK(IrOpcode::IsPhiOpcode(phi->opcode())); |
| 582 DCHECK_EQ(3, phi->InputCount()); |
| 583 DCHECK_EQ(Merge(), phi->InputAt(2)); |
| 584 return phi->InputAt(if_true_ == Merge()->InputAt(0) ? 1 : 0); |
| 585 } |
| 586 |
573 private: | 587 private: |
574 Node* branch_; | 588 Node* branch_; |
575 Node* if_true_; | 589 Node* if_true_; |
576 Node* if_false_; | 590 Node* if_false_; |
577 }; | 591 }; |
578 | 592 |
579 } // namespace compiler | 593 } // namespace compiler |
580 } // namespace internal | 594 } // namespace internal |
581 } // namespace v8 | 595 } // namespace v8 |
582 | 596 |
583 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 597 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |