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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 325 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
326 base_matcher_, listener)); | 326 base_matcher_, listener)); |
327 } | 327 } |
328 | 328 |
329 private: | 329 private: |
330 const Matcher<size_t> index_matcher_; | 330 const Matcher<size_t> index_matcher_; |
331 const Matcher<Node*> base_matcher_; | 331 const Matcher<Node*> base_matcher_; |
332 }; | 332 }; |
333 | 333 |
334 | 334 |
335 class IsCallMatcher FINAL : public NodeMatcher { | 335 class IsCall2Matcher FINAL : public NodeMatcher { |
336 public: | 336 public: |
337 IsCallMatcher(const Matcher<CallDescriptor*>& descriptor_matcher, | 337 IsCall2Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, |
338 const Matcher<Node*>& value0_matcher, | 338 const Matcher<Node*>& value0_matcher, |
339 const Matcher<Node*>& value1_matcher, | 339 const Matcher<Node*>& value1_matcher, |
340 const Matcher<Node*>& value2_matcher, | 340 const Matcher<Node*>& effect_matcher, |
341 const Matcher<Node*>& value3_matcher, | 341 const Matcher<Node*>& control_matcher) |
342 const Matcher<Node*>& effect_matcher, | |
343 const Matcher<Node*>& control_matcher) | |
344 : NodeMatcher(IrOpcode::kCall), | 342 : NodeMatcher(IrOpcode::kCall), |
345 descriptor_matcher_(descriptor_matcher), | 343 descriptor_matcher_(descriptor_matcher), |
346 value0_matcher_(value0_matcher), | 344 value0_matcher_(value0_matcher), |
| 345 value1_matcher_(value1_matcher), |
| 346 effect_matcher_(effect_matcher), |
| 347 control_matcher_(control_matcher) {} |
| 348 |
| 349 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 350 NodeMatcher::DescribeTo(os); |
| 351 *os << " whose value0 ("; |
| 352 value0_matcher_.DescribeTo(os); |
| 353 *os << ") and value1 ("; |
| 354 value1_matcher_.DescribeTo(os); |
| 355 *os << ") and effect ("; |
| 356 effect_matcher_.DescribeTo(os); |
| 357 *os << ") and control ("; |
| 358 control_matcher_.DescribeTo(os); |
| 359 *os << ")"; |
| 360 } |
| 361 |
| 362 virtual bool MatchAndExplain(Node* node, |
| 363 MatchResultListener* listener) const OVERRIDE { |
| 364 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 365 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), |
| 366 "descriptor", descriptor_matcher_, listener) && |
| 367 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 368 "value0", value0_matcher_, listener) && |
| 369 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| 370 "value1", value1_matcher_, listener) && |
| 371 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 372 effect_matcher_, listener) && |
| 373 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 374 "control", control_matcher_, listener)); |
| 375 } |
| 376 |
| 377 private: |
| 378 const Matcher<CallDescriptor*> descriptor_matcher_; |
| 379 const Matcher<Node*> value0_matcher_; |
| 380 const Matcher<Node*> value1_matcher_; |
| 381 const Matcher<Node*> effect_matcher_; |
| 382 const Matcher<Node*> control_matcher_; |
| 383 }; |
| 384 |
| 385 |
| 386 class IsCall4Matcher FINAL : public NodeMatcher { |
| 387 public: |
| 388 IsCall4Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, |
| 389 const Matcher<Node*>& value0_matcher, |
| 390 const Matcher<Node*>& value1_matcher, |
| 391 const Matcher<Node*>& value2_matcher, |
| 392 const Matcher<Node*>& value3_matcher, |
| 393 const Matcher<Node*>& effect_matcher, |
| 394 const Matcher<Node*>& control_matcher) |
| 395 : NodeMatcher(IrOpcode::kCall), |
| 396 descriptor_matcher_(descriptor_matcher), |
| 397 value0_matcher_(value0_matcher), |
347 value1_matcher_(value1_matcher), | 398 value1_matcher_(value1_matcher), |
348 value2_matcher_(value2_matcher), | 399 value2_matcher_(value2_matcher), |
349 value3_matcher_(value3_matcher), | 400 value3_matcher_(value3_matcher), |
350 effect_matcher_(effect_matcher), | 401 effect_matcher_(effect_matcher), |
351 control_matcher_(control_matcher) {} | 402 control_matcher_(control_matcher) {} |
352 | 403 |
353 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 404 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
354 NodeMatcher::DescribeTo(os); | 405 NodeMatcher::DescribeTo(os); |
355 *os << " whose value0 ("; | 406 *os << " whose value0 ("; |
356 value0_matcher_.DescribeTo(os); | 407 value0_matcher_.DescribeTo(os); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 | 882 |
832 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher, | 883 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher, |
833 const Matcher<Node*>& base_matcher) { | 884 const Matcher<Node*>& base_matcher) { |
834 return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher)); | 885 return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher)); |
835 } | 886 } |
836 | 887 |
837 | 888 |
838 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, | 889 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
839 const Matcher<Node*>& value0_matcher, | 890 const Matcher<Node*>& value0_matcher, |
840 const Matcher<Node*>& value1_matcher, | 891 const Matcher<Node*>& value1_matcher, |
| 892 const Matcher<Node*>& effect_matcher, |
| 893 const Matcher<Node*>& control_matcher) { |
| 894 return MakeMatcher(new IsCall2Matcher(descriptor_matcher, value0_matcher, |
| 895 value1_matcher, effect_matcher, |
| 896 control_matcher)); |
| 897 } |
| 898 |
| 899 |
| 900 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
| 901 const Matcher<Node*>& value0_matcher, |
| 902 const Matcher<Node*>& value1_matcher, |
841 const Matcher<Node*>& value2_matcher, | 903 const Matcher<Node*>& value2_matcher, |
842 const Matcher<Node*>& value3_matcher, | 904 const Matcher<Node*>& value3_matcher, |
843 const Matcher<Node*>& effect_matcher, | 905 const Matcher<Node*>& effect_matcher, |
844 const Matcher<Node*>& control_matcher) { | 906 const Matcher<Node*>& control_matcher) { |
845 return MakeMatcher(new IsCallMatcher( | 907 return MakeMatcher(new IsCall4Matcher( |
846 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, | 908 descriptor_matcher, value0_matcher, value1_matcher, value2_matcher, |
847 value3_matcher, effect_matcher, control_matcher)); | 909 value3_matcher, effect_matcher, control_matcher)); |
848 } | 910 } |
849 | 911 |
850 | 912 |
851 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, | 913 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
852 const Matcher<Node*>& base_matcher, | 914 const Matcher<Node*>& base_matcher, |
853 const Matcher<Node*>& effect_matcher, | 915 const Matcher<Node*>& effect_matcher, |
854 const Matcher<Node*>& control_matcher) { | 916 const Matcher<Node*>& control_matcher) { |
855 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, | 917 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 IS_UNOP_MATCHER(Float64Sqrt) | 1013 IS_UNOP_MATCHER(Float64Sqrt) |
952 IS_UNOP_MATCHER(Float64Floor) | 1014 IS_UNOP_MATCHER(Float64Floor) |
953 IS_UNOP_MATCHER(Float64Ceil) | 1015 IS_UNOP_MATCHER(Float64Ceil) |
954 IS_UNOP_MATCHER(Float64RoundTruncate) | 1016 IS_UNOP_MATCHER(Float64RoundTruncate) |
955 IS_UNOP_MATCHER(Float64RoundTiesAway) | 1017 IS_UNOP_MATCHER(Float64RoundTiesAway) |
956 #undef IS_UNOP_MATCHER | 1018 #undef IS_UNOP_MATCHER |
957 | 1019 |
958 } // namespace compiler | 1020 } // namespace compiler |
959 } // namespace internal | 1021 } // namespace internal |
960 } // namespace v8 | 1022 } // namespace v8 |
OLD | NEW |