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 "src/compiler/graph-unittest.h" | 5 #include "src/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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 const Matcher<Node*> value1_matcher_; | 421 const Matcher<Node*> value1_matcher_; |
422 const Matcher<Node*> value2_matcher_; | 422 const Matcher<Node*> value2_matcher_; |
423 const Matcher<Node*> value3_matcher_; | 423 const Matcher<Node*> value3_matcher_; |
424 const Matcher<Node*> effect_matcher_; | 424 const Matcher<Node*> effect_matcher_; |
425 const Matcher<Node*> control_matcher_; | 425 const Matcher<Node*> control_matcher_; |
426 }; | 426 }; |
427 | 427 |
428 | 428 |
429 class IsLoadMatcher FINAL : public NodeMatcher { | 429 class IsLoadMatcher FINAL : public NodeMatcher { |
430 public: | 430 public: |
431 IsLoadMatcher(const Matcher<MachineType>& type_matcher, | 431 IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher, |
432 const Matcher<Node*>& base_matcher, | 432 const Matcher<Node*>& base_matcher, |
433 const Matcher<Node*>& index_matcher, | 433 const Matcher<Node*>& index_matcher, |
434 const Matcher<Node*>& effect_matcher) | 434 const Matcher<Node*>& effect_matcher) |
435 : NodeMatcher(IrOpcode::kLoad), | 435 : NodeMatcher(IrOpcode::kLoad), |
436 type_matcher_(type_matcher), | 436 rep_matcher_(rep_matcher), |
437 base_matcher_(base_matcher), | 437 base_matcher_(base_matcher), |
438 index_matcher_(index_matcher), | 438 index_matcher_(index_matcher), |
439 effect_matcher_(effect_matcher) {} | 439 effect_matcher_(effect_matcher) {} |
440 | 440 |
441 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 441 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
442 NodeMatcher::DescribeTo(os); | 442 NodeMatcher::DescribeTo(os); |
443 *os << " whose type ("; | 443 *os << " whose rep ("; |
444 type_matcher_.DescribeTo(os); | 444 rep_matcher_.DescribeTo(os); |
445 *os << "), base ("; | 445 *os << "), base ("; |
446 base_matcher_.DescribeTo(os); | 446 base_matcher_.DescribeTo(os); |
447 *os << "), index ("; | 447 *os << "), index ("; |
448 index_matcher_.DescribeTo(os); | 448 index_matcher_.DescribeTo(os); |
449 *os << ") and effect ("; | 449 *os << ") and effect ("; |
450 effect_matcher_.DescribeTo(os); | 450 effect_matcher_.DescribeTo(os); |
451 *os << ")"; | 451 *os << ")"; |
452 } | 452 } |
453 | 453 |
454 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 454 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
455 OVERRIDE { | 455 OVERRIDE { |
456 return (NodeMatcher::MatchAndExplain(node, listener) && | 456 return (NodeMatcher::MatchAndExplain(node, listener) && |
457 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", | 457 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", |
458 type_matcher_, listener) && | 458 rep_matcher_, listener) && |
459 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 459 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
460 base_matcher_, listener) && | 460 base_matcher_, listener) && |
461 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 461 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
462 "index", index_matcher_, listener) && | 462 "index", index_matcher_, listener) && |
463 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 463 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
464 effect_matcher_, listener)); | 464 effect_matcher_, listener)); |
465 } | 465 } |
466 | 466 |
467 private: | 467 private: |
468 const Matcher<MachineType> type_matcher_; | 468 const Matcher<LoadRepresentation> rep_matcher_; |
469 const Matcher<Node*> base_matcher_; | 469 const Matcher<Node*> base_matcher_; |
470 const Matcher<Node*> index_matcher_; | 470 const Matcher<Node*> index_matcher_; |
471 const Matcher<Node*> effect_matcher_; | 471 const Matcher<Node*> effect_matcher_; |
472 }; | 472 }; |
473 | 473 |
474 | 474 |
475 class IsStoreMatcher FINAL : public NodeMatcher { | 475 class IsStoreMatcher FINAL : public NodeMatcher { |
476 public: | 476 public: |
477 IsStoreMatcher(const Matcher<MachineType>& type_matcher, | 477 IsStoreMatcher(const Matcher<MachineType>& type_matcher, |
478 const Matcher<WriteBarrierKind> write_barrier_matcher, | 478 const Matcher<WriteBarrierKind> write_barrier_matcher, |
(...skipping 27 matching lines...) Expand all Loading... |
506 effect_matcher_.DescribeTo(os); | 506 effect_matcher_.DescribeTo(os); |
507 *os << ") and control ("; | 507 *os << ") and control ("; |
508 control_matcher_.DescribeTo(os); | 508 control_matcher_.DescribeTo(os); |
509 *os << ")"; | 509 *os << ")"; |
510 } | 510 } |
511 | 511 |
512 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 512 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
513 OVERRIDE { | 513 OVERRIDE { |
514 return (NodeMatcher::MatchAndExplain(node, listener) && | 514 return (NodeMatcher::MatchAndExplain(node, listener) && |
515 PrintMatchAndExplain( | 515 PrintMatchAndExplain( |
516 OpParameter<StoreRepresentation>(node).machine_type, "type", | 516 OpParameter<StoreRepresentation>(node).machine_type(), "type", |
517 type_matcher_, listener) && | 517 type_matcher_, listener) && |
518 PrintMatchAndExplain( | 518 PrintMatchAndExplain( |
519 OpParameter<StoreRepresentation>(node).write_barrier_kind, | 519 OpParameter<StoreRepresentation>(node).write_barrier_kind(), |
520 "write barrier", write_barrier_matcher_, listener) && | 520 "write barrier", write_barrier_matcher_, listener) && |
521 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 521 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
522 base_matcher_, listener) && | 522 base_matcher_, listener) && |
523 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 523 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
524 "index", index_matcher_, listener) && | 524 "index", index_matcher_, listener) && |
525 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 525 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
526 "value", value_matcher_, listener) && | 526 "value", value_matcher_, listener) && |
527 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 527 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
528 effect_matcher_, listener) && | 528 effect_matcher_, listener) && |
529 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 529 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 const Matcher<Node*>& value2_matcher, | 697 const Matcher<Node*>& value2_matcher, |
698 const Matcher<Node*>& value3_matcher, | 698 const Matcher<Node*>& value3_matcher, |
699 const Matcher<Node*>& effect_matcher, | 699 const Matcher<Node*>& effect_matcher, |
700 const Matcher<Node*>& control_matcher) { | 700 const Matcher<Node*>& control_matcher) { |
701 return MakeMatcher(new IsCallMatcher( | 701 return MakeMatcher(new IsCallMatcher( |
702 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, | 702 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, |
703 value3_matcher, effect_matcher, control_matcher)); | 703 value3_matcher, effect_matcher, control_matcher)); |
704 } | 704 } |
705 | 705 |
706 | 706 |
707 Matcher<Node*> IsLoad(const Matcher<MachineType>& type_matcher, | 707 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, |
708 const Matcher<Node*>& base_matcher, | 708 const Matcher<Node*>& base_matcher, |
709 const Matcher<Node*>& index_matcher, | 709 const Matcher<Node*>& index_matcher, |
710 const Matcher<Node*>& effect_matcher) { | 710 const Matcher<Node*>& effect_matcher) { |
711 return MakeMatcher(new IsLoadMatcher(type_matcher, base_matcher, | 711 return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher, index_matcher, |
712 index_matcher, effect_matcher)); | 712 effect_matcher)); |
713 } | 713 } |
714 | 714 |
715 | 715 |
716 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, | 716 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, |
717 const Matcher<WriteBarrierKind>& write_barrier_matcher, | 717 const Matcher<WriteBarrierKind>& write_barrier_matcher, |
718 const Matcher<Node*>& base_matcher, | 718 const Matcher<Node*>& base_matcher, |
719 const Matcher<Node*>& index_matcher, | 719 const Matcher<Node*>& index_matcher, |
720 const Matcher<Node*>& value_matcher, | 720 const Matcher<Node*>& value_matcher, |
721 const Matcher<Node*>& effect_matcher, | 721 const Matcher<Node*>& effect_matcher, |
722 const Matcher<Node*>& control_matcher) { | 722 const Matcher<Node*>& control_matcher) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 IS_UNOP_MATCHER(ChangeInt32ToInt64) | 756 IS_UNOP_MATCHER(ChangeInt32ToInt64) |
757 IS_UNOP_MATCHER(ChangeUint32ToFloat64) | 757 IS_UNOP_MATCHER(ChangeUint32ToFloat64) |
758 IS_UNOP_MATCHER(ChangeUint32ToUint64) | 758 IS_UNOP_MATCHER(ChangeUint32ToUint64) |
759 IS_UNOP_MATCHER(TruncateFloat64ToInt32) | 759 IS_UNOP_MATCHER(TruncateFloat64ToInt32) |
760 IS_UNOP_MATCHER(TruncateInt64ToInt32) | 760 IS_UNOP_MATCHER(TruncateInt64ToInt32) |
761 #undef IS_UNOP_MATCHER | 761 #undef IS_UNOP_MATCHER |
762 | 762 |
763 } // namespace compiler | 763 } // namespace compiler |
764 } // namespace internal | 764 } // namespace internal |
765 } // namespace v8 | 765 } // namespace v8 |
OLD | NEW |