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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 1336 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1337 return (NodeMatcher::MatchAndExplain(node, listener) && | 1337 return (NodeMatcher::MatchAndExplain(node, listener) && |
1338 PrintMatchAndExplain(OpParameter<MachineRepresentation>(node), | 1338 PrintMatchAndExplain(OpParameter<MachineRepresentation>(node), |
1339 "rep", rep_matcher_, listener)); | 1339 "rep", rep_matcher_, listener)); |
1340 } | 1340 } |
1341 | 1341 |
1342 private: | 1342 private: |
1343 const Matcher<MachineRepresentation> rep_matcher_; | 1343 const Matcher<MachineRepresentation> rep_matcher_; |
1344 }; | 1344 }; |
1345 | 1345 |
1346 class IsTypeGuardMatcher final : public NodeMatcher { | |
1347 public: | |
1348 IsTypeGuardMatcher(const Matcher<Type*>& type_matcher, | |
1349 const Matcher<Node*>& value_matcher, | |
1350 const Matcher<Node*>& control_matcher) | |
1351 : NodeMatcher(IrOpcode::kTypeGuard), | |
1352 type_matcher_(type_matcher), | |
1353 value_matcher_(value_matcher), | |
1354 control_matcher_(control_matcher) {} | |
1355 | |
1356 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
1357 return (NodeMatcher::MatchAndExplain(node, listener) && | |
1358 PrintMatchAndExplain(OpParameter<Type*>(node->op()), "type", | |
1359 type_matcher_, listener) && | |
1360 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
1361 "value", value_matcher_, listener) && | |
1362 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), | |
1363 "control", control_matcher_, listener)); | |
1364 } | |
1365 | |
1366 private: | |
1367 const Matcher<Type*> type_matcher_; | |
1368 const Matcher<Node*> value_matcher_; | |
1369 const Matcher<Node*> control_matcher_; | |
1370 }; | |
1371 | |
1372 class IsToNumberMatcher final : public NodeMatcher { | 1346 class IsToNumberMatcher final : public NodeMatcher { |
1373 public: | 1347 public: |
1374 IsToNumberMatcher(const Matcher<Node*>& base_matcher, | 1348 IsToNumberMatcher(const Matcher<Node*>& base_matcher, |
1375 const Matcher<Node*>& context_matcher, | 1349 const Matcher<Node*>& context_matcher, |
1376 const Matcher<Node*>& effect_matcher, | 1350 const Matcher<Node*>& effect_matcher, |
1377 const Matcher<Node*>& control_matcher) | 1351 const Matcher<Node*>& control_matcher) |
1378 : NodeMatcher(IrOpcode::kJSToNumber), | 1352 : NodeMatcher(IrOpcode::kJSToNumber), |
1379 base_matcher_(base_matcher), | 1353 base_matcher_(base_matcher), |
1380 context_matcher_(context_matcher), | 1354 context_matcher_(context_matcher), |
1381 effect_matcher_(effect_matcher), | 1355 effect_matcher_(effect_matcher), |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 value_matchers.push_back(value2_matcher); | 2016 value_matchers.push_back(value2_matcher); |
2043 value_matchers.push_back(value3_matcher); | 2017 value_matchers.push_back(value3_matcher); |
2044 value_matchers.push_back(value4_matcher); | 2018 value_matchers.push_back(value4_matcher); |
2045 value_matchers.push_back(value5_matcher); | 2019 value_matchers.push_back(value5_matcher); |
2046 value_matchers.push_back(value6_matcher); | 2020 value_matchers.push_back(value6_matcher); |
2047 value_matchers.push_back(value7_matcher); | 2021 value_matchers.push_back(value7_matcher); |
2048 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, | 2022 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, |
2049 effect_matcher, control_matcher)); | 2023 effect_matcher, control_matcher)); |
2050 } | 2024 } |
2051 | 2025 |
2052 Matcher<Node*> IsTypeGuard(const Matcher<Type*>& type_matcher, | |
2053 const Matcher<Node*>& value_matcher, | |
2054 const Matcher<Node*>& control_matcher) { | |
2055 return MakeMatcher( | |
2056 new IsTypeGuardMatcher(type_matcher, value_matcher, control_matcher)); | |
2057 } | |
2058 | |
2059 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, | 2026 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
2060 const Matcher<Node*>& lhs_matcher, | 2027 const Matcher<Node*>& lhs_matcher, |
2061 const Matcher<Node*>& rhs_matcher) { | 2028 const Matcher<Node*>& rhs_matcher) { |
2062 return MakeMatcher( | 2029 return MakeMatcher( |
2063 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); | 2030 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
2064 } | 2031 } |
2065 | 2032 |
2066 Matcher<Node*> IsSpeculativeNumberAdd( | 2033 Matcher<Node*> IsSpeculativeNumberAdd( |
2067 const Matcher<BinaryOperationHints::Hint>& hint_matcher, | 2034 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
2068 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, | 2035 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 IS_UNOP_MATCHER(ObjectIsSmi) | 2305 IS_UNOP_MATCHER(ObjectIsSmi) |
2339 IS_UNOP_MATCHER(StringFromCharCode) | 2306 IS_UNOP_MATCHER(StringFromCharCode) |
2340 IS_UNOP_MATCHER(Word32Clz) | 2307 IS_UNOP_MATCHER(Word32Clz) |
2341 IS_UNOP_MATCHER(Word32Ctz) | 2308 IS_UNOP_MATCHER(Word32Ctz) |
2342 IS_UNOP_MATCHER(Word32Popcnt) | 2309 IS_UNOP_MATCHER(Word32Popcnt) |
2343 #undef IS_UNOP_MATCHER | 2310 #undef IS_UNOP_MATCHER |
2344 | 2311 |
2345 } // namespace compiler | 2312 } // namespace compiler |
2346 } // namespace internal | 2313 } // namespace internal |
2347 } // namespace v8 | 2314 } // namespace v8 |
OLD | NEW |