OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "src/hydrogen-types.h" | 7 #include "src/hydrogen-types.h" |
8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
9 #include "src/types.h" | 9 #include "src/types.h" |
10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 typedef typename TypesInstance::TypeVector::iterator TypeIterator; | 99 typedef typename TypesInstance::TypeVector::iterator TypeIterator; |
100 typedef typename TypesInstance::MapVector::iterator MapIterator; | 100 typedef typename TypesInstance::MapVector::iterator MapIterator; |
101 typedef typename TypesInstance::ValueVector::iterator ValueIterator; | 101 typedef typename TypesInstance::ValueVector::iterator ValueIterator; |
102 | 102 |
103 Isolate* isolate; | 103 Isolate* isolate; |
104 HandleScope scope; | 104 HandleScope scope; |
105 Zone zone; | 105 Zone zone; |
106 TypesInstance T; | 106 TypesInstance T; |
107 | 107 |
108 Tests() | 108 Tests() |
109 : isolate(CcTest::i_isolate()), | 109 : isolate(CcTest::InitIsolateOnce()), |
110 scope(isolate), | 110 scope(isolate), |
111 zone(), | 111 zone(), |
112 T(Rep::ToRegion(&zone, isolate), isolate, | 112 T(Rep::ToRegion(&zone, isolate), isolate, |
113 isolate->random_number_generator()) {} | 113 isolate->random_number_generator()) {} |
114 | 114 |
115 bool Equal(TypeHandle type1, TypeHandle type2) { | 115 bool Equal(TypeHandle type1, TypeHandle type2) { |
116 return | 116 return |
117 type1->Equals(type2) && | 117 type1->Equals(type2) && |
118 this->IsBitset(type1) == this->IsBitset(type2) && | 118 this->IsBitset(type1) == this->IsBitset(type2) && |
119 this->IsUnion(type1) == this->IsUnion(type2) && | 119 this->IsUnion(type1) == this->IsUnion(type2) && |
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 CHECK(!type1->Is(type2) || htype1.IsSubtypeOf(htype2)); | 1957 CHECK(!type1->Is(type2) || htype1.IsSubtypeOf(htype2)); |
1958 } | 1958 } |
1959 } | 1959 } |
1960 } | 1960 } |
1961 }; | 1961 }; |
1962 | 1962 |
1963 typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests; | 1963 typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests; |
1964 typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests; | 1964 typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests; |
1965 | 1965 |
1966 | 1966 |
1967 TEST(IsSomeType) { | 1967 TEST(IsSomeType_zone) { ZoneTests().IsSomeType(); } |
1968 CcTest::InitializeVM(); | 1968 |
1969 ZoneTests().IsSomeType(); | 1969 |
1970 HeapTests().IsSomeType(); | 1970 TEST(IsSomeType_heap) { HeapTests().IsSomeType(); } |
| 1971 |
| 1972 |
| 1973 TEST(PointwiseRepresentation_zone) { ZoneTests().PointwiseRepresentation(); } |
| 1974 |
| 1975 |
| 1976 TEST(PointwiseRepresentation_heap) { HeapTests().PointwiseRepresentation(); } |
| 1977 |
| 1978 |
| 1979 TEST(BitsetType_zone) { ZoneTests().Bitset(); } |
| 1980 |
| 1981 |
| 1982 TEST(BitsetType_heap) { HeapTests().Bitset(); } |
| 1983 |
| 1984 |
| 1985 TEST(ClassType_zone) { ZoneTests().Class(); } |
| 1986 |
| 1987 |
| 1988 TEST(ClassType_heap) { HeapTests().Class(); } |
| 1989 |
| 1990 |
| 1991 TEST(ConstantType_zone) { ZoneTests().Constant(); } |
| 1992 |
| 1993 |
| 1994 TEST(ConstantType_heap) { HeapTests().Constant(); } |
| 1995 |
| 1996 |
| 1997 TEST(RangeType_zone) { ZoneTests().Range(); } |
| 1998 |
| 1999 |
| 2000 TEST(RangeType_heap) { HeapTests().Range(); } |
| 2001 |
| 2002 |
| 2003 TEST(ArrayType_zone) { ZoneTests().Array(); } |
| 2004 |
| 2005 |
| 2006 TEST(ArrayType_heap) { HeapTests().Array(); } |
| 2007 |
| 2008 |
| 2009 TEST(FunctionType_zone) { ZoneTests().Function(); } |
| 2010 |
| 2011 |
| 2012 TEST(FunctionType_heap) { HeapTests().Function(); } |
| 2013 |
| 2014 |
| 2015 TEST(Of_zone) { ZoneTests().Of(); } |
| 2016 |
| 2017 |
| 2018 TEST(Of_heap) { HeapTests().Of(); } |
| 2019 |
| 2020 |
| 2021 TEST(NowOf_zone) { ZoneTests().NowOf(); } |
| 2022 |
| 2023 |
| 2024 TEST(NowOf_heap) { HeapTests().NowOf(); } |
| 2025 |
| 2026 |
| 2027 TEST(MinMax_zone) { ZoneTests().MinMax(); } |
| 2028 |
| 2029 |
| 2030 TEST(MinMax_heap) { HeapTests().MinMax(); } |
| 2031 |
| 2032 |
| 2033 TEST(BitsetGlb_zone) { ZoneTests().BitsetGlb(); } |
| 2034 |
| 2035 |
| 2036 TEST(BitsetGlb_heap) { HeapTests().BitsetGlb(); } |
| 2037 |
| 2038 |
| 2039 TEST(BitsetLub_zone) { ZoneTests().BitsetLub(); } |
| 2040 |
| 2041 |
| 2042 TEST(BitsetLub_heap) { HeapTests().BitsetLub(); } |
| 2043 |
| 2044 |
| 2045 TEST(Is1_zone) { ZoneTests().Is1(); } |
| 2046 |
| 2047 |
| 2048 TEST(Is1_heap) { HeapTests().Is1(); } |
| 2049 |
| 2050 |
| 2051 TEST(Is2_zone) { ZoneTests().Is2(); } |
| 2052 |
| 2053 |
| 2054 TEST(Is2_heap) { HeapTests().Is2(); } |
| 2055 |
| 2056 |
| 2057 TEST(NowIs_zone) { ZoneTests().NowIs(); } |
| 2058 |
| 2059 |
| 2060 TEST(NowIs_heap) { HeapTests().NowIs(); } |
| 2061 |
| 2062 |
| 2063 TEST(Contains_zone) { ZoneTests().Contains(); } |
| 2064 |
| 2065 |
| 2066 TEST(Contains_heap) { HeapTests().Contains(); } |
| 2067 |
| 2068 |
| 2069 TEST(NowContains_zone) { ZoneTests().NowContains(); } |
| 2070 |
| 2071 |
| 2072 TEST(NowContains_heap) { HeapTests().NowContains(); } |
| 2073 |
| 2074 |
| 2075 TEST(Maybe_zone) { ZoneTests().Maybe(); } |
| 2076 |
| 2077 |
| 2078 TEST(Maybe_heap) { HeapTests().Maybe(); } |
| 2079 |
| 2080 |
| 2081 TEST(Union1_zone) { ZoneTests().Union1(); } |
| 2082 |
| 2083 |
| 2084 TEST(Union1_heap) { HeapTests().Union1(); } |
| 2085 |
| 2086 |
| 2087 TEST(Union2_zone) { ZoneTests().Union2(); } |
| 2088 |
| 2089 |
| 2090 TEST(Union2_heap) { HeapTests().Union2(); } |
| 2091 |
| 2092 |
| 2093 TEST(Union3_zone) { ZoneTests().Union3(); } |
| 2094 |
| 2095 |
| 2096 TEST(Union3_heap) { HeapTests().Union3(); } |
| 2097 |
| 2098 |
| 2099 TEST(Union4_zone) { ZoneTests().Union4(); } |
| 2100 |
| 2101 |
| 2102 TEST(Union4_heap) { HeapTests().Union4(); } |
| 2103 |
| 2104 |
| 2105 TEST(Intersect_zone) { ZoneTests().Intersect(); } |
| 2106 |
| 2107 |
| 2108 TEST(Intersect_heap) { HeapTests().Intersect(); } |
| 2109 |
| 2110 |
| 2111 TEST(Distributivity_zone) { ZoneTests().Distributivity(); } |
| 2112 |
| 2113 |
| 2114 TEST(Distributivity_heap) { HeapTests().Distributivity(); } |
| 2115 |
| 2116 |
| 2117 TEST(GetRange_zone) { ZoneTests().GetRange(); } |
| 2118 |
| 2119 |
| 2120 TEST(GetRange_heap) { HeapTests().GetRange(); } |
| 2121 |
| 2122 |
| 2123 TEST(Convert_zone) { |
| 2124 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
1971 } | 2125 } |
1972 | 2126 |
1973 | 2127 |
1974 TEST(PointwiseRepresentation) { | 2128 TEST(Convert_heap) { HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); } |
1975 CcTest::InitializeVM(); | |
1976 // ZoneTests().PointwiseRepresentation(); | |
1977 HeapTests().PointwiseRepresentation(); | |
1978 } | |
1979 | 2129 |
1980 | 2130 |
1981 TEST(BitsetType) { | 2131 TEST(HTypeFromType_zone) { ZoneTests().HTypeFromType(); } |
1982 CcTest::InitializeVM(); | |
1983 ZoneTests().Bitset(); | |
1984 HeapTests().Bitset(); | |
1985 } | |
1986 | 2132 |
1987 | 2133 |
1988 TEST(ClassType) { | 2134 TEST(HTypeFromType_heap) { HeapTests().HTypeFromType(); } |
1989 CcTest::InitializeVM(); | |
1990 ZoneTests().Class(); | |
1991 HeapTests().Class(); | |
1992 } | |
1993 | |
1994 | |
1995 TEST(ConstantType) { | |
1996 CcTest::InitializeVM(); | |
1997 ZoneTests().Constant(); | |
1998 HeapTests().Constant(); | |
1999 } | |
2000 | |
2001 | |
2002 TEST(RangeType) { | |
2003 CcTest::InitializeVM(); | |
2004 ZoneTests().Range(); | |
2005 HeapTests().Range(); | |
2006 } | |
2007 | |
2008 | |
2009 TEST(ArrayType) { | |
2010 CcTest::InitializeVM(); | |
2011 ZoneTests().Array(); | |
2012 HeapTests().Array(); | |
2013 } | |
2014 | |
2015 | |
2016 TEST(FunctionType) { | |
2017 CcTest::InitializeVM(); | |
2018 ZoneTests().Function(); | |
2019 HeapTests().Function(); | |
2020 } | |
2021 | |
2022 | |
2023 TEST(Of) { | |
2024 CcTest::InitializeVM(); | |
2025 ZoneTests().Of(); | |
2026 HeapTests().Of(); | |
2027 } | |
2028 | |
2029 | |
2030 TEST(NowOf) { | |
2031 CcTest::InitializeVM(); | |
2032 ZoneTests().NowOf(); | |
2033 HeapTests().NowOf(); | |
2034 } | |
2035 | |
2036 | |
2037 TEST(MinMax) { | |
2038 CcTest::InitializeVM(); | |
2039 ZoneTests().MinMax(); | |
2040 HeapTests().MinMax(); | |
2041 } | |
2042 | |
2043 | |
2044 TEST(BitsetGlb) { | |
2045 CcTest::InitializeVM(); | |
2046 ZoneTests().BitsetGlb(); | |
2047 HeapTests().BitsetGlb(); | |
2048 } | |
2049 | |
2050 | |
2051 TEST(BitsetLub) { | |
2052 CcTest::InitializeVM(); | |
2053 ZoneTests().BitsetLub(); | |
2054 HeapTests().BitsetLub(); | |
2055 } | |
2056 | |
2057 | |
2058 TEST(Is1) { | |
2059 CcTest::InitializeVM(); | |
2060 ZoneTests().Is1(); | |
2061 HeapTests().Is1(); | |
2062 } | |
2063 | |
2064 | |
2065 TEST(Is2) { | |
2066 CcTest::InitializeVM(); | |
2067 ZoneTests().Is2(); | |
2068 HeapTests().Is2(); | |
2069 } | |
2070 | |
2071 | |
2072 TEST(NowIs) { | |
2073 CcTest::InitializeVM(); | |
2074 ZoneTests().NowIs(); | |
2075 HeapTests().NowIs(); | |
2076 } | |
2077 | |
2078 | |
2079 TEST(Contains) { | |
2080 CcTest::InitializeVM(); | |
2081 ZoneTests().Contains(); | |
2082 HeapTests().Contains(); | |
2083 } | |
2084 | |
2085 | |
2086 TEST(NowContains) { | |
2087 CcTest::InitializeVM(); | |
2088 ZoneTests().NowContains(); | |
2089 HeapTests().NowContains(); | |
2090 } | |
2091 | |
2092 | |
2093 TEST(Maybe) { | |
2094 CcTest::InitializeVM(); | |
2095 ZoneTests().Maybe(); | |
2096 HeapTests().Maybe(); | |
2097 } | |
2098 | |
2099 | |
2100 TEST(Union1) { | |
2101 CcTest::InitializeVM(); | |
2102 ZoneTests().Union1(); | |
2103 HeapTests().Union1(); | |
2104 } | |
2105 | |
2106 | |
2107 /* | |
2108 TEST(Union2) { | |
2109 CcTest::InitializeVM(); | |
2110 ZoneTests().Union2(); | |
2111 HeapTests().Union2(); | |
2112 } | |
2113 */ | |
2114 | |
2115 | |
2116 TEST(Union3) { | |
2117 CcTest::InitializeVM(); | |
2118 ZoneTests().Union3(); | |
2119 HeapTests().Union3(); | |
2120 } | |
2121 | |
2122 | |
2123 TEST(Union4) { | |
2124 CcTest::InitializeVM(); | |
2125 ZoneTests().Union4(); | |
2126 HeapTests().Union4(); | |
2127 } | |
2128 | |
2129 | |
2130 TEST(Intersect) { | |
2131 CcTest::InitializeVM(); | |
2132 ZoneTests().Intersect(); | |
2133 HeapTests().Intersect(); | |
2134 } | |
2135 | |
2136 | |
2137 TEST(Distributivity) { | |
2138 CcTest::InitializeVM(); | |
2139 ZoneTests().Distributivity(); | |
2140 HeapTests().Distributivity(); | |
2141 } | |
2142 | |
2143 | |
2144 TEST(GetRange) { | |
2145 CcTest::InitializeVM(); | |
2146 ZoneTests().GetRange(); | |
2147 HeapTests().GetRange(); | |
2148 } | |
2149 | |
2150 | |
2151 TEST(Convert) { | |
2152 CcTest::InitializeVM(); | |
2153 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | |
2154 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | |
2155 } | |
2156 | |
2157 | |
2158 TEST(HTypeFromType) { | |
2159 CcTest::InitializeVM(); | |
2160 ZoneTests().HTypeFromType(); | |
2161 HeapTests().HTypeFromType(); | |
2162 } | |
OLD | NEW |