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/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 | 10 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 "control", control_matcher_, listener)); | 455 "control", control_matcher_, listener)); |
456 } | 456 } |
457 | 457 |
458 private: | 458 private: |
459 const Matcher<Node*> effect0_matcher_; | 459 const Matcher<Node*> effect0_matcher_; |
460 const Matcher<Node*> effect1_matcher_; | 460 const Matcher<Node*> effect1_matcher_; |
461 const Matcher<Node*> control_matcher_; | 461 const Matcher<Node*> control_matcher_; |
462 }; | 462 }; |
463 | 463 |
464 | 464 |
| 465 class IsEffectSetMatcher FINAL : public NodeMatcher { |
| 466 public: |
| 467 IsEffectSetMatcher(const Matcher<Node*>& effect0_matcher, |
| 468 const Matcher<Node*>& effect1_matcher) |
| 469 : NodeMatcher(IrOpcode::kEffectSet), |
| 470 effect0_matcher_(effect0_matcher), |
| 471 effect1_matcher_(effect1_matcher) {} |
| 472 |
| 473 void DescribeTo(std::ostream* os) const FINAL { |
| 474 NodeMatcher::DescribeTo(os); |
| 475 *os << "), effect0 ("; |
| 476 effect0_matcher_.DescribeTo(os); |
| 477 *os << ") and effect1 ("; |
| 478 effect1_matcher_.DescribeTo(os); |
| 479 *os << ")"; |
| 480 } |
| 481 |
| 482 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { |
| 483 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 484 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0), |
| 485 "effect0", effect0_matcher_, listener) && |
| 486 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1), |
| 487 "effect1", effect1_matcher_, listener)); |
| 488 } |
| 489 |
| 490 private: |
| 491 const Matcher<Node*> effect0_matcher_; |
| 492 const Matcher<Node*> effect1_matcher_; |
| 493 }; |
| 494 |
| 495 |
465 class IsProjectionMatcher FINAL : public NodeMatcher { | 496 class IsProjectionMatcher FINAL : public NodeMatcher { |
466 public: | 497 public: |
467 IsProjectionMatcher(const Matcher<size_t>& index_matcher, | 498 IsProjectionMatcher(const Matcher<size_t>& index_matcher, |
468 const Matcher<Node*>& base_matcher) | 499 const Matcher<Node*>& base_matcher) |
469 : NodeMatcher(IrOpcode::kProjection), | 500 : NodeMatcher(IrOpcode::kProjection), |
470 index_matcher_(index_matcher), | 501 index_matcher_(index_matcher), |
471 base_matcher_(base_matcher) {} | 502 base_matcher_(base_matcher) {} |
472 | 503 |
473 void DescribeTo(std::ostream* os) const FINAL { | 504 void DescribeTo(std::ostream* os) const FINAL { |
474 NodeMatcher::DescribeTo(os); | 505 NodeMatcher::DescribeTo(os); |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1172 |
1142 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1173 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { |
1143 return (NodeMatcher::MatchAndExplain(node, listener) && | 1174 return (NodeMatcher::MatchAndExplain(node, listener) && |
1144 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 1175 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
1145 "input", input_matcher_, listener)); | 1176 "input", input_matcher_, listener)); |
1146 } | 1177 } |
1147 | 1178 |
1148 private: | 1179 private: |
1149 const Matcher<Node*> input_matcher_; | 1180 const Matcher<Node*> input_matcher_; |
1150 }; | 1181 }; |
| 1182 |
| 1183 } // namespace |
| 1184 |
| 1185 |
| 1186 Matcher<Node*> IsAlways() { |
| 1187 return MakeMatcher(new NodeMatcher(IrOpcode::kAlways)); |
1151 } | 1188 } |
1152 | 1189 |
1153 | 1190 |
| 1191 Matcher<Node*> IsEnd(const Matcher<Node*>& control_matcher) { |
| 1192 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control_matcher)); |
| 1193 } |
| 1194 |
| 1195 |
1154 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, | 1196 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
1155 const Matcher<Node*>& control_matcher) { | 1197 const Matcher<Node*>& control_matcher) { |
1156 return MakeMatcher(new IsBranchMatcher(value_matcher, control_matcher)); | 1198 return MakeMatcher(new IsBranchMatcher(value_matcher, control_matcher)); |
1157 } | 1199 } |
1158 | 1200 |
1159 | 1201 |
1160 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, | 1202 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, |
1161 const Matcher<Node*>& control1_matcher) { | 1203 const Matcher<Node*>& control1_matcher) { |
1162 return MakeMatcher(new IsControl2Matcher(IrOpcode::kMerge, control0_matcher, | 1204 return MakeMatcher(new IsControl2Matcher(IrOpcode::kMerge, control0_matcher, |
1163 control1_matcher)); | 1205 control1_matcher)); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 | 1325 |
1284 | 1326 |
1285 Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher, | 1327 Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher, |
1286 const Matcher<Node*>& effect1_matcher, | 1328 const Matcher<Node*>& effect1_matcher, |
1287 const Matcher<Node*>& merge_matcher) { | 1329 const Matcher<Node*>& merge_matcher) { |
1288 return MakeMatcher( | 1330 return MakeMatcher( |
1289 new IsEffectPhiMatcher(effect0_matcher, effect1_matcher, merge_matcher)); | 1331 new IsEffectPhiMatcher(effect0_matcher, effect1_matcher, merge_matcher)); |
1290 } | 1332 } |
1291 | 1333 |
1292 | 1334 |
| 1335 Matcher<Node*> IsEffectSet(const Matcher<Node*>& effect0_matcher, |
| 1336 const Matcher<Node*>& effect1_matcher) { |
| 1337 return MakeMatcher(new IsEffectSetMatcher(effect0_matcher, effect1_matcher)); |
| 1338 } |
| 1339 |
| 1340 |
1293 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher, | 1341 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher, |
1294 const Matcher<Node*>& base_matcher) { | 1342 const Matcher<Node*>& base_matcher) { |
1295 return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher)); | 1343 return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher)); |
1296 } | 1344 } |
1297 | 1345 |
1298 | 1346 |
1299 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, | 1347 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
1300 const Matcher<Node*>& value0_matcher, | 1348 const Matcher<Node*>& value0_matcher, |
1301 const Matcher<Node*>& value1_matcher, | 1349 const Matcher<Node*>& value1_matcher, |
1302 const Matcher<Node*>& effect_matcher, | 1350 const Matcher<Node*>& effect_matcher, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 IS_UNOP_MATCHER(Float64RoundTiesAway) | 1521 IS_UNOP_MATCHER(Float64RoundTiesAway) |
1474 IS_UNOP_MATCHER(NumberToInt32) | 1522 IS_UNOP_MATCHER(NumberToInt32) |
1475 IS_UNOP_MATCHER(NumberToUint32) | 1523 IS_UNOP_MATCHER(NumberToUint32) |
1476 IS_UNOP_MATCHER(ObjectIsSmi) | 1524 IS_UNOP_MATCHER(ObjectIsSmi) |
1477 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 1525 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
1478 #undef IS_UNOP_MATCHER | 1526 #undef IS_UNOP_MATCHER |
1479 | 1527 |
1480 } // namespace compiler | 1528 } // namespace compiler |
1481 } // namespace internal | 1529 } // namespace internal |
1482 } // namespace v8 | 1530 } // namespace v8 |
OLD | NEW |