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

Side by Side Diff: test/unittests/compiler/node-test-utils.cc

Issue 681223002: [turbofan] Improve typed lowering for JSToBoolean. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | 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 #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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 const Matcher<Node*> value3_matcher_; 348 const Matcher<Node*> value3_matcher_;
349 const Matcher<Node*> effect_matcher_; 349 const Matcher<Node*> effect_matcher_;
350 const Matcher<Node*> control_matcher_; 350 const Matcher<Node*> control_matcher_;
351 }; 351 };
352 352
353 353
354 class IsLoadFieldMatcher FINAL : public NodeMatcher { 354 class IsLoadFieldMatcher FINAL : public NodeMatcher {
355 public: 355 public:
356 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher, 356 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher,
357 const Matcher<Node*>& base_matcher, 357 const Matcher<Node*>& base_matcher,
358 const Matcher<Node*>& effect_matcher) 358 const Matcher<Node*>& effect_matcher,
359 const Matcher<Node*>& control_matcher)
359 : NodeMatcher(IrOpcode::kLoadField), 360 : NodeMatcher(IrOpcode::kLoadField),
360 access_matcher_(access_matcher), 361 access_matcher_(access_matcher),
361 base_matcher_(base_matcher), 362 base_matcher_(base_matcher),
362 effect_matcher_(effect_matcher) {} 363 effect_matcher_(effect_matcher),
364 control_matcher_(control_matcher) {}
363 365
364 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 366 virtual void DescribeTo(std::ostream* os) const OVERRIDE {
365 NodeMatcher::DescribeTo(os); 367 NodeMatcher::DescribeTo(os);
366 *os << " whose access ("; 368 *os << " whose access (";
367 access_matcher_.DescribeTo(os); 369 access_matcher_.DescribeTo(os);
368 *os << "), base ("; 370 *os << "), base (";
369 base_matcher_.DescribeTo(os); 371 base_matcher_.DescribeTo(os);
370 *os << ") and effect ("; 372 *os << "), effect (";
371 effect_matcher_.DescribeTo(os); 373 effect_matcher_.DescribeTo(os);
374 *os << ") and control (";
375 control_matcher_.DescribeTo(os);
372 *os << ")"; 376 *os << ")";
373 } 377 }
374 378
375 virtual bool MatchAndExplain(Node* node, 379 virtual bool MatchAndExplain(Node* node,
376 MatchResultListener* listener) const OVERRIDE { 380 MatchResultListener* listener) const OVERRIDE {
377 return (NodeMatcher::MatchAndExplain(node, listener) && 381 return (NodeMatcher::MatchAndExplain(node, listener) &&
378 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", 382 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
379 access_matcher_, listener) && 383 access_matcher_, listener) &&
380 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 384 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
381 base_matcher_, listener) && 385 base_matcher_, listener) &&
382 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 386 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
383 effect_matcher_, listener)); 387 effect_matcher_, listener) &&
388 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
389 "control", control_matcher_, listener));
384 } 390 }
385 391
386 private: 392 private:
387 const Matcher<FieldAccess> access_matcher_; 393 const Matcher<FieldAccess> access_matcher_;
388 const Matcher<Node*> base_matcher_; 394 const Matcher<Node*> base_matcher_;
389 const Matcher<Node*> effect_matcher_; 395 const Matcher<Node*> effect_matcher_;
396 const Matcher<Node*> control_matcher_;
390 }; 397 };
391 398
392 399
393 class IsLoadElementMatcher FINAL : public NodeMatcher { 400 class IsLoadElementMatcher FINAL : public NodeMatcher {
394 public: 401 public:
395 IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher, 402 IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher,
396 const Matcher<Node*>& base_matcher, 403 const Matcher<Node*>& base_matcher,
397 const Matcher<Node*>& index_matcher, 404 const Matcher<Node*>& index_matcher,
398 const Matcher<Node*>& length_matcher, 405 const Matcher<Node*>& length_matcher,
399 const Matcher<Node*>& effect_matcher, 406 const Matcher<Node*>& effect_matcher,
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 const Matcher<Node*>& effect_matcher, 795 const Matcher<Node*>& effect_matcher,
789 const Matcher<Node*>& control_matcher) { 796 const Matcher<Node*>& control_matcher) {
790 return MakeMatcher(new IsCallMatcher( 797 return MakeMatcher(new IsCallMatcher(
791 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, 798 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher,
792 value3_matcher, effect_matcher, control_matcher)); 799 value3_matcher, effect_matcher, control_matcher));
793 } 800 }
794 801
795 802
796 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, 803 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
797 const Matcher<Node*>& base_matcher, 804 const Matcher<Node*>& base_matcher,
798 const Matcher<Node*>& effect_matcher) { 805 const Matcher<Node*>& effect_matcher,
799 return MakeMatcher( 806 const Matcher<Node*>& control_matcher) {
800 new IsLoadFieldMatcher(access_matcher, base_matcher, effect_matcher)); 807 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher,
808 effect_matcher, control_matcher));
801 } 809 }
802 810
803 811
804 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher, 812 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
805 const Matcher<Node*>& base_matcher, 813 const Matcher<Node*>& base_matcher,
806 const Matcher<Node*>& index_matcher, 814 const Matcher<Node*>& index_matcher,
807 const Matcher<Node*>& length_matcher, 815 const Matcher<Node*>& length_matcher,
808 const Matcher<Node*>& effect_matcher, 816 const Matcher<Node*>& effect_matcher,
809 const Matcher<Node*>& control_matcher) { 817 const Matcher<Node*>& control_matcher) {
810 return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher, 818 return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 effect_matcher, control_matcher)); 855 effect_matcher, control_matcher));
848 } 856 }
849 857
850 858
851 #define IS_BINOP_MATCHER(Name) \ 859 #define IS_BINOP_MATCHER(Name) \
852 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ 860 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
853 const Matcher<Node*>& rhs_matcher) { \ 861 const Matcher<Node*>& rhs_matcher) { \
854 return MakeMatcher( \ 862 return MakeMatcher( \
855 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ 863 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \
856 } 864 }
865 IS_BINOP_MATCHER(NumberEqual)
857 IS_BINOP_MATCHER(NumberLessThan) 866 IS_BINOP_MATCHER(NumberLessThan)
858 IS_BINOP_MATCHER(NumberSubtract) 867 IS_BINOP_MATCHER(NumberSubtract)
859 IS_BINOP_MATCHER(Word32And) 868 IS_BINOP_MATCHER(Word32And)
860 IS_BINOP_MATCHER(Word32Sar) 869 IS_BINOP_MATCHER(Word32Sar)
861 IS_BINOP_MATCHER(Word32Shl) 870 IS_BINOP_MATCHER(Word32Shl)
862 IS_BINOP_MATCHER(Word32Shr) 871 IS_BINOP_MATCHER(Word32Shr)
863 IS_BINOP_MATCHER(Word32Ror) 872 IS_BINOP_MATCHER(Word32Ror)
864 IS_BINOP_MATCHER(Word32Equal) 873 IS_BINOP_MATCHER(Word32Equal)
865 IS_BINOP_MATCHER(Word64And) 874 IS_BINOP_MATCHER(Word64And)
866 IS_BINOP_MATCHER(Word64Sar) 875 IS_BINOP_MATCHER(Word64Sar)
867 IS_BINOP_MATCHER(Word64Shl) 876 IS_BINOP_MATCHER(Word64Shl)
868 IS_BINOP_MATCHER(Word64Equal) 877 IS_BINOP_MATCHER(Word64Equal)
869 IS_BINOP_MATCHER(Int32AddWithOverflow) 878 IS_BINOP_MATCHER(Int32AddWithOverflow)
870 IS_BINOP_MATCHER(Int32Add) 879 IS_BINOP_MATCHER(Int32Add)
871 IS_BINOP_MATCHER(Int32Sub) 880 IS_BINOP_MATCHER(Int32Sub)
872 IS_BINOP_MATCHER(Int32Mul) 881 IS_BINOP_MATCHER(Int32Mul)
873 IS_BINOP_MATCHER(Int32MulHigh) 882 IS_BINOP_MATCHER(Int32MulHigh)
874 IS_BINOP_MATCHER(Int32LessThan) 883 IS_BINOP_MATCHER(Int32LessThan)
875 IS_BINOP_MATCHER(Uint32LessThan) 884 IS_BINOP_MATCHER(Uint32LessThan)
876 IS_BINOP_MATCHER(Uint32LessThanOrEqual) 885 IS_BINOP_MATCHER(Uint32LessThanOrEqual)
877 #undef IS_BINOP_MATCHER 886 #undef IS_BINOP_MATCHER
878 887
879 888
880 #define IS_UNOP_MATCHER(Name) \ 889 #define IS_UNOP_MATCHER(Name) \
881 Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher) { \ 890 Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher) { \
882 return MakeMatcher(new IsUnopMatcher(IrOpcode::k##Name, input_matcher)); \ 891 return MakeMatcher(new IsUnopMatcher(IrOpcode::k##Name, input_matcher)); \
883 } 892 }
893 IS_UNOP_MATCHER(BooleanNot)
884 IS_UNOP_MATCHER(ChangeFloat64ToInt32) 894 IS_UNOP_MATCHER(ChangeFloat64ToInt32)
885 IS_UNOP_MATCHER(ChangeFloat64ToUint32) 895 IS_UNOP_MATCHER(ChangeFloat64ToUint32)
886 IS_UNOP_MATCHER(ChangeInt32ToFloat64) 896 IS_UNOP_MATCHER(ChangeInt32ToFloat64)
887 IS_UNOP_MATCHER(ChangeInt32ToInt64) 897 IS_UNOP_MATCHER(ChangeInt32ToInt64)
888 IS_UNOP_MATCHER(ChangeUint32ToFloat64) 898 IS_UNOP_MATCHER(ChangeUint32ToFloat64)
889 IS_UNOP_MATCHER(ChangeUint32ToUint64) 899 IS_UNOP_MATCHER(ChangeUint32ToUint64)
890 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) 900 IS_UNOP_MATCHER(TruncateFloat64ToFloat32)
891 IS_UNOP_MATCHER(TruncateFloat64ToInt32) 901 IS_UNOP_MATCHER(TruncateFloat64ToInt32)
892 IS_UNOP_MATCHER(TruncateInt64ToInt32) 902 IS_UNOP_MATCHER(TruncateInt64ToInt32)
893 IS_UNOP_MATCHER(Float64Sqrt) 903 IS_UNOP_MATCHER(Float64Sqrt)
894 #undef IS_UNOP_MATCHER 904 #undef IS_UNOP_MATCHER
895 905
896 } // namespace compiler 906 } // namespace compiler
897 } // namespace internal 907 } // namespace internal
898 } // namespace v8 908 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698