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 #include "test/unittests/compiler/graph-unittest.h" | 5 #include "test/unittests/compiler/graph-unittest.h" |
6 | 6 |
7 #include <ostream> // NOLINT(readability/streams) | 7 #include <ostream> // NOLINT(readability/streams) |
8 | 8 |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 | 10 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 const Matcher<Node*> effect_matcher_; | 428 const Matcher<Node*> effect_matcher_; |
429 const Matcher<Node*> control_matcher_; | 429 const Matcher<Node*> control_matcher_; |
430 }; | 430 }; |
431 | 431 |
432 | 432 |
433 class IsLoadMatcher FINAL : public NodeMatcher { | 433 class IsLoadMatcher FINAL : public NodeMatcher { |
434 public: | 434 public: |
435 IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher, | 435 IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher, |
436 const Matcher<Node*>& base_matcher, | 436 const Matcher<Node*>& base_matcher, |
437 const Matcher<Node*>& index_matcher, | 437 const Matcher<Node*>& index_matcher, |
438 const Matcher<Node*>& effect_matcher) | 438 const Matcher<Node*>& effect_matcher, |
| 439 const Matcher<Node*>& control_matcher) |
439 : NodeMatcher(IrOpcode::kLoad), | 440 : NodeMatcher(IrOpcode::kLoad), |
440 rep_matcher_(rep_matcher), | 441 rep_matcher_(rep_matcher), |
441 base_matcher_(base_matcher), | 442 base_matcher_(base_matcher), |
442 index_matcher_(index_matcher), | 443 index_matcher_(index_matcher), |
443 effect_matcher_(effect_matcher) {} | 444 effect_matcher_(effect_matcher), |
| 445 control_matcher_(control_matcher) {} |
444 | 446 |
445 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 447 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
446 NodeMatcher::DescribeTo(os); | 448 NodeMatcher::DescribeTo(os); |
447 *os << " whose rep ("; | 449 *os << " whose rep ("; |
448 rep_matcher_.DescribeTo(os); | 450 rep_matcher_.DescribeTo(os); |
449 *os << "), base ("; | 451 *os << "), base ("; |
450 base_matcher_.DescribeTo(os); | 452 base_matcher_.DescribeTo(os); |
451 *os << "), index ("; | 453 *os << "), index ("; |
452 index_matcher_.DescribeTo(os); | 454 index_matcher_.DescribeTo(os); |
453 *os << ") and effect ("; | 455 *os << "), effect ("; |
454 effect_matcher_.DescribeTo(os); | 456 effect_matcher_.DescribeTo(os); |
| 457 *os << ") and control ("; |
| 458 control_matcher_.DescribeTo(os); |
455 *os << ")"; | 459 *os << ")"; |
456 } | 460 } |
457 | 461 |
458 virtual bool MatchAndExplain(Node* node, | 462 virtual bool MatchAndExplain(Node* node, |
459 MatchResultListener* listener) const OVERRIDE { | 463 MatchResultListener* listener) const OVERRIDE { |
460 return (NodeMatcher::MatchAndExplain(node, listener) && | 464 return (NodeMatcher::MatchAndExplain(node, listener) && |
461 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", | 465 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", |
462 rep_matcher_, listener) && | 466 rep_matcher_, listener) && |
463 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 467 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
464 base_matcher_, listener) && | 468 base_matcher_, listener) && |
465 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 469 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
466 "index", index_matcher_, listener) && | 470 "index", index_matcher_, listener) && |
467 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 471 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
468 effect_matcher_, listener)); | 472 effect_matcher_, listener) && |
| 473 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 474 "control", control_matcher_, listener)); |
469 } | 475 } |
470 | 476 |
471 private: | 477 private: |
472 const Matcher<LoadRepresentation> rep_matcher_; | 478 const Matcher<LoadRepresentation> rep_matcher_; |
473 const Matcher<Node*> base_matcher_; | 479 const Matcher<Node*> base_matcher_; |
474 const Matcher<Node*> index_matcher_; | 480 const Matcher<Node*> index_matcher_; |
475 const Matcher<Node*> effect_matcher_; | 481 const Matcher<Node*> effect_matcher_; |
| 482 const Matcher<Node*> control_matcher_; |
476 }; | 483 }; |
477 | 484 |
478 | 485 |
479 class IsStoreMatcher FINAL : public NodeMatcher { | 486 class IsStoreMatcher FINAL : public NodeMatcher { |
480 public: | 487 public: |
481 IsStoreMatcher(const Matcher<MachineType>& type_matcher, | 488 IsStoreMatcher(const Matcher<MachineType>& type_matcher, |
482 const Matcher<WriteBarrierKind> write_barrier_matcher, | 489 const Matcher<WriteBarrierKind> write_barrier_matcher, |
483 const Matcher<Node*>& base_matcher, | 490 const Matcher<Node*>& base_matcher, |
484 const Matcher<Node*>& index_matcher, | 491 const Matcher<Node*>& index_matcher, |
485 const Matcher<Node*>& value_matcher, | 492 const Matcher<Node*>& value_matcher, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 return MakeMatcher(new IsControl1Matcher(IrOpcode::kIfTrue, control_matcher)); | 625 return MakeMatcher(new IsControl1Matcher(IrOpcode::kIfTrue, control_matcher)); |
619 } | 626 } |
620 | 627 |
621 | 628 |
622 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher) { | 629 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher) { |
623 return MakeMatcher( | 630 return MakeMatcher( |
624 new IsControl1Matcher(IrOpcode::kIfFalse, control_matcher)); | 631 new IsControl1Matcher(IrOpcode::kIfFalse, control_matcher)); |
625 } | 632 } |
626 | 633 |
627 | 634 |
628 Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher) { | |
629 return MakeMatcher( | |
630 new IsControl1Matcher(IrOpcode::kControlEffect, control_matcher)); | |
631 } | |
632 | |
633 | |
634 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher) { | 635 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher) { |
635 return MakeMatcher(new IsUnopMatcher(IrOpcode::kValueEffect, value_matcher)); | 636 return MakeMatcher(new IsUnopMatcher(IrOpcode::kValueEffect, value_matcher)); |
636 } | 637 } |
637 | 638 |
638 | 639 |
639 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, | 640 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, |
640 const Matcher<Node*>& effect_matcher) { | 641 const Matcher<Node*>& effect_matcher) { |
641 return MakeMatcher(new IsFinishMatcher(value_matcher, effect_matcher)); | 642 return MakeMatcher(new IsFinishMatcher(value_matcher, effect_matcher)); |
642 } | 643 } |
643 | 644 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 const Matcher<Node*>& control_matcher) { | 711 const Matcher<Node*>& control_matcher) { |
711 return MakeMatcher(new IsCallMatcher( | 712 return MakeMatcher(new IsCallMatcher( |
712 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, | 713 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, |
713 value3_matcher, effect_matcher, control_matcher)); | 714 value3_matcher, effect_matcher, control_matcher)); |
714 } | 715 } |
715 | 716 |
716 | 717 |
717 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, | 718 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, |
718 const Matcher<Node*>& base_matcher, | 719 const Matcher<Node*>& base_matcher, |
719 const Matcher<Node*>& index_matcher, | 720 const Matcher<Node*>& index_matcher, |
720 const Matcher<Node*>& effect_matcher) { | 721 const Matcher<Node*>& effect_matcher, |
| 722 const Matcher<Node*>& control_matcher) { |
721 return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher, index_matcher, | 723 return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher, index_matcher, |
722 effect_matcher)); | 724 effect_matcher, control_matcher)); |
723 } | 725 } |
724 | 726 |
725 | 727 |
726 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, | 728 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, |
727 const Matcher<WriteBarrierKind>& write_barrier_matcher, | 729 const Matcher<WriteBarrierKind>& write_barrier_matcher, |
728 const Matcher<Node*>& base_matcher, | 730 const Matcher<Node*>& base_matcher, |
729 const Matcher<Node*>& index_matcher, | 731 const Matcher<Node*>& index_matcher, |
730 const Matcher<Node*>& value_matcher, | 732 const Matcher<Node*>& value_matcher, |
731 const Matcher<Node*>& effect_matcher, | 733 const Matcher<Node*>& effect_matcher, |
732 const Matcher<Node*>& control_matcher) { | 734 const Matcher<Node*>& control_matcher) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 IS_UNOP_MATCHER(ChangeUint32ToUint64) | 773 IS_UNOP_MATCHER(ChangeUint32ToUint64) |
772 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) | 774 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) |
773 IS_UNOP_MATCHER(TruncateFloat64ToInt32) | 775 IS_UNOP_MATCHER(TruncateFloat64ToInt32) |
774 IS_UNOP_MATCHER(TruncateInt64ToInt32) | 776 IS_UNOP_MATCHER(TruncateInt64ToInt32) |
775 IS_UNOP_MATCHER(Float64Sqrt) | 777 IS_UNOP_MATCHER(Float64Sqrt) |
776 #undef IS_UNOP_MATCHER | 778 #undef IS_UNOP_MATCHER |
777 | 779 |
778 } // namespace compiler | 780 } // namespace compiler |
779 } // namespace internal | 781 } // namespace internal |
780 } // namespace v8 | 782 } // namespace v8 |
OLD | NEW |