| 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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 return (NodeMatcher::MatchAndExplain(node, listener) && | 1421 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 1422 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index", | 1422 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index", |
| 1423 index_matcher_, listener)); | 1423 index_matcher_, listener)); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 private: | 1426 private: |
| 1427 const Matcher<int> index_matcher_; | 1427 const Matcher<int> index_matcher_; |
| 1428 }; | 1428 }; |
| 1429 | 1429 |
| 1430 | 1430 |
| 1431 class IsJSDeletePropertyMatcher final : public NodeMatcher { |
| 1432 public: |
| 1433 IsJSDeletePropertyMatcher(const Matcher<Node*>& object_value_matcher, |
| 1434 const Matcher<Node*>& key_matcher, |
| 1435 const Matcher<Node*>& effect_matcher, |
| 1436 const Matcher<Node*>& control_matcher) |
| 1437 : NodeMatcher(IrOpcode::kJSDeleteProperty), |
| 1438 object_value_matcher_(object_value_matcher), |
| 1439 key_matcher_(key_matcher), |
| 1440 effect_matcher_(effect_matcher), |
| 1441 control_matcher_(control_matcher) {} |
| 1442 |
| 1443 void DescribeTo(std::ostream* os) const final { |
| 1444 NodeMatcher::DescribeTo(os); |
| 1445 *os << " whose object ("; |
| 1446 object_value_matcher_.DescribeTo(os); |
| 1447 *os << "), key ("; |
| 1448 key_matcher_.DescribeTo(os); |
| 1449 *os << "), effect ("; |
| 1450 effect_matcher_.DescribeTo(os); |
| 1451 *os << "), and control ("; |
| 1452 control_matcher_.DescribeTo(os); |
| 1453 *os << ")"; |
| 1454 } |
| 1455 |
| 1456 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1457 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 1458 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 1459 "object", object_value_matcher_, listener) && |
| 1460 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "key", |
| 1461 key_matcher_, listener) && |
| 1462 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 1463 effect_matcher_, listener) && |
| 1464 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 1465 "control", control_matcher_, listener)); |
| 1466 } |
| 1467 |
| 1468 private: |
| 1469 const Matcher<Node*> object_value_matcher_; |
| 1470 const Matcher<Node*> key_matcher_; |
| 1471 const Matcher<Node*> effect_matcher_; |
| 1472 const Matcher<Node*> control_matcher_; |
| 1473 }; |
| 1474 |
| 1475 |
| 1431 // TODO(mythria): Check if we can use the same matcher for Load and Store | 1476 // TODO(mythria): Check if we can use the same matcher for Load and Store |
| 1432 class IsJSLoadNamedMatcher final : public NodeMatcher { | 1477 class IsJSLoadNamedMatcher final : public NodeMatcher { |
| 1433 public: | 1478 public: |
| 1434 IsJSLoadNamedMatcher(const Matcher<Handle<Name>>& name_matcher, | 1479 IsJSLoadNamedMatcher(const Matcher<Handle<Name>>& name_matcher, |
| 1435 const Matcher<Node*>& object_value_matcher, | 1480 const Matcher<Node*>& object_value_matcher, |
| 1436 const Matcher<Node*>& feedback_vector_matcher, | 1481 const Matcher<Node*>& feedback_vector_matcher, |
| 1437 const Matcher<Node*>& effect_matcher, | 1482 const Matcher<Node*>& effect_matcher, |
| 1438 const Matcher<Node*>& control_matcher) | 1483 const Matcher<Node*>& control_matcher) |
| 1439 : NodeMatcher(IrOpcode::kJSLoadNamed), | 1484 : NodeMatcher(IrOpcode::kJSLoadNamed), |
| 1440 name_matcher_(name_matcher), | 1485 name_matcher_(name_matcher), |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) { | 2254 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) { |
| 2210 return MakeMatcher(new IsParameterMatcher(index_matcher)); | 2255 return MakeMatcher(new IsParameterMatcher(index_matcher)); |
| 2211 } | 2256 } |
| 2212 | 2257 |
| 2213 | 2258 |
| 2214 Matcher<Node*> IsLoadFramePointer() { | 2259 Matcher<Node*> IsLoadFramePointer() { |
| 2215 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer)); | 2260 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer)); |
| 2216 } | 2261 } |
| 2217 | 2262 |
| 2218 | 2263 |
| 2264 Matcher<Node*> IsJSDeleteProperty(const Matcher<Node*>& object_value_matcher, |
| 2265 const Matcher<Node*>& key_matcher, |
| 2266 const Matcher<Node*>& effect_matcher, |
| 2267 const Matcher<Node*>& control_matcher) { |
| 2268 return MakeMatcher(new IsJSDeletePropertyMatcher( |
| 2269 object_value_matcher, key_matcher, effect_matcher, control_matcher)); |
| 2270 } |
| 2271 |
| 2272 |
| 2219 Matcher<Node*> IsJSLoadNamed(const Handle<Name> name, | 2273 Matcher<Node*> IsJSLoadNamed(const Handle<Name> name, |
| 2220 const Matcher<Node*>& object_value_matcher, | 2274 const Matcher<Node*>& object_value_matcher, |
| 2221 const Matcher<Node*>& feedback_vector_matcher, | 2275 const Matcher<Node*>& feedback_vector_matcher, |
| 2222 const Matcher<Node*>& effect_matcher, | 2276 const Matcher<Node*>& effect_matcher, |
| 2223 const Matcher<Node*>& control_matcher) { | 2277 const Matcher<Node*>& control_matcher) { |
| 2224 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher, | 2278 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher, |
| 2225 feedback_vector_matcher, | 2279 feedback_vector_matcher, |
| 2226 effect_matcher, control_matcher)); | 2280 effect_matcher, control_matcher)); |
| 2227 } | 2281 } |
| 2228 | 2282 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 IS_UNOP_MATCHER(Float64Sqrt) | 2382 IS_UNOP_MATCHER(Float64Sqrt) |
| 2329 IS_UNOP_MATCHER(Float64RoundDown) | 2383 IS_UNOP_MATCHER(Float64RoundDown) |
| 2330 IS_UNOP_MATCHER(Float64RoundTruncate) | 2384 IS_UNOP_MATCHER(Float64RoundTruncate) |
| 2331 IS_UNOP_MATCHER(Float64RoundTiesAway) | 2385 IS_UNOP_MATCHER(Float64RoundTiesAway) |
| 2332 IS_UNOP_MATCHER(Float64ExtractLowWord32) | 2386 IS_UNOP_MATCHER(Float64ExtractLowWord32) |
| 2333 IS_UNOP_MATCHER(Float64ExtractHighWord32) | 2387 IS_UNOP_MATCHER(Float64ExtractHighWord32) |
| 2334 IS_UNOP_MATCHER(NumberToInt32) | 2388 IS_UNOP_MATCHER(NumberToInt32) |
| 2335 IS_UNOP_MATCHER(NumberToUint32) | 2389 IS_UNOP_MATCHER(NumberToUint32) |
| 2336 IS_UNOP_MATCHER(ObjectIsSmi) | 2390 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2337 IS_UNOP_MATCHER(Word32Clz) | 2391 IS_UNOP_MATCHER(Word32Clz) |
| 2392 IS_UNOP_MATCHER(JSUnaryNot) |
| 2393 IS_UNOP_MATCHER(JSTypeOf) |
| 2338 #undef IS_UNOP_MATCHER | 2394 #undef IS_UNOP_MATCHER |
| 2339 | 2395 |
| 2340 } // namespace compiler | 2396 } // namespace compiler |
| 2341 } // namespace internal | 2397 } // namespace internal |
| 2342 } // namespace v8 | 2398 } // namespace v8 |
| OLD | NEW |