Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: src/compiler/node-matchers.h

Issue 1054963002: [turbofan] Introduce BranchMatcher and DiamondMatcher helpers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/node-matchers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/node-matchers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698