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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 1345 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1346 return (NodeMatcher::MatchAndExplain(node, listener) && | 1346 return (NodeMatcher::MatchAndExplain(node, listener) && |
1347 PrintMatchAndExplain(OpParameter<MachineRepresentation>(node), | 1347 PrintMatchAndExplain(OpParameter<MachineRepresentation>(node), |
1348 "rep", rep_matcher_, listener)); | 1348 "rep", rep_matcher_, listener)); |
1349 } | 1349 } |
1350 | 1350 |
1351 private: | 1351 private: |
1352 const Matcher<MachineRepresentation> rep_matcher_; | 1352 const Matcher<MachineRepresentation> rep_matcher_; |
1353 }; | 1353 }; |
1354 | 1354 |
| 1355 class IsGuardMatcher final : public NodeMatcher { |
| 1356 public: |
| 1357 IsGuardMatcher(const Matcher<Type*>& type_matcher, |
| 1358 const Matcher<Node*>& value_matcher, |
| 1359 const Matcher<Node*>& control_matcher) |
| 1360 : NodeMatcher(IrOpcode::kGuard), |
| 1361 type_matcher_(type_matcher), |
| 1362 value_matcher_(value_matcher), |
| 1363 control_matcher_(control_matcher) {} |
| 1364 |
| 1365 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1366 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 1367 PrintMatchAndExplain(OpParameter<Type*>(node->op()), "type", |
| 1368 type_matcher_, listener) && |
| 1369 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 1370 "value", value_matcher_, listener) && |
| 1371 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), |
| 1372 "control", control_matcher_, listener)); |
| 1373 } |
| 1374 |
| 1375 private: |
| 1376 const Matcher<Type*> type_matcher_; |
| 1377 const Matcher<Node*> value_matcher_; |
| 1378 const Matcher<Node*> control_matcher_; |
| 1379 }; |
| 1380 |
1355 class IsToNumberMatcher final : public NodeMatcher { | 1381 class IsToNumberMatcher final : public NodeMatcher { |
1356 public: | 1382 public: |
1357 IsToNumberMatcher(const Matcher<Node*>& base_matcher, | 1383 IsToNumberMatcher(const Matcher<Node*>& base_matcher, |
1358 const Matcher<Node*>& context_matcher, | 1384 const Matcher<Node*>& context_matcher, |
1359 const Matcher<Node*>& effect_matcher, | 1385 const Matcher<Node*>& effect_matcher, |
1360 const Matcher<Node*>& control_matcher) | 1386 const Matcher<Node*>& control_matcher) |
1361 : NodeMatcher(IrOpcode::kJSToNumber), | 1387 : NodeMatcher(IrOpcode::kJSToNumber), |
1362 base_matcher_(base_matcher), | 1388 base_matcher_(base_matcher), |
1363 context_matcher_(context_matcher), | 1389 context_matcher_(context_matcher), |
1364 effect_matcher_(effect_matcher), | 1390 effect_matcher_(effect_matcher), |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 value_matchers.push_back(value2_matcher); | 2057 value_matchers.push_back(value2_matcher); |
2032 value_matchers.push_back(value3_matcher); | 2058 value_matchers.push_back(value3_matcher); |
2033 value_matchers.push_back(value4_matcher); | 2059 value_matchers.push_back(value4_matcher); |
2034 value_matchers.push_back(value5_matcher); | 2060 value_matchers.push_back(value5_matcher); |
2035 value_matchers.push_back(value6_matcher); | 2061 value_matchers.push_back(value6_matcher); |
2036 value_matchers.push_back(value7_matcher); | 2062 value_matchers.push_back(value7_matcher); |
2037 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, | 2063 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, |
2038 effect_matcher, control_matcher)); | 2064 effect_matcher, control_matcher)); |
2039 } | 2065 } |
2040 | 2066 |
| 2067 Matcher<Node*> IsGuard(const Matcher<Type*>& type_matcher, |
| 2068 const Matcher<Node*>& value_matcher, |
| 2069 const Matcher<Node*>& control_matcher) { |
| 2070 return MakeMatcher( |
| 2071 new IsGuardMatcher(type_matcher, value_matcher, control_matcher)); |
| 2072 } |
2041 | 2073 |
2042 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, | 2074 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
2043 const Matcher<Node*>& lhs_matcher, | 2075 const Matcher<Node*>& lhs_matcher, |
2044 const Matcher<Node*>& rhs_matcher) { | 2076 const Matcher<Node*>& rhs_matcher) { |
2045 return MakeMatcher( | 2077 return MakeMatcher( |
2046 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); | 2078 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
2047 } | 2079 } |
2048 | 2080 |
2049 | 2081 |
2050 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, | 2082 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 IS_UNOP_MATCHER(ObjectIsReceiver) | 2304 IS_UNOP_MATCHER(ObjectIsReceiver) |
2273 IS_UNOP_MATCHER(ObjectIsSmi) | 2305 IS_UNOP_MATCHER(ObjectIsSmi) |
2274 IS_UNOP_MATCHER(Word32Clz) | 2306 IS_UNOP_MATCHER(Word32Clz) |
2275 IS_UNOP_MATCHER(Word32Ctz) | 2307 IS_UNOP_MATCHER(Word32Ctz) |
2276 IS_UNOP_MATCHER(Word32Popcnt) | 2308 IS_UNOP_MATCHER(Word32Popcnt) |
2277 #undef IS_UNOP_MATCHER | 2309 #undef IS_UNOP_MATCHER |
2278 | 2310 |
2279 } // namespace compiler | 2311 } // namespace compiler |
2280 } // namespace internal | 2312 } // namespace internal |
2281 } // namespace v8 | 2313 } // namespace v8 |
OLD | NEW |