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/node-test-utils.h" | 5 #include "test/unittests/compiler/node-test-utils.h" |
6 | 6 |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 | 9 |
10 using testing::_; | 10 using testing::_; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 const Matcher<Node*> control_matcher_; | 396 const Matcher<Node*> control_matcher_; |
397 }; | 397 }; |
398 | 398 |
399 | 399 |
400 class IsLoadElementMatcher FINAL : public NodeMatcher { | 400 class IsLoadElementMatcher FINAL : public NodeMatcher { |
401 public: | 401 public: |
402 IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher, | 402 IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher, |
403 const Matcher<Node*>& base_matcher, | 403 const Matcher<Node*>& base_matcher, |
404 const Matcher<Node*>& index_matcher, | 404 const Matcher<Node*>& index_matcher, |
405 const Matcher<Node*>& length_matcher, | 405 const Matcher<Node*>& length_matcher, |
406 const Matcher<Node*>& effect_matcher, | 406 const Matcher<Node*>& effect_matcher) |
407 const Matcher<Node*>& control_matcher) | |
408 : NodeMatcher(IrOpcode::kLoadElement), | 407 : NodeMatcher(IrOpcode::kLoadElement), |
409 access_matcher_(access_matcher), | 408 access_matcher_(access_matcher), |
410 base_matcher_(base_matcher), | 409 base_matcher_(base_matcher), |
411 index_matcher_(index_matcher), | 410 index_matcher_(index_matcher), |
412 length_matcher_(length_matcher), | 411 length_matcher_(length_matcher), |
413 effect_matcher_(effect_matcher), | 412 effect_matcher_(effect_matcher) {} |
414 control_matcher_(control_matcher) {} | |
415 | 413 |
416 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 414 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
417 NodeMatcher::DescribeTo(os); | 415 NodeMatcher::DescribeTo(os); |
418 *os << " whose access ("; | 416 *os << " whose access ("; |
419 access_matcher_.DescribeTo(os); | 417 access_matcher_.DescribeTo(os); |
420 *os << "), base ("; | 418 *os << "), base ("; |
421 base_matcher_.DescribeTo(os); | 419 base_matcher_.DescribeTo(os); |
422 *os << "), index ("; | 420 *os << "), index ("; |
423 index_matcher_.DescribeTo(os); | 421 index_matcher_.DescribeTo(os); |
424 *os << "), length ("; | 422 *os << "), length ("; |
425 length_matcher_.DescribeTo(os); | 423 length_matcher_.DescribeTo(os); |
426 *os << "), effect ("; | 424 *os << ") and effect ("; |
427 effect_matcher_.DescribeTo(os); | 425 effect_matcher_.DescribeTo(os); |
428 *os << ") and control ("; | |
429 control_matcher_.DescribeTo(os); | |
430 *os << ")"; | 426 *os << ")"; |
431 } | 427 } |
432 | 428 |
433 virtual bool MatchAndExplain(Node* node, | 429 virtual bool MatchAndExplain(Node* node, |
434 MatchResultListener* listener) const OVERRIDE { | 430 MatchResultListener* listener) const OVERRIDE { |
435 return (NodeMatcher::MatchAndExplain(node, listener) && | 431 return (NodeMatcher::MatchAndExplain(node, listener) && |
436 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", | 432 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", |
437 access_matcher_, listener) && | 433 access_matcher_, listener) && |
438 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 434 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
439 base_matcher_, listener) && | 435 base_matcher_, listener) && |
440 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 436 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
441 "index", index_matcher_, listener) && | 437 "index", index_matcher_, listener) && |
442 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 438 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
443 "length", length_matcher_, listener) && | 439 "length", length_matcher_, listener) && |
444 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 440 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
445 effect_matcher_, listener) && | 441 effect_matcher_, listener)); |
446 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
447 "control", control_matcher_, listener)); | |
448 } | 442 } |
449 | 443 |
450 private: | 444 private: |
451 const Matcher<ElementAccess> access_matcher_; | 445 const Matcher<ElementAccess> access_matcher_; |
452 const Matcher<Node*> base_matcher_; | 446 const Matcher<Node*> base_matcher_; |
453 const Matcher<Node*> index_matcher_; | 447 const Matcher<Node*> index_matcher_; |
454 const Matcher<Node*> length_matcher_; | 448 const Matcher<Node*> length_matcher_; |
455 const Matcher<Node*> effect_matcher_; | 449 const Matcher<Node*> effect_matcher_; |
456 const Matcher<Node*> control_matcher_; | |
457 }; | 450 }; |
458 | 451 |
459 | 452 |
460 class IsStoreElementMatcher FINAL : public NodeMatcher { | 453 class IsStoreElementMatcher FINAL : public NodeMatcher { |
461 public: | 454 public: |
462 IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher, | 455 IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher, |
463 const Matcher<Node*>& base_matcher, | 456 const Matcher<Node*>& base_matcher, |
464 const Matcher<Node*>& index_matcher, | 457 const Matcher<Node*>& index_matcher, |
465 const Matcher<Node*>& length_matcher, | 458 const Matcher<Node*>& length_matcher, |
466 const Matcher<Node*>& value_matcher, | 459 const Matcher<Node*>& value_matcher, |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 const Matcher<Node*>& control_matcher) { | 799 const Matcher<Node*>& control_matcher) { |
807 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, | 800 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, |
808 effect_matcher, control_matcher)); | 801 effect_matcher, control_matcher)); |
809 } | 802 } |
810 | 803 |
811 | 804 |
812 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher, | 805 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher, |
813 const Matcher<Node*>& base_matcher, | 806 const Matcher<Node*>& base_matcher, |
814 const Matcher<Node*>& index_matcher, | 807 const Matcher<Node*>& index_matcher, |
815 const Matcher<Node*>& length_matcher, | 808 const Matcher<Node*>& length_matcher, |
816 const Matcher<Node*>& effect_matcher, | 809 const Matcher<Node*>& effect_matcher) { |
817 const Matcher<Node*>& control_matcher) { | |
818 return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher, | 810 return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher, |
819 index_matcher, length_matcher, | 811 index_matcher, length_matcher, |
820 effect_matcher, control_matcher)); | 812 effect_matcher)); |
821 } | 813 } |
822 | 814 |
823 | 815 |
824 Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher, | 816 Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher, |
825 const Matcher<Node*>& base_matcher, | 817 const Matcher<Node*>& base_matcher, |
826 const Matcher<Node*>& index_matcher, | 818 const Matcher<Node*>& index_matcher, |
827 const Matcher<Node*>& length_matcher, | 819 const Matcher<Node*>& length_matcher, |
828 const Matcher<Node*>& value_matcher, | 820 const Matcher<Node*>& value_matcher, |
829 const Matcher<Node*>& effect_matcher, | 821 const Matcher<Node*>& effect_matcher, |
830 const Matcher<Node*>& control_matcher) { | 822 const Matcher<Node*>& control_matcher) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 IS_UNOP_MATCHER(ChangeUint32ToUint64) | 891 IS_UNOP_MATCHER(ChangeUint32ToUint64) |
900 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) | 892 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) |
901 IS_UNOP_MATCHER(TruncateFloat64ToInt32) | 893 IS_UNOP_MATCHER(TruncateFloat64ToInt32) |
902 IS_UNOP_MATCHER(TruncateInt64ToInt32) | 894 IS_UNOP_MATCHER(TruncateInt64ToInt32) |
903 IS_UNOP_MATCHER(Float64Sqrt) | 895 IS_UNOP_MATCHER(Float64Sqrt) |
904 #undef IS_UNOP_MATCHER | 896 #undef IS_UNOP_MATCHER |
905 | 897 |
906 } // namespace compiler | 898 } // namespace compiler |
907 } // namespace internal | 899 } // namespace internal |
908 } // namespace v8 | 900 } // namespace v8 |
OLD | NEW |