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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 526 } |
527 | 527 |
528 private: | 528 private: |
529 const Matcher<FieldAccess> access_matcher_; | 529 const Matcher<FieldAccess> access_matcher_; |
530 const Matcher<Node*> base_matcher_; | 530 const Matcher<Node*> base_matcher_; |
531 const Matcher<Node*> effect_matcher_; | 531 const Matcher<Node*> effect_matcher_; |
532 const Matcher<Node*> control_matcher_; | 532 const Matcher<Node*> control_matcher_; |
533 }; | 533 }; |
534 | 534 |
535 | 535 |
| 536 class IsStoreFieldMatcher FINAL : public NodeMatcher { |
| 537 public: |
| 538 IsStoreFieldMatcher(const Matcher<FieldAccess>& access_matcher, |
| 539 const Matcher<Node*>& base_matcher, |
| 540 const Matcher<Node*>& value_matcher, |
| 541 const Matcher<Node*>& effect_matcher, |
| 542 const Matcher<Node*>& control_matcher) |
| 543 : NodeMatcher(IrOpcode::kStoreField), |
| 544 access_matcher_(access_matcher), |
| 545 base_matcher_(base_matcher), |
| 546 value_matcher_(value_matcher), |
| 547 effect_matcher_(effect_matcher), |
| 548 control_matcher_(control_matcher) {} |
| 549 |
| 550 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 551 NodeMatcher::DescribeTo(os); |
| 552 *os << " whose access ("; |
| 553 access_matcher_.DescribeTo(os); |
| 554 *os << "), base ("; |
| 555 base_matcher_.DescribeTo(os); |
| 556 *os << "), value ("; |
| 557 value_matcher_.DescribeTo(os); |
| 558 *os << "), effect ("; |
| 559 effect_matcher_.DescribeTo(os); |
| 560 *os << ") and control ("; |
| 561 control_matcher_.DescribeTo(os); |
| 562 *os << ")"; |
| 563 } |
| 564 |
| 565 virtual bool MatchAndExplain(Node* node, |
| 566 MatchResultListener* listener) const OVERRIDE { |
| 567 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 568 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", |
| 569 access_matcher_, listener) && |
| 570 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
| 571 base_matcher_, listener) && |
| 572 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| 573 "value", value_matcher_, listener) && |
| 574 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 575 effect_matcher_, listener) && |
| 576 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 577 "control", control_matcher_, listener)); |
| 578 } |
| 579 |
| 580 private: |
| 581 const Matcher<FieldAccess> access_matcher_; |
| 582 const Matcher<Node*> base_matcher_; |
| 583 const Matcher<Node*> value_matcher_; |
| 584 const Matcher<Node*> effect_matcher_; |
| 585 const Matcher<Node*> control_matcher_; |
| 586 }; |
| 587 |
| 588 |
536 class IsLoadBufferMatcher FINAL : public NodeMatcher { | 589 class IsLoadBufferMatcher FINAL : public NodeMatcher { |
537 public: | 590 public: |
538 IsLoadBufferMatcher(const Matcher<BufferAccess>& access_matcher, | 591 IsLoadBufferMatcher(const Matcher<BufferAccess>& access_matcher, |
539 const Matcher<Node*>& buffer_matcher, | 592 const Matcher<Node*>& buffer_matcher, |
540 const Matcher<Node*>& offset_matcher, | 593 const Matcher<Node*>& offset_matcher, |
541 const Matcher<Node*>& length_matcher, | 594 const Matcher<Node*>& length_matcher, |
542 const Matcher<Node*>& effect_matcher, | 595 const Matcher<Node*>& effect_matcher, |
543 const Matcher<Node*>& control_matcher) | 596 const Matcher<Node*>& control_matcher) |
544 : NodeMatcher(IrOpcode::kLoadBuffer), | 597 : NodeMatcher(IrOpcode::kLoadBuffer), |
545 access_matcher_(access_matcher), | 598 access_matcher_(access_matcher), |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 | 1178 |
1126 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, | 1179 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
1127 const Matcher<Node*>& base_matcher, | 1180 const Matcher<Node*>& base_matcher, |
1128 const Matcher<Node*>& effect_matcher, | 1181 const Matcher<Node*>& effect_matcher, |
1129 const Matcher<Node*>& control_matcher) { | 1182 const Matcher<Node*>& control_matcher) { |
1130 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, | 1183 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, |
1131 effect_matcher, control_matcher)); | 1184 effect_matcher, control_matcher)); |
1132 } | 1185 } |
1133 | 1186 |
1134 | 1187 |
| 1188 Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher, |
| 1189 const Matcher<Node*>& base_matcher, |
| 1190 const Matcher<Node*>& value_matcher, |
| 1191 const Matcher<Node*>& effect_matcher, |
| 1192 const Matcher<Node*>& control_matcher) { |
| 1193 return MakeMatcher(new IsStoreFieldMatcher(access_matcher, base_matcher, |
| 1194 value_matcher, effect_matcher, |
| 1195 control_matcher)); |
| 1196 } |
| 1197 |
| 1198 |
1135 Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher, | 1199 Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher, |
1136 const Matcher<Node*>& buffer_matcher, | 1200 const Matcher<Node*>& buffer_matcher, |
1137 const Matcher<Node*>& offset_matcher, | 1201 const Matcher<Node*>& offset_matcher, |
1138 const Matcher<Node*>& length_matcher, | 1202 const Matcher<Node*>& length_matcher, |
1139 const Matcher<Node*>& effect_matcher, | 1203 const Matcher<Node*>& effect_matcher, |
1140 const Matcher<Node*>& control_matcher) { | 1204 const Matcher<Node*>& control_matcher) { |
1141 return MakeMatcher(new IsLoadBufferMatcher(access_matcher, buffer_matcher, | 1205 return MakeMatcher(new IsLoadBufferMatcher(access_matcher, buffer_matcher, |
1142 offset_matcher, length_matcher, | 1206 offset_matcher, length_matcher, |
1143 effect_matcher, control_matcher)); | 1207 effect_matcher, control_matcher)); |
1144 } | 1208 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 IS_UNOP_MATCHER(Float64Ceil) | 1326 IS_UNOP_MATCHER(Float64Ceil) |
1263 IS_UNOP_MATCHER(Float64RoundTruncate) | 1327 IS_UNOP_MATCHER(Float64RoundTruncate) |
1264 IS_UNOP_MATCHER(Float64RoundTiesAway) | 1328 IS_UNOP_MATCHER(Float64RoundTiesAway) |
1265 IS_UNOP_MATCHER(NumberToInt32) | 1329 IS_UNOP_MATCHER(NumberToInt32) |
1266 IS_UNOP_MATCHER(NumberToUint32) | 1330 IS_UNOP_MATCHER(NumberToUint32) |
1267 #undef IS_UNOP_MATCHER | 1331 #undef IS_UNOP_MATCHER |
1268 | 1332 |
1269 } // namespace compiler | 1333 } // namespace compiler |
1270 } // namespace internal | 1334 } // namespace internal |
1271 } // namespace v8 | 1335 } // namespace v8 |
OLD | NEW |