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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 const Matcher<Node*> value_matcher_; \ | 1332 const Matcher<Node*> value_matcher_; \ |
1333 const Matcher<Node*> effect_matcher_; \ | 1333 const Matcher<Node*> effect_matcher_; \ |
1334 const Matcher<Node*> control_matcher_; \ | 1334 const Matcher<Node*> control_matcher_; \ |
1335 }; | 1335 }; |
1336 | 1336 |
1337 STORE_MATCHER(Store) | 1337 STORE_MATCHER(Store) |
1338 STORE_MATCHER(UnalignedStore) | 1338 STORE_MATCHER(UnalignedStore) |
1339 | 1339 |
1340 class IsStackSlotMatcher final : public NodeMatcher { | 1340 class IsStackSlotMatcher final : public NodeMatcher { |
1341 public: | 1341 public: |
1342 explicit IsStackSlotMatcher(const Matcher<int>& size_matcher) | 1342 explicit IsStackSlotMatcher( |
1343 : NodeMatcher(IrOpcode::kStackSlot), size_matcher_(size_matcher) {} | 1343 const Matcher<StackSlotRepresentation>& rep_matcher) |
| 1344 : NodeMatcher(IrOpcode::kStackSlot), rep_matcher_(rep_matcher) {} |
1344 | 1345 |
1345 void DescribeTo(std::ostream* os) const final { | 1346 void DescribeTo(std::ostream* os) const final { |
1346 NodeMatcher::DescribeTo(os); | 1347 NodeMatcher::DescribeTo(os); |
1347 *os << " whose size ("; | 1348 *os << " whose rep ("; |
1348 size_matcher_.DescribeTo(os); | 1349 rep_matcher_.DescribeTo(os); |
1349 *os << ")"; | 1350 *os << ")"; |
1350 } | 1351 } |
1351 | 1352 |
1352 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 1353 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1353 return (NodeMatcher::MatchAndExplain(node, listener) && | 1354 return (NodeMatcher::MatchAndExplain(node, listener) && |
1354 PrintMatchAndExplain(OpParameter<int>(node), "size", size_matcher_, | 1355 PrintMatchAndExplain(OpParameter<StackSlotRepresentation>(node), |
1355 listener)); | 1356 "rep", rep_matcher_, listener)); |
1356 } | 1357 } |
1357 | 1358 |
1358 private: | 1359 private: |
1359 const Matcher<int> size_matcher_; | 1360 const Matcher<StackSlotRepresentation> rep_matcher_; |
1360 }; | 1361 }; |
1361 | 1362 |
1362 class IsToNumberMatcher final : public NodeMatcher { | 1363 class IsToNumberMatcher final : public NodeMatcher { |
1363 public: | 1364 public: |
1364 IsToNumberMatcher(const Matcher<Node*>& base_matcher, | 1365 IsToNumberMatcher(const Matcher<Node*>& base_matcher, |
1365 const Matcher<Node*>& context_matcher, | 1366 const Matcher<Node*>& context_matcher, |
1366 const Matcher<Node*>& effect_matcher, | 1367 const Matcher<Node*>& effect_matcher, |
1367 const Matcher<Node*>& control_matcher) | 1368 const Matcher<Node*>& control_matcher) |
1368 : NodeMatcher(IrOpcode::kJSToNumber), | 1369 : NodeMatcher(IrOpcode::kJSToNumber), |
1369 base_matcher_(base_matcher), | 1370 base_matcher_(base_matcher), |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 Matcher<Node*> IsUnalignedStore( | 2169 Matcher<Node*> IsUnalignedStore( |
2169 const Matcher<UnalignedStoreRepresentation>& rep_matcher, | 2170 const Matcher<UnalignedStoreRepresentation>& rep_matcher, |
2170 const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher, | 2171 const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher, |
2171 const Matcher<Node*>& value_matcher, const Matcher<Node*>& effect_matcher, | 2172 const Matcher<Node*>& value_matcher, const Matcher<Node*>& effect_matcher, |
2172 const Matcher<Node*>& control_matcher) { | 2173 const Matcher<Node*>& control_matcher) { |
2173 return MakeMatcher(new IsUnalignedStoreMatcher( | 2174 return MakeMatcher(new IsUnalignedStoreMatcher( |
2174 rep_matcher, base_matcher, index_matcher, value_matcher, effect_matcher, | 2175 rep_matcher, base_matcher, index_matcher, value_matcher, effect_matcher, |
2175 control_matcher)); | 2176 control_matcher)); |
2176 } | 2177 } |
2177 | 2178 |
2178 Matcher<Node*> IsStackSlot(const Matcher<int>& size_matcher) { | 2179 Matcher<Node*> IsStackSlot( |
2179 return MakeMatcher(new IsStackSlotMatcher(size_matcher)); | 2180 const Matcher<StackSlotRepresentation>& rep_matcher) { |
| 2181 return MakeMatcher(new IsStackSlotMatcher(rep_matcher)); |
2180 } | 2182 } |
2181 | 2183 |
2182 Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, | 2184 Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, |
2183 const Matcher<Node*>& context_matcher, | 2185 const Matcher<Node*>& context_matcher, |
2184 const Matcher<Node*>& effect_matcher, | 2186 const Matcher<Node*>& effect_matcher, |
2185 const Matcher<Node*>& control_matcher) { | 2187 const Matcher<Node*>& control_matcher) { |
2186 return MakeMatcher(new IsToNumberMatcher(base_matcher, context_matcher, | 2188 return MakeMatcher(new IsToNumberMatcher(base_matcher, context_matcher, |
2187 effect_matcher, control_matcher)); | 2189 effect_matcher, control_matcher)); |
2188 } | 2190 } |
2189 | 2191 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2355 IS_UNOP_MATCHER(StringFromCharCode) | 2357 IS_UNOP_MATCHER(StringFromCharCode) |
2356 IS_UNOP_MATCHER(Word32Clz) | 2358 IS_UNOP_MATCHER(Word32Clz) |
2357 IS_UNOP_MATCHER(Word32Ctz) | 2359 IS_UNOP_MATCHER(Word32Ctz) |
2358 IS_UNOP_MATCHER(Word32Popcnt) | 2360 IS_UNOP_MATCHER(Word32Popcnt) |
2359 IS_UNOP_MATCHER(Word32ReverseBytes) | 2361 IS_UNOP_MATCHER(Word32ReverseBytes) |
2360 #undef IS_UNOP_MATCHER | 2362 #undef IS_UNOP_MATCHER |
2361 | 2363 |
2362 } // namespace compiler | 2364 } // namespace compiler |
2363 } // namespace internal | 2365 } // namespace internal |
2364 } // namespace v8 | 2366 } // namespace v8 |
OLD | NEW |