| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 | 1408 |
| 1409 | 1409 |
| 1410 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher, | 1410 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher, |
| 1411 const Matcher<Node*>& effect_matcher, | 1411 const Matcher<Node*>& effect_matcher, |
| 1412 const Matcher<Node*>& control_matcher) { | 1412 const Matcher<Node*>& control_matcher) { |
| 1413 return MakeMatcher( | 1413 return MakeMatcher( |
| 1414 new IsReturnMatcher(value_matcher, effect_matcher, control_matcher)); | 1414 new IsReturnMatcher(value_matcher, effect_matcher, control_matcher)); |
| 1415 } | 1415 } |
| 1416 | 1416 |
| 1417 | 1417 |
| 1418 class IsDeoptimizeMatcher final : public NodeMatcher { |
| 1419 public: |
| 1420 IsDeoptimizeMatcher(const Matcher<Node*>& frame_state_matcher, |
| 1421 const Matcher<Node*>& effect_matcher, |
| 1422 const Matcher<Node*>& control_matcher) |
| 1423 : NodeMatcher(IrOpcode::kDeoptimize), |
| 1424 frame_state_matcher_(frame_state_matcher), |
| 1425 effect_matcher_(effect_matcher), |
| 1426 control_matcher_(control_matcher) {} |
| 1427 |
| 1428 void DescribeTo(std::ostream* os) const final { |
| 1429 NodeMatcher::DescribeTo(os); |
| 1430 *os << " whose frame_state ("; |
| 1431 frame_state_matcher_.DescribeTo(os); |
| 1432 *os << ") and effect ("; |
| 1433 effect_matcher_.DescribeTo(os); |
| 1434 *os << ") and control ("; |
| 1435 control_matcher_.DescribeTo(os); |
| 1436 *os << ")"; |
| 1437 } |
| 1438 |
| 1439 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1440 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 1441 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 1442 "frame_state", frame_state_matcher_, |
| 1443 listener) && |
| 1444 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 1445 effect_matcher_, listener) && |
| 1446 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 1447 "control", control_matcher_, listener)); |
| 1448 } |
| 1449 |
| 1450 private: |
| 1451 const Matcher<Node*> frame_state_matcher_; |
| 1452 const Matcher<Node*> effect_matcher_; |
| 1453 const Matcher<Node*> control_matcher_; |
| 1454 }; |
| 1455 |
| 1456 |
| 1457 Matcher<Node*> IsDeoptimize(const Matcher<Node*>& frame_state_matcher, |
| 1458 const Matcher<Node*>& effect_matcher, |
| 1459 const Matcher<Node*>& control_matcher) { |
| 1460 return MakeMatcher(new IsDeoptimizeMatcher(frame_state_matcher, |
| 1461 effect_matcher, control_matcher)); |
| 1462 } |
| 1463 |
| 1464 |
| 1418 Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher, | 1465 Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher, |
| 1419 const Matcher<Node*>& control_matcher) { | 1466 const Matcher<Node*>& control_matcher) { |
| 1420 return MakeMatcher(new IsTerminateMatcher(effect_matcher, control_matcher)); | 1467 return MakeMatcher(new IsTerminateMatcher(effect_matcher, control_matcher)); |
| 1421 } | 1468 } |
| 1422 | 1469 |
| 1423 | 1470 |
| 1424 Matcher<Node*> IsExternalConstant( | 1471 Matcher<Node*> IsExternalConstant( |
| 1425 const Matcher<ExternalReference>& value_matcher) { | 1472 const Matcher<ExternalReference>& value_matcher) { |
| 1426 return MakeMatcher(new IsConstantMatcher<ExternalReference>( | 1473 return MakeMatcher(new IsConstantMatcher<ExternalReference>( |
| 1427 IrOpcode::kExternalConstant, value_matcher)); | 1474 IrOpcode::kExternalConstant, value_matcher)); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 IS_UNOP_MATCHER(NumberToInt32) | 1817 IS_UNOP_MATCHER(NumberToInt32) |
| 1771 IS_UNOP_MATCHER(NumberToUint32) | 1818 IS_UNOP_MATCHER(NumberToUint32) |
| 1772 IS_UNOP_MATCHER(ObjectIsSmi) | 1819 IS_UNOP_MATCHER(ObjectIsSmi) |
| 1773 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 1820 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
| 1774 IS_UNOP_MATCHER(Word32Clz) | 1821 IS_UNOP_MATCHER(Word32Clz) |
| 1775 #undef IS_UNOP_MATCHER | 1822 #undef IS_UNOP_MATCHER |
| 1776 | 1823 |
| 1777 } // namespace compiler | 1824 } // namespace compiler |
| 1778 } // namespace internal | 1825 } // namespace internal |
| 1779 } // namespace v8 | 1826 } // namespace v8 |
| OLD | NEW |