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