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 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 private: | 1798 private: |
1799 const Matcher<Node*> object_matcher_; | 1799 const Matcher<Node*> object_matcher_; |
1800 const Matcher<Node*> key_matcher_; | 1800 const Matcher<Node*> key_matcher_; |
1801 const Matcher<Node*> value_matcher_; | 1801 const Matcher<Node*> value_matcher_; |
1802 const Matcher<Node*> feedback_vector_matcher_; | 1802 const Matcher<Node*> feedback_vector_matcher_; |
1803 const Matcher<Node*> effect_matcher_; | 1803 const Matcher<Node*> effect_matcher_; |
1804 const Matcher<Node*> control_matcher_; | 1804 const Matcher<Node*> control_matcher_; |
1805 }; | 1805 }; |
1806 | 1806 |
1807 | 1807 |
1808 class IsJSCallFunctionMatcher final : public NodeMatcher { | 1808 class IsJSCallMatcher final : public NodeMatcher { |
1809 public: | 1809 public: |
1810 IsJSCallFunctionMatcher(const std::vector<Matcher<Node*>>& value_matchers, | 1810 IsJSCallMatcher(IrOpcode::Value op_code, |
1811 const Matcher<Node*>& effect_matcher, | 1811 const std::vector<Matcher<Node*>>& value_matchers, |
1812 const Matcher<Node*>& control_matcher) | 1812 const Matcher<Node*>& effect_matcher, |
1813 : NodeMatcher(IrOpcode::kJSCallFunction), | 1813 const Matcher<Node*>& control_matcher) |
| 1814 : NodeMatcher(op_code), |
1814 value_matchers_(value_matchers), | 1815 value_matchers_(value_matchers), |
1815 effect_matcher_(effect_matcher), | 1816 effect_matcher_(effect_matcher), |
1816 control_matcher_(control_matcher) {} | 1817 control_matcher_(control_matcher) {} |
1817 | 1818 |
1818 void DescribeTo(std::ostream* os) const final { | 1819 void DescribeTo(std::ostream* os) const final { |
1819 NodeMatcher::DescribeTo(os); | 1820 NodeMatcher::DescribeTo(os); |
1820 for (size_t i = 0; i < value_matchers_.size(); ++i) { | 1821 for (size_t i = 0; i < value_matchers_.size(); ++i) { |
1821 if (i == 0) { | 1822 if (i == 0) { |
1822 *os << " whose value0 ("; | 1823 *os << " whose value0 ("; |
1823 } else { | 1824 } else { |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 const Matcher<Node*>& value_matcher, | 2466 const Matcher<Node*>& value_matcher, |
2466 const Matcher<Node*>& feedback_vector_matcher, | 2467 const Matcher<Node*>& feedback_vector_matcher, |
2467 const Matcher<Node*>& effect_matcher, | 2468 const Matcher<Node*>& effect_matcher, |
2468 const Matcher<Node*>& control_matcher) { | 2469 const Matcher<Node*>& control_matcher) { |
2469 return MakeMatcher( | 2470 return MakeMatcher( |
2470 new IsJSStoreGlobalMatcher(name, value_matcher, feedback_vector_matcher, | 2471 new IsJSStoreGlobalMatcher(name, value_matcher, feedback_vector_matcher, |
2471 effect_matcher, control_matcher)); | 2472 effect_matcher, control_matcher)); |
2472 } | 2473 } |
2473 | 2474 |
2474 | 2475 |
| 2476 Matcher<Node*> IsJSCallConstruct(std::vector<Matcher<Node*>> value_matchers, |
| 2477 const Matcher<Node*>& effect_matcher, |
| 2478 const Matcher<Node*>& control_matcher) { |
| 2479 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallConstruct, |
| 2480 value_matchers, effect_matcher, |
| 2481 control_matcher)); |
| 2482 } |
| 2483 |
| 2484 |
2475 Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers, | 2485 Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers, |
2476 const Matcher<Node*>& effect_matcher, | 2486 const Matcher<Node*>& effect_matcher, |
2477 const Matcher<Node*>& control_matcher) { | 2487 const Matcher<Node*>& control_matcher) { |
2478 return MakeMatcher(new IsJSCallFunctionMatcher(value_matchers, effect_matcher, | 2488 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallFunction, |
2479 control_matcher)); | 2489 value_matchers, effect_matcher, |
| 2490 control_matcher)); |
2480 } | 2491 } |
2481 | 2492 |
2482 | 2493 |
2483 Matcher<Node*> IsJSLoadProperty(const Matcher<Node*>& object_matcher, | 2494 Matcher<Node*> IsJSLoadProperty(const Matcher<Node*>& object_matcher, |
2484 const Matcher<Node*>& key_matcher, | 2495 const Matcher<Node*>& key_matcher, |
2485 const Matcher<Node*>& feedback_vector_matcher, | 2496 const Matcher<Node*>& feedback_vector_matcher, |
2486 const Matcher<Node*>& effect_matcher, | 2497 const Matcher<Node*>& effect_matcher, |
2487 const Matcher<Node*>& control_matcher) { | 2498 const Matcher<Node*>& control_matcher) { |
2488 return MakeMatcher(new IsJSLoadPropertyMatcher( | 2499 return MakeMatcher(new IsJSLoadPropertyMatcher( |
2489 object_matcher, key_matcher, feedback_vector_matcher, effect_matcher, | 2500 object_matcher, key_matcher, feedback_vector_matcher, effect_matcher, |
(...skipping 17 matching lines...) Expand all Loading... |
2507 const Matcher<Node*>& key_matcher, | 2518 const Matcher<Node*>& key_matcher, |
2508 const Matcher<Node*>& value_matcher, | 2519 const Matcher<Node*>& value_matcher, |
2509 const Matcher<Node*>& feedback_vector_matcher, | 2520 const Matcher<Node*>& feedback_vector_matcher, |
2510 const Matcher<Node*>& effect_matcher, | 2521 const Matcher<Node*>& effect_matcher, |
2511 const Matcher<Node*>& control_matcher) { | 2522 const Matcher<Node*>& control_matcher) { |
2512 return MakeMatcher(new IsJSStorePropertyMatcher( | 2523 return MakeMatcher(new IsJSStorePropertyMatcher( |
2513 object_matcher, key_matcher, value_matcher, feedback_vector_matcher, | 2524 object_matcher, key_matcher, value_matcher, feedback_vector_matcher, |
2514 effect_matcher, control_matcher)); | 2525 effect_matcher, control_matcher)); |
2515 } | 2526 } |
2516 | 2527 |
| 2528 |
| 2529 Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers, |
| 2530 const Matcher<Node*>& effect_matcher, |
| 2531 const Matcher<Node*>& control_matcher) { |
| 2532 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallRuntime, |
| 2533 value_matchers, effect_matcher, |
| 2534 control_matcher)); |
| 2535 } |
| 2536 |
| 2537 |
2517 #define IS_BINOP_MATCHER(Name) \ | 2538 #define IS_BINOP_MATCHER(Name) \ |
2518 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ | 2539 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
2519 const Matcher<Node*>& rhs_matcher) { \ | 2540 const Matcher<Node*>& rhs_matcher) { \ |
2520 return MakeMatcher( \ | 2541 return MakeMatcher( \ |
2521 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ | 2542 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ |
2522 } | 2543 } |
2523 IS_BINOP_MATCHER(NumberEqual) | 2544 IS_BINOP_MATCHER(NumberEqual) |
2524 IS_BINOP_MATCHER(NumberLessThan) | 2545 IS_BINOP_MATCHER(NumberLessThan) |
2525 IS_BINOP_MATCHER(NumberSubtract) | 2546 IS_BINOP_MATCHER(NumberSubtract) |
2526 IS_BINOP_MATCHER(NumberMultiply) | 2547 IS_BINOP_MATCHER(NumberMultiply) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 IS_UNOP_MATCHER(NumberToUint32) | 2613 IS_UNOP_MATCHER(NumberToUint32) |
2593 IS_UNOP_MATCHER(ObjectIsSmi) | 2614 IS_UNOP_MATCHER(ObjectIsSmi) |
2594 IS_UNOP_MATCHER(Word32Clz) | 2615 IS_UNOP_MATCHER(Word32Clz) |
2595 IS_UNOP_MATCHER(JSUnaryNot) | 2616 IS_UNOP_MATCHER(JSUnaryNot) |
2596 IS_UNOP_MATCHER(JSTypeOf) | 2617 IS_UNOP_MATCHER(JSTypeOf) |
2597 #undef IS_UNOP_MATCHER | 2618 #undef IS_UNOP_MATCHER |
2598 | 2619 |
2599 } // namespace compiler | 2620 } // namespace compiler |
2600 } // namespace internal | 2621 } // namespace internal |
2601 } // namespace v8 | 2622 } // namespace v8 |
OLD | NEW |