Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: test/unittests/compiler/node-test-utils.cc

Issue 1458603012: [Interpreter] Add CreateClosure to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Take IV. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/handles.h ('K') | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 1851 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
1852 "control", control_matcher_, listener)); 1852 "control", control_matcher_, listener));
1853 } 1853 }
1854 1854
1855 private: 1855 private:
1856 const std::vector<Matcher<Node*>> value_matchers_; 1856 const std::vector<Matcher<Node*>> value_matchers_;
1857 const Matcher<Node*> effect_matcher_; 1857 const Matcher<Node*> effect_matcher_;
1858 const Matcher<Node*> control_matcher_; 1858 const Matcher<Node*> control_matcher_;
1859 }; 1859 };
1860 1860
1861
1862 class IsCreateClosureMatcher final : public NodeMatcher {
1863 public:
1864 IsCreateClosureMatcher(const Matcher<CreateClosureParameters>& value_matcher,
1865 const Matcher<Node*>& effect_matcher,
1866 const Matcher<Node*>& control_matcher)
1867 : NodeMatcher(IrOpcode::Value::kJSCreateClosure),
1868 value_matcher_(value_matcher),
1869 effect_matcher_(effect_matcher),
1870 control_matcher_(control_matcher) {}
1871
1872 void DescribeTo(std::ostream* os) const final {
1873 NodeMatcher::DescribeTo(os);
1874 *os << " whose value (";
1875 value_matcher_.DescribeTo(os);
1876 *os << "), effect (";
1877 effect_matcher_.DescribeTo(os);
1878 *os << ") and control (";
1879 control_matcher_.DescribeTo(os);
1880 *os << ")";
1881 }
1882
1883 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1884 if (!NodeMatcher::MatchAndExplain(node, listener)) {
1885 return false;
1886 }
1887 return (PrintMatchAndExplain(OpParameter<CreateClosureParameters>(node),
1888 "value", value_matcher_, listener) &&
1889 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
1890 effect_matcher_, listener) &&
1891 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
1892 "control", control_matcher_, listener));
1893 }
1894
1895 private:
1896 const Matcher<CreateClosureParameters> value_matcher_;
1897 const Matcher<Node*> effect_matcher_;
1898 const Matcher<Node*> control_matcher_;
1899 };
1900
1861 } // namespace 1901 } // namespace
1862 1902
1863 1903
1864 Matcher<Node*> IsDead() { 1904 Matcher<Node*> IsDead() {
1865 return MakeMatcher(new NodeMatcher(IrOpcode::kDead)); 1905 return MakeMatcher(new NodeMatcher(IrOpcode::kDead));
1866 } 1906 }
1867 1907
1868 1908
1869 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) { 1909 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) {
1870 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher)); 1910 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher));
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 2568
2529 Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers, 2569 Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers,
2530 const Matcher<Node*>& effect_matcher, 2570 const Matcher<Node*>& effect_matcher,
2531 const Matcher<Node*>& control_matcher) { 2571 const Matcher<Node*>& control_matcher) {
2532 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallRuntime, 2572 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallRuntime,
2533 value_matchers, effect_matcher, 2573 value_matchers, effect_matcher,
2534 control_matcher)); 2574 control_matcher));
2535 } 2575 }
2536 2576
2537 2577
2578 Matcher<Node*> IsCreateClosure(
2579 const Matcher<CreateClosureParameters>& closure_parameter_matcher,
2580 const Matcher<Node*>& effect_matcher,
2581 const Matcher<Node*>& control_matcher) {
2582 return MakeMatcher(new IsCreateClosureMatcher(
2583 closure_parameter_matcher, effect_matcher, control_matcher));
2584 }
2585
2586
2538 #define IS_BINOP_MATCHER(Name) \ 2587 #define IS_BINOP_MATCHER(Name) \
2539 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ 2588 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
2540 const Matcher<Node*>& rhs_matcher) { \ 2589 const Matcher<Node*>& rhs_matcher) { \
2541 return MakeMatcher( \ 2590 return MakeMatcher( \
2542 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ 2591 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \
2543 } 2592 }
2544 IS_BINOP_MATCHER(NumberEqual) 2593 IS_BINOP_MATCHER(NumberEqual)
2545 IS_BINOP_MATCHER(NumberLessThan) 2594 IS_BINOP_MATCHER(NumberLessThan)
2546 IS_BINOP_MATCHER(NumberSubtract) 2595 IS_BINOP_MATCHER(NumberSubtract)
2547 IS_BINOP_MATCHER(NumberMultiply) 2596 IS_BINOP_MATCHER(NumberMultiply)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2613 IS_UNOP_MATCHER(NumberToUint32) 2662 IS_UNOP_MATCHER(NumberToUint32)
2614 IS_UNOP_MATCHER(ObjectIsSmi) 2663 IS_UNOP_MATCHER(ObjectIsSmi)
2615 IS_UNOP_MATCHER(Word32Clz) 2664 IS_UNOP_MATCHER(Word32Clz)
2616 IS_UNOP_MATCHER(JSUnaryNot) 2665 IS_UNOP_MATCHER(JSUnaryNot)
2617 IS_UNOP_MATCHER(JSTypeOf) 2666 IS_UNOP_MATCHER(JSTypeOf)
2618 #undef IS_UNOP_MATCHER 2667 #undef IS_UNOP_MATCHER
2619 2668
2620 } // namespace compiler 2669 } // namespace compiler
2621 } // namespace internal 2670 } // namespace internal
2622 } // namespace v8 2671 } // namespace v8
OLDNEW
« src/handles.h ('K') | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698