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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 | 1323 |
1324 private: | 1324 private: |
1325 const Matcher<StoreRepresentation> rep_matcher_; | 1325 const Matcher<StoreRepresentation> rep_matcher_; |
1326 const Matcher<Node*> base_matcher_; | 1326 const Matcher<Node*> base_matcher_; |
1327 const Matcher<Node*> index_matcher_; | 1327 const Matcher<Node*> index_matcher_; |
1328 const Matcher<Node*> value_matcher_; | 1328 const Matcher<Node*> value_matcher_; |
1329 const Matcher<Node*> effect_matcher_; | 1329 const Matcher<Node*> effect_matcher_; |
1330 const Matcher<Node*> control_matcher_; | 1330 const Matcher<Node*> control_matcher_; |
1331 }; | 1331 }; |
1332 | 1332 |
| 1333 class IsStackSlotMatcher final : public NodeMatcher { |
| 1334 public: |
| 1335 explicit IsStackSlotMatcher(const Matcher<MachineRepresentation>& rep_matcher) |
| 1336 : NodeMatcher(IrOpcode::kStackSlot), rep_matcher_(rep_matcher) {} |
| 1337 |
| 1338 void DescribeTo(std::ostream* os) const final { |
| 1339 NodeMatcher::DescribeTo(os); |
| 1340 *os << " whose rep ("; |
| 1341 rep_matcher_.DescribeTo(os); |
| 1342 *os << ")"; |
| 1343 } |
| 1344 |
| 1345 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1346 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 1347 PrintMatchAndExplain(OpParameter<MachineRepresentation>(node), |
| 1348 "rep", rep_matcher_, listener)); |
| 1349 } |
| 1350 |
| 1351 private: |
| 1352 const Matcher<MachineRepresentation> rep_matcher_; |
| 1353 }; |
1333 | 1354 |
1334 class IsToNumberMatcher final : public NodeMatcher { | 1355 class IsToNumberMatcher final : public NodeMatcher { |
1335 public: | 1356 public: |
1336 IsToNumberMatcher(const Matcher<Node*>& base_matcher, | 1357 IsToNumberMatcher(const Matcher<Node*>& base_matcher, |
1337 const Matcher<Node*>& context_matcher, | 1358 const Matcher<Node*>& context_matcher, |
1338 const Matcher<Node*>& effect_matcher, | 1359 const Matcher<Node*>& effect_matcher, |
1339 const Matcher<Node*>& control_matcher) | 1360 const Matcher<Node*>& control_matcher) |
1340 : NodeMatcher(IrOpcode::kJSToNumber), | 1361 : NodeMatcher(IrOpcode::kJSToNumber), |
1341 base_matcher_(base_matcher), | 1362 base_matcher_(base_matcher), |
1342 context_matcher_(context_matcher), | 1363 context_matcher_(context_matcher), |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 const Matcher<Node*>& base_matcher, | 2137 const Matcher<Node*>& base_matcher, |
2117 const Matcher<Node*>& index_matcher, | 2138 const Matcher<Node*>& index_matcher, |
2118 const Matcher<Node*>& value_matcher, | 2139 const Matcher<Node*>& value_matcher, |
2119 const Matcher<Node*>& effect_matcher, | 2140 const Matcher<Node*>& effect_matcher, |
2120 const Matcher<Node*>& control_matcher) { | 2141 const Matcher<Node*>& control_matcher) { |
2121 return MakeMatcher(new IsStoreMatcher(rep_matcher, base_matcher, | 2142 return MakeMatcher(new IsStoreMatcher(rep_matcher, base_matcher, |
2122 index_matcher, value_matcher, | 2143 index_matcher, value_matcher, |
2123 effect_matcher, control_matcher)); | 2144 effect_matcher, control_matcher)); |
2124 } | 2145 } |
2125 | 2146 |
| 2147 Matcher<Node*> IsStackSlot(const Matcher<MachineRepresentation>& rep_matcher) { |
| 2148 return MakeMatcher(new IsStackSlotMatcher(rep_matcher)); |
| 2149 } |
2126 | 2150 |
2127 Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, | 2151 Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, |
2128 const Matcher<Node*>& context_matcher, | 2152 const Matcher<Node*>& context_matcher, |
2129 const Matcher<Node*>& effect_matcher, | 2153 const Matcher<Node*>& effect_matcher, |
2130 const Matcher<Node*>& control_matcher) { | 2154 const Matcher<Node*>& control_matcher) { |
2131 return MakeMatcher(new IsToNumberMatcher(base_matcher, context_matcher, | 2155 return MakeMatcher(new IsToNumberMatcher(base_matcher, context_matcher, |
2132 effect_matcher, control_matcher)); | 2156 effect_matcher, control_matcher)); |
2133 } | 2157 } |
2134 | 2158 |
2135 | 2159 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 IS_UNOP_MATCHER(NumberToUint32) | 2270 IS_UNOP_MATCHER(NumberToUint32) |
2247 IS_UNOP_MATCHER(ObjectIsReceiver) | 2271 IS_UNOP_MATCHER(ObjectIsReceiver) |
2248 IS_UNOP_MATCHER(ObjectIsSmi) | 2272 IS_UNOP_MATCHER(ObjectIsSmi) |
2249 IS_UNOP_MATCHER(Word32Clz) | 2273 IS_UNOP_MATCHER(Word32Clz) |
2250 IS_UNOP_MATCHER(Word32Popcnt) | 2274 IS_UNOP_MATCHER(Word32Popcnt) |
2251 #undef IS_UNOP_MATCHER | 2275 #undef IS_UNOP_MATCHER |
2252 | 2276 |
2253 } // namespace compiler | 2277 } // namespace compiler |
2254 } // namespace internal | 2278 } // namespace internal |
2255 } // namespace v8 | 2279 } // namespace v8 |
OLD | NEW |