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

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

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix GN for realz Created 5 years, 5 months 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
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | test/unittests/unittests.gyp » ('j') | 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/js-operator.h" 11 #include "src/compiler/js-operator.h"
11 #include "src/compiler/node-properties.h" 12 #include "src/compiler/node-properties.h"
12 #include "src/compiler/simplified-operator.h" 13 #include "src/compiler/simplified-operator.h"
13 #include "src/unique.h" 14 #include "src/unique.h"
14 15
15 using testing::_; 16 using testing::_;
16 using testing::MakeMatcher; 17 using testing::MakeMatcher;
17 using testing::MatcherInterface; 18 using testing::MatcherInterface;
18 using testing::MatchResultListener; 19 using testing::MatchResultListener;
19 using testing::StringMatchResultListener; 20 using testing::StringMatchResultListener;
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { 1369 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1369 return (NodeMatcher::MatchAndExplain(node, listener) && 1370 return (NodeMatcher::MatchAndExplain(node, listener) &&
1370 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 1371 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
1371 "input", input_matcher_, listener)); 1372 "input", input_matcher_, listener));
1372 } 1373 }
1373 1374
1374 private: 1375 private:
1375 const Matcher<Node*> input_matcher_; 1376 const Matcher<Node*> input_matcher_;
1376 }; 1377 };
1377 1378
1379 class IsParameterMatcher final : public NodeMatcher {
1380 public:
1381 explicit IsParameterMatcher(const Matcher<int>& index_matcher)
1382 : NodeMatcher(IrOpcode::kParameter), index_matcher_(index_matcher) {}
1383
1384 void DescribeTo(std::ostream* os) const override {
1385 *os << "is a Parameter node with index(";
1386 index_matcher_.DescribeTo(os);
1387 *os << ")";
1388 }
1389
1390 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1391 return (NodeMatcher::MatchAndExplain(node, listener) &&
1392 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index",
1393 index_matcher_, listener));
1394 }
1395
1396 private:
1397 const Matcher<int> index_matcher_;
1398 };
1399
1378 } // namespace 1400 } // namespace
1379 1401
1380 1402
1381 Matcher<Node*> IsDead() { 1403 Matcher<Node*> IsDead() {
1382 return MakeMatcher(new NodeMatcher(IrOpcode::kDead)); 1404 return MakeMatcher(new NodeMatcher(IrOpcode::kDead));
1383 } 1405 }
1384 1406
1385 1407
1386 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) { 1408 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) {
1387 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher)); 1409 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher));
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 const Matcher<Node*>& effect_matcher, 1693 const Matcher<Node*>& effect_matcher,
1672 const Matcher<Node*>& control_matcher) { 1694 const Matcher<Node*>& control_matcher) {
1673 std::vector<Matcher<Node*>> value_matchers; 1695 std::vector<Matcher<Node*>> value_matchers;
1674 value_matchers.push_back(value0_matcher); 1696 value_matchers.push_back(value0_matcher);
1675 value_matchers.push_back(value1_matcher); 1697 value_matchers.push_back(value1_matcher);
1676 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, 1698 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers,
1677 effect_matcher, control_matcher)); 1699 effect_matcher, control_matcher));
1678 } 1700 }
1679 1701
1680 1702
1703 Matcher<Node*> IsTailCall(
1704 const Matcher<CallDescriptor const*>& descriptor_matcher,
1705 const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
1706 const Matcher<Node*>& value2_matcher, const Matcher<Node*>& effect_matcher,
1707 const Matcher<Node*>& control_matcher) {
1708 std::vector<Matcher<Node*>> value_matchers;
1709 value_matchers.push_back(value0_matcher);
1710 value_matchers.push_back(value1_matcher);
1711 value_matchers.push_back(value2_matcher);
1712 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers,
1713 effect_matcher, control_matcher));
1714 }
1715
1716
1681 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, 1717 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher,
1682 const Matcher<Node*>& lhs_matcher, 1718 const Matcher<Node*>& lhs_matcher,
1683 const Matcher<Node*>& rhs_matcher) { 1719 const Matcher<Node*>& rhs_matcher) {
1684 return MakeMatcher( 1720 return MakeMatcher(
1685 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); 1721 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher));
1686 } 1722 }
1687 1723
1688 1724
1689 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, 1725 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher,
1690 const Matcher<Node*>& effect_matcher, 1726 const Matcher<Node*>& effect_matcher,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 effect_matcher, control_matcher)); 1828 effect_matcher, control_matcher));
1793 } 1829 }
1794 1830
1795 1831
1796 Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher, 1832 Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher,
1797 const Matcher<Node*>& context_matcher) { 1833 const Matcher<Node*>& context_matcher) {
1798 return MakeMatcher(new IsLoadContextMatcher(access_matcher, context_matcher)); 1834 return MakeMatcher(new IsLoadContextMatcher(access_matcher, context_matcher));
1799 } 1835 }
1800 1836
1801 1837
1838 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) {
1839 return MakeMatcher(new IsParameterMatcher(index_matcher));
1840 }
1841
1842
1843 Matcher<Node*> IsLoadFramePointer() {
1844 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer));
1845 }
1846
1847
1802 #define IS_BINOP_MATCHER(Name) \ 1848 #define IS_BINOP_MATCHER(Name) \
1803 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ 1849 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
1804 const Matcher<Node*>& rhs_matcher) { \ 1850 const Matcher<Node*>& rhs_matcher) { \
1805 return MakeMatcher( \ 1851 return MakeMatcher( \
1806 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ 1852 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \
1807 } 1853 }
1808 IS_BINOP_MATCHER(NumberEqual) 1854 IS_BINOP_MATCHER(NumberEqual)
1809 IS_BINOP_MATCHER(NumberLessThan) 1855 IS_BINOP_MATCHER(NumberLessThan)
1810 IS_BINOP_MATCHER(NumberSubtract) 1856 IS_BINOP_MATCHER(NumberSubtract)
1811 IS_BINOP_MATCHER(NumberMultiply) 1857 IS_BINOP_MATCHER(NumberMultiply)
(...skipping 11 matching lines...) Expand all
1823 IS_BINOP_MATCHER(Word64Shl) 1869 IS_BINOP_MATCHER(Word64Shl)
1824 IS_BINOP_MATCHER(Word64Equal) 1870 IS_BINOP_MATCHER(Word64Equal)
1825 IS_BINOP_MATCHER(Int32AddWithOverflow) 1871 IS_BINOP_MATCHER(Int32AddWithOverflow)
1826 IS_BINOP_MATCHER(Int32Add) 1872 IS_BINOP_MATCHER(Int32Add)
1827 IS_BINOP_MATCHER(Int32Sub) 1873 IS_BINOP_MATCHER(Int32Sub)
1828 IS_BINOP_MATCHER(Int32Mul) 1874 IS_BINOP_MATCHER(Int32Mul)
1829 IS_BINOP_MATCHER(Int32MulHigh) 1875 IS_BINOP_MATCHER(Int32MulHigh)
1830 IS_BINOP_MATCHER(Int32LessThan) 1876 IS_BINOP_MATCHER(Int32LessThan)
1831 IS_BINOP_MATCHER(Uint32LessThan) 1877 IS_BINOP_MATCHER(Uint32LessThan)
1832 IS_BINOP_MATCHER(Uint32LessThanOrEqual) 1878 IS_BINOP_MATCHER(Uint32LessThanOrEqual)
1879 IS_BINOP_MATCHER(Int64Add)
1833 IS_BINOP_MATCHER(Float32Max) 1880 IS_BINOP_MATCHER(Float32Max)
1834 IS_BINOP_MATCHER(Float32Min) 1881 IS_BINOP_MATCHER(Float32Min)
1835 IS_BINOP_MATCHER(Float32Equal) 1882 IS_BINOP_MATCHER(Float32Equal)
1836 IS_BINOP_MATCHER(Float32LessThan) 1883 IS_BINOP_MATCHER(Float32LessThan)
1837 IS_BINOP_MATCHER(Float32LessThanOrEqual) 1884 IS_BINOP_MATCHER(Float32LessThanOrEqual)
1838 IS_BINOP_MATCHER(Float64Max) 1885 IS_BINOP_MATCHER(Float64Max)
1839 IS_BINOP_MATCHER(Float64Min) 1886 IS_BINOP_MATCHER(Float64Min)
1840 IS_BINOP_MATCHER(Float64Sub) 1887 IS_BINOP_MATCHER(Float64Sub)
1841 IS_BINOP_MATCHER(Float64InsertLowWord32) 1888 IS_BINOP_MATCHER(Float64InsertLowWord32)
1842 IS_BINOP_MATCHER(Float64InsertHighWord32) 1889 IS_BINOP_MATCHER(Float64InsertHighWord32)
(...skipping 25 matching lines...) Expand all
1868 IS_UNOP_MATCHER(NumberToInt32) 1915 IS_UNOP_MATCHER(NumberToInt32)
1869 IS_UNOP_MATCHER(NumberToUint32) 1916 IS_UNOP_MATCHER(NumberToUint32)
1870 IS_UNOP_MATCHER(ObjectIsSmi) 1917 IS_UNOP_MATCHER(ObjectIsSmi)
1871 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) 1918 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi)
1872 IS_UNOP_MATCHER(Word32Clz) 1919 IS_UNOP_MATCHER(Word32Clz)
1873 #undef IS_UNOP_MATCHER 1920 #undef IS_UNOP_MATCHER
1874 1921
1875 } // namespace compiler 1922 } // namespace compiler
1876 } // namespace internal 1923 } // namespace internal
1877 } // namespace v8 1924 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698