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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 scale_ = scale; | 535 scale_ = scale; |
536 matches_ = true; | 536 matches_ = true; |
537 } | 537 } |
538 }; | 538 }; |
539 | 539 |
540 typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher> | 540 typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher> |
541 BaseWithIndexAndDisplacement32Matcher; | 541 BaseWithIndexAndDisplacement32Matcher; |
542 typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher> | 542 typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher> |
543 BaseWithIndexAndDisplacement64Matcher; | 543 BaseWithIndexAndDisplacement64Matcher; |
544 | 544 |
| 545 struct BranchMatcher : public NodeMatcher { |
| 546 explicit BranchMatcher(Node* branch); |
| 547 |
| 548 bool Matched() const { return if_true_ && if_false_; } |
| 549 |
| 550 Node* Branch() const { return node(); } |
| 551 Node* IfTrue() const { return if_true_; } |
| 552 Node* IfFalse() const { return if_false_; } |
| 553 |
| 554 private: |
| 555 Node* if_true_; |
| 556 Node* if_false_; |
| 557 }; |
| 558 |
| 559 |
| 560 struct DiamondMatcher : public NodeMatcher { |
| 561 explicit DiamondMatcher(Node* merge); |
| 562 |
| 563 bool Matched() const { return branch_; } |
| 564 bool IfProjectionsAreOwned() const { |
| 565 return if_true_->OwnedBy(node()) && if_false_->OwnedBy(node()); |
| 566 } |
| 567 |
| 568 Node* Branch() const { return branch_; } |
| 569 Node* IfTrue() const { return if_true_; } |
| 570 Node* IfFalse() const { return if_false_; } |
| 571 Node* Merge() const { return node(); } |
| 572 |
| 573 private: |
| 574 Node* branch_; |
| 575 Node* if_true_; |
| 576 Node* if_false_; |
| 577 }; |
| 578 |
545 } // namespace compiler | 579 } // namespace compiler |
546 } // namespace internal | 580 } // namespace internal |
547 } // namespace v8 | 581 } // namespace v8 |
548 | 582 |
549 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 583 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |