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

Side by Side Diff: test/cctest/test-types.cc

Issue 300893003: Refactor HType to get rid of various hacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix compilation. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-hydrogen-types.cc ('k') | tools/gyp/v8.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 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
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 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 void Convert() { 1770 void Convert() {
1770 Types<Type2, TypeHandle2, Region2> T2( 1771 Types<Type2, TypeHandle2, Region2> T2(
1771 Rep2::ToRegion(&zone, isolate), isolate); 1772 Rep2::ToRegion(&zone, isolate), isolate);
1772 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { 1773 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) {
1773 TypeHandle type1 = *it; 1774 TypeHandle type1 = *it;
1774 TypeHandle2 type2 = T2.template Convert<Type>(type1); 1775 TypeHandle2 type2 = T2.template Convert<Type>(type1);
1775 TypeHandle type3 = T.template Convert<Type2>(type2); 1776 TypeHandle type3 = T.template Convert<Type2>(type2);
1776 CheckEqual(type1, type3); 1777 CheckEqual(type1, type3);
1777 } 1778 }
1778 } 1779 }
1780
1781 void HTypeFromType() {
1782 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) {
1783 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) {
1784 TypeHandle type1 = *it1;
1785 TypeHandle type2 = *it2;
1786 HType htype1 = HType::FromType<Type>(type1);
1787 HType htype2 = HType::FromType<Type>(type2);
1788 CHECK(!type1->Is(type2) || htype1.IsSubtypeOf(htype2));
1789 }
1790 }
1791 }
1779 }; 1792 };
1780 1793
1781 typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests; 1794 typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests;
1782 typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests; 1795 typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests;
1783 1796
1784 1797
1785 TEST(BitsetType) { 1798 TEST(BitsetType) {
1786 CcTest::InitializeVM(); 1799 CcTest::InitializeVM();
1787 ZoneTests().Bitset(); 1800 ZoneTests().Bitset();
1788 HeapTests().Bitset(); 1801 HeapTests().Bitset();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 ZoneTests().Distributivity2(); 1926 ZoneTests().Distributivity2();
1914 HeapTests().Distributivity2(); 1927 HeapTests().Distributivity2();
1915 } 1928 }
1916 1929
1917 1930
1918 TEST(Convert) { 1931 TEST(Convert) {
1919 CcTest::InitializeVM(); 1932 CcTest::InitializeVM();
1920 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); 1933 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>();
1921 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); 1934 HeapTests().Convert<Type, Type*, Zone, ZoneRep>();
1922 } 1935 }
1936
1937
1938 TEST(HTypeFromType) {
1939 CcTest::InitializeVM();
1940 ZoneTests().HTypeFromType();
1941 HeapTests().HTypeFromType();
1942 }
OLDNEW
« no previous file with comments | « test/cctest/test-hydrogen-types.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698