OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <vector> | 28 #include <vector> |
29 | 29 |
30 #include "cctest.h" | 30 #include "cctest.h" |
| 31 #include "hydrogen-types.h" |
31 #include "types.h" | 32 #include "types.h" |
32 #include "utils/random-number-generator.h" | 33 #include "utils/random-number-generator.h" |
33 | 34 |
34 using namespace v8::internal; | 35 using namespace v8::internal; |
35 | 36 |
36 // Testing auxiliaries (breaking the Type abstraction). | 37 // Testing auxiliaries (breaking the Type abstraction). |
37 struct ZoneRep { | 38 struct ZoneRep { |
38 typedef void* Struct; | 39 typedef void* Struct; |
39 | 40 |
40 static bool IsStruct(Type* t, int tag) { | 41 static bool IsStruct(Type* t, int tag) { |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 void Convert() { | 1768 void Convert() { |
1768 Types<Type2, TypeHandle2, Region2> T2( | 1769 Types<Type2, TypeHandle2, Region2> T2( |
1769 Rep2::ToRegion(&zone, isolate), isolate); | 1770 Rep2::ToRegion(&zone, isolate), isolate); |
1770 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 1771 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
1771 TypeHandle type1 = *it; | 1772 TypeHandle type1 = *it; |
1772 TypeHandle2 type2 = T2.template Convert<Type>(type1); | 1773 TypeHandle2 type2 = T2.template Convert<Type>(type1); |
1773 TypeHandle type3 = T.template Convert<Type2>(type2); | 1774 TypeHandle type3 = T.template Convert<Type2>(type2); |
1774 CheckEqual(type1, type3); | 1775 CheckEqual(type1, type3); |
1775 } | 1776 } |
1776 } | 1777 } |
| 1778 |
| 1779 void HTypeFromType() { |
| 1780 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
| 1781 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
| 1782 TypeHandle type1 = *it1; |
| 1783 TypeHandle type2 = *it2; |
| 1784 HType htype1 = HType::FromType<Type>(type1); |
| 1785 HType htype2 = HType::FromType<Type>(type2); |
| 1786 CHECK(!type1->Is(type2) || htype1.IsSubtypeOf(htype2)); |
| 1787 } |
| 1788 } |
| 1789 } |
1777 }; | 1790 }; |
1778 | 1791 |
1779 typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests; | 1792 typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests; |
1780 typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests; | 1793 typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests; |
1781 | 1794 |
1782 | 1795 |
1783 TEST(BitsetType) { | 1796 TEST(BitsetType) { |
1784 CcTest::InitializeVM(); | 1797 CcTest::InitializeVM(); |
1785 ZoneTests().Bitset(); | 1798 ZoneTests().Bitset(); |
1786 HeapTests().Bitset(); | 1799 HeapTests().Bitset(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 ZoneTests().Distributivity(); | 1917 ZoneTests().Distributivity(); |
1905 HeapTests().Distributivity(); | 1918 HeapTests().Distributivity(); |
1906 } | 1919 } |
1907 | 1920 |
1908 | 1921 |
1909 TEST(Convert) { | 1922 TEST(Convert) { |
1910 CcTest::InitializeVM(); | 1923 CcTest::InitializeVM(); |
1911 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | 1924 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
1912 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | 1925 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); |
1913 } | 1926 } |
| 1927 |
| 1928 |
| 1929 TEST(HTypeFromType) { |
| 1930 CcTest::InitializeVM(); |
| 1931 ZoneTests().HTypeFromType(); |
| 1932 HeapTests().HTypeFromType(); |
| 1933 } |
OLD | NEW |