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

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

Issue 694063005: Introduce Diamond, a helper for building diamond-shaped control patterns. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: newline 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') | test/unittests/unittests.gyp » ('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 #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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 private: 295 private:
296 const Matcher<MachineType> type_matcher_; 296 const Matcher<MachineType> type_matcher_;
297 const Matcher<Node*> value0_matcher_; 297 const Matcher<Node*> value0_matcher_;
298 const Matcher<Node*> value1_matcher_; 298 const Matcher<Node*> value1_matcher_;
299 const Matcher<Node*> control_matcher_; 299 const Matcher<Node*> control_matcher_;
300 }; 300 };
301 301
302 302
303 class IsEffectPhiMatcher FINAL : public NodeMatcher {
304 public:
305 IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher,
306 const Matcher<Node*>& effect1_matcher,
307 const Matcher<Node*>& control_matcher)
308 : NodeMatcher(IrOpcode::kEffectPhi),
309 effect0_matcher_(effect0_matcher),
310 effect1_matcher_(effect1_matcher),
311 control_matcher_(control_matcher) {}
312
313 virtual void DescribeTo(std::ostream* os) const OVERRIDE {
314 NodeMatcher::DescribeTo(os);
315 *os << "), effect0 (";
316 effect0_matcher_.DescribeTo(os);
317 *os << "), effect1 (";
318 effect1_matcher_.DescribeTo(os);
319 *os << ") and control (";
320 control_matcher_.DescribeTo(os);
321 *os << ")";
322 }
323
324 virtual bool MatchAndExplain(Node* node,
325 MatchResultListener* listener) const OVERRIDE {
326 return (NodeMatcher::MatchAndExplain(node, listener) &&
327 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0),
328 "effect0", effect0_matcher_, listener) &&
329 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1),
330 "effect1", effect1_matcher_, listener) &&
331 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
332 "control", control_matcher_, listener));
333 }
334
335 private:
336 const Matcher<Node*> effect0_matcher_;
337 const Matcher<Node*> effect1_matcher_;
338 const Matcher<Node*> control_matcher_;
339 };
340
341
303 class IsProjectionMatcher FINAL : public NodeMatcher { 342 class IsProjectionMatcher FINAL : public NodeMatcher {
304 public: 343 public:
305 IsProjectionMatcher(const Matcher<size_t>& index_matcher, 344 IsProjectionMatcher(const Matcher<size_t>& index_matcher,
306 const Matcher<Node*>& base_matcher) 345 const Matcher<Node*>& base_matcher)
307 : NodeMatcher(IrOpcode::kProjection), 346 : NodeMatcher(IrOpcode::kProjection),
308 index_matcher_(index_matcher), 347 index_matcher_(index_matcher),
309 base_matcher_(base_matcher) {} 348 base_matcher_(base_matcher) {}
310 349
311 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 350 virtual void DescribeTo(std::ostream* os) const OVERRIDE {
312 NodeMatcher::DescribeTo(os); 351 NodeMatcher::DescribeTo(os);
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 912
874 Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher, 913 Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
875 const Matcher<Node*>& value0_matcher, 914 const Matcher<Node*>& value0_matcher,
876 const Matcher<Node*>& value1_matcher, 915 const Matcher<Node*>& value1_matcher,
877 const Matcher<Node*>& merge_matcher) { 916 const Matcher<Node*>& merge_matcher) {
878 return MakeMatcher(new IsPhiMatcher(type_matcher, value0_matcher, 917 return MakeMatcher(new IsPhiMatcher(type_matcher, value0_matcher,
879 value1_matcher, merge_matcher)); 918 value1_matcher, merge_matcher));
880 } 919 }
881 920
882 921
922 Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
923 const Matcher<Node*>& effect1_matcher,
924 const Matcher<Node*>& merge_matcher) {
925 return MakeMatcher(
926 new IsEffectPhiMatcher(effect0_matcher, effect1_matcher, merge_matcher));
927 }
928
929
883 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher, 930 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
884 const Matcher<Node*>& base_matcher) { 931 const Matcher<Node*>& base_matcher) {
885 return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher)); 932 return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher));
886 } 933 }
887 934
888 935
889 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, 936 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
890 const Matcher<Node*>& value0_matcher, 937 const Matcher<Node*>& value0_matcher,
891 const Matcher<Node*>& value1_matcher, 938 const Matcher<Node*>& value1_matcher,
892 const Matcher<Node*>& effect_matcher, 939 const Matcher<Node*>& effect_matcher,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 IS_UNOP_MATCHER(Float64Sqrt) 1060 IS_UNOP_MATCHER(Float64Sqrt)
1014 IS_UNOP_MATCHER(Float64Floor) 1061 IS_UNOP_MATCHER(Float64Floor)
1015 IS_UNOP_MATCHER(Float64Ceil) 1062 IS_UNOP_MATCHER(Float64Ceil)
1016 IS_UNOP_MATCHER(Float64RoundTruncate) 1063 IS_UNOP_MATCHER(Float64RoundTruncate)
1017 IS_UNOP_MATCHER(Float64RoundTiesAway) 1064 IS_UNOP_MATCHER(Float64RoundTiesAway)
1018 #undef IS_UNOP_MATCHER 1065 #undef IS_UNOP_MATCHER
1019 1066
1020 } // namespace compiler 1067 } // namespace compiler
1021 } // namespace internal 1068 } // namespace internal
1022 } // namespace v8 1069 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698