| 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/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 "control2", control2_matcher_, listener)); | 254 "control2", control2_matcher_, listener)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 private: | 257 private: |
| 258 const Matcher<Node*> control0_matcher_; | 258 const Matcher<Node*> control0_matcher_; |
| 259 const Matcher<Node*> control1_matcher_; | 259 const Matcher<Node*> control1_matcher_; |
| 260 const Matcher<Node*> control2_matcher_; | 260 const Matcher<Node*> control2_matcher_; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 | 263 |
| 264 class IsFinishMatcher final : public NodeMatcher { | 264 class IsBeginRegionMatcher final : public NodeMatcher { |
| 265 public: | 265 public: |
| 266 IsFinishMatcher(const Matcher<Node*>& value_matcher, | 266 explicit IsBeginRegionMatcher(const Matcher<Node*>& effect_matcher) |
| 267 const Matcher<Node*>& effect_matcher) | 267 : NodeMatcher(IrOpcode::kBeginRegion), effect_matcher_(effect_matcher) {} |
| 268 : NodeMatcher(IrOpcode::kFinish), | 268 |
| 269 void DescribeTo(std::ostream* os) const final { |
| 270 NodeMatcher::DescribeTo(os); |
| 271 *os << " whose effect ("; |
| 272 effect_matcher_.DescribeTo(os); |
| 273 *os << ")"; |
| 274 } |
| 275 |
| 276 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 277 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 278 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 279 effect_matcher_, listener)); |
| 280 } |
| 281 |
| 282 private: |
| 283 const Matcher<Node*> effect_matcher_; |
| 284 }; |
| 285 |
| 286 |
| 287 class IsFinishRegionMatcher final : public NodeMatcher { |
| 288 public: |
| 289 IsFinishRegionMatcher(const Matcher<Node*>& value_matcher, |
| 290 const Matcher<Node*>& effect_matcher) |
| 291 : NodeMatcher(IrOpcode::kFinishRegion), |
| 269 value_matcher_(value_matcher), | 292 value_matcher_(value_matcher), |
| 270 effect_matcher_(effect_matcher) {} | 293 effect_matcher_(effect_matcher) {} |
| 271 | 294 |
| 272 void DescribeTo(std::ostream* os) const final { | 295 void DescribeTo(std::ostream* os) const final { |
| 273 NodeMatcher::DescribeTo(os); | 296 NodeMatcher::DescribeTo(os); |
| 274 *os << " whose value ("; | 297 *os << " whose value ("; |
| 275 value_matcher_.DescribeTo(os); | 298 value_matcher_.DescribeTo(os); |
| 276 *os << ") and effect ("; | 299 *os << ") and effect ("; |
| 277 effect_matcher_.DescribeTo(os); | 300 effect_matcher_.DescribeTo(os); |
| 278 *os << ")"; | 301 *os << ")"; |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 return MakeMatcher(new IsIfValueMatcher(value_matcher, control_matcher)); | 1517 return MakeMatcher(new IsIfValueMatcher(value_matcher, control_matcher)); |
| 1495 } | 1518 } |
| 1496 | 1519 |
| 1497 | 1520 |
| 1498 Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher) { | 1521 Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher) { |
| 1499 return MakeMatcher( | 1522 return MakeMatcher( |
| 1500 new IsControl1Matcher(IrOpcode::kIfDefault, control_matcher)); | 1523 new IsControl1Matcher(IrOpcode::kIfDefault, control_matcher)); |
| 1501 } | 1524 } |
| 1502 | 1525 |
| 1503 | 1526 |
| 1504 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher) { | 1527 Matcher<Node*> IsBeginRegion(const Matcher<Node*>& effect_matcher) { |
| 1505 return MakeMatcher(new IsUnopMatcher(IrOpcode::kValueEffect, value_matcher)); | 1528 return MakeMatcher(new IsBeginRegionMatcher(effect_matcher)); |
| 1506 } | 1529 } |
| 1507 | 1530 |
| 1508 | 1531 |
| 1509 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, | 1532 Matcher<Node*> IsFinishRegion(const Matcher<Node*>& value_matcher, |
| 1510 const Matcher<Node*>& effect_matcher) { | 1533 const Matcher<Node*>& effect_matcher) { |
| 1511 return MakeMatcher(new IsFinishMatcher(value_matcher, effect_matcher)); | 1534 return MakeMatcher(new IsFinishRegionMatcher(value_matcher, effect_matcher)); |
| 1512 } | 1535 } |
| 1513 | 1536 |
| 1514 | 1537 |
| 1515 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher, | 1538 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher, |
| 1516 const Matcher<Node*>& effect_matcher, | 1539 const Matcher<Node*>& effect_matcher, |
| 1517 const Matcher<Node*>& control_matcher) { | 1540 const Matcher<Node*>& control_matcher) { |
| 1518 return MakeMatcher( | 1541 return MakeMatcher( |
| 1519 new IsReturnMatcher(value_matcher, effect_matcher, control_matcher)); | 1542 new IsReturnMatcher(value_matcher, effect_matcher, control_matcher)); |
| 1520 } | 1543 } |
| 1521 | 1544 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 IS_UNOP_MATCHER(Float64ExtractHighWord32) | 2071 IS_UNOP_MATCHER(Float64ExtractHighWord32) |
| 2049 IS_UNOP_MATCHER(NumberToInt32) | 2072 IS_UNOP_MATCHER(NumberToInt32) |
| 2050 IS_UNOP_MATCHER(NumberToUint32) | 2073 IS_UNOP_MATCHER(NumberToUint32) |
| 2051 IS_UNOP_MATCHER(ObjectIsSmi) | 2074 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2052 IS_UNOP_MATCHER(Word32Clz) | 2075 IS_UNOP_MATCHER(Word32Clz) |
| 2053 #undef IS_UNOP_MATCHER | 2076 #undef IS_UNOP_MATCHER |
| 2054 | 2077 |
| 2055 } // namespace compiler | 2078 } // namespace compiler |
| 2056 } // namespace internal | 2079 } // namespace internal |
| 2057 } // namespace v8 | 2080 } // namespace v8 |
| OLD | NEW |