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 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 CheckEqual( | 1718 CheckEqual( |
1719 T.Intersect( | 1719 T.Intersect( |
1720 T.Union( | 1720 T.Union( |
1721 T.Union(T.ObjectConstant2, T.ObjectConstant1), T.ArrayClass), | 1721 T.Union(T.ObjectConstant2, T.ObjectConstant1), T.ArrayClass), |
1722 T.Union( | 1722 T.Union( |
1723 T.ObjectConstant1, | 1723 T.ObjectConstant1, |
1724 T.Union(T.ArrayConstant, T.ObjectConstant2))), | 1724 T.Union(T.ArrayConstant, T.ObjectConstant2))), |
1725 T.Union(T.ObjectConstant2, T.ObjectConstant1)); | 1725 T.Union(T.ObjectConstant2, T.ObjectConstant1)); |
1726 } | 1726 } |
1727 | 1727 |
1728 void Distributivity() { | 1728 void Distributivity1() { |
1729 // Distributivity: | 1729 // Distributivity: |
1730 // Union(T1, Intersect(T2, T3)) = Intersect(Union(T1, T2), Union(T1, T3)) | 1730 // Union(T1, Intersect(T2, T3)) = Intersect(Union(T1, T2), Union(T1, T3)) |
1731 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1731 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
1732 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 1732 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
1733 for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { | 1733 for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { |
1734 TypeHandle type1 = *it1; | 1734 TypeHandle type1 = *it1; |
1735 TypeHandle type2 = *it2; | 1735 TypeHandle type2 = *it2; |
1736 TypeHandle type3 = *it3; | 1736 TypeHandle type3 = *it3; |
1737 TypeHandle union12 = T.Union(type1, type2); | 1737 TypeHandle union12 = T.Union(type1, type2); |
1738 TypeHandle union13 = T.Union(type1, type3); | 1738 TypeHandle union13 = T.Union(type1, type3); |
1739 TypeHandle intersect23 = T.Intersect(type2, type3); | 1739 TypeHandle intersect23 = T.Intersect(type2, type3); |
1740 TypeHandle union1_23 = T.Union(type1, intersect23); | 1740 TypeHandle union1_23 = T.Union(type1, intersect23); |
1741 TypeHandle intersect12_13 = T.Intersect(union12, union13); | 1741 TypeHandle intersect12_13 = T.Intersect(union12, union13); |
1742 CHECK(Equal(union1_23, intersect12_13)); | 1742 CHECK(Equal(union1_23, intersect12_13)); |
1743 } | 1743 } |
1744 } | 1744 } |
1745 } | 1745 } |
| 1746 } |
1746 | 1747 |
| 1748 void Distributivity2() { |
1747 // Distributivity: | 1749 // Distributivity: |
1748 // Intersect(T1, Union(T2, T3)) = Union(Intersect(T1, T2), Intersect(T1,T3)) | 1750 // Intersect(T1, Union(T2, T3)) = Union(Intersect(T1, T2), Intersect(T1,T3)) |
1749 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1751 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
1750 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 1752 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
1751 for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { | 1753 for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { |
1752 TypeHandle type1 = *it1; | 1754 TypeHandle type1 = *it1; |
1753 TypeHandle type2 = *it2; | 1755 TypeHandle type2 = *it2; |
1754 TypeHandle type3 = *it3; | 1756 TypeHandle type3 = *it3; |
1755 TypeHandle intersect12 = T.Intersect(type1, type2); | 1757 TypeHandle intersect12 = T.Intersect(type1, type2); |
1756 TypeHandle intersect13 = T.Intersect(type1, type3); | 1758 TypeHandle intersect13 = T.Intersect(type1, type3); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 } | 1894 } |
1893 | 1895 |
1894 | 1896 |
1895 TEST(Intersect2) { | 1897 TEST(Intersect2) { |
1896 CcTest::InitializeVM(); | 1898 CcTest::InitializeVM(); |
1897 ZoneTests().Intersect2(); | 1899 ZoneTests().Intersect2(); |
1898 HeapTests().Intersect2(); | 1900 HeapTests().Intersect2(); |
1899 } | 1901 } |
1900 | 1902 |
1901 | 1903 |
1902 TEST(Distributivity) { | 1904 TEST(Distributivity1) { |
1903 CcTest::InitializeVM(); | 1905 CcTest::InitializeVM(); |
1904 ZoneTests().Distributivity(); | 1906 ZoneTests().Distributivity1(); |
1905 HeapTests().Distributivity(); | 1907 HeapTests().Distributivity1(); |
1906 } | 1908 } |
1907 | 1909 |
1908 | 1910 |
| 1911 TEST(Distributivity2) { |
| 1912 CcTest::InitializeVM(); |
| 1913 ZoneTests().Distributivity2(); |
| 1914 HeapTests().Distributivity2(); |
| 1915 } |
| 1916 |
| 1917 |
1909 TEST(Convert) { | 1918 TEST(Convert) { |
1910 CcTest::InitializeVM(); | 1919 CcTest::InitializeVM(); |
1911 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | 1920 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
1912 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | 1921 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); |
1913 } | 1922 } |
OLD | NEW |