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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 // T1->Maybe(T2) implies T1, T2 inhabited | 1153 // T1->Maybe(T2) implies T1, T2 inhabited |
1154 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1154 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
1155 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 1155 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
1156 TypeHandle type1 = *it1; | 1156 TypeHandle type1 = *it1; |
1157 TypeHandle type2 = *it2; | 1157 TypeHandle type2 = *it2; |
1158 CHECK(!type1->Maybe(type2) || | 1158 CHECK(!type1->Maybe(type2) || |
1159 (type1->IsInhabited() && type2->IsInhabited())); | 1159 (type1->IsInhabited() && type2->IsInhabited())); |
1160 } | 1160 } |
1161 } | 1161 } |
1162 | 1162 |
1163 // T1->Maybe(T2) iff Intersect(T1, T2) inhabited | 1163 // T1->Maybe(T2) implies Intersect(T1, T2) inhabited |
1164 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1164 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
1165 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 1165 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
1166 TypeHandle type1 = *it1; | 1166 TypeHandle type1 = *it1; |
1167 TypeHandle type2 = *it2; | 1167 TypeHandle type2 = *it2; |
1168 TypeHandle intersect12 = T.Intersect(type1, type2); | 1168 TypeHandle intersect12 = T.Intersect(type1, type2); |
1169 CHECK(type1->Maybe(type2) == intersect12->IsInhabited()); | 1169 CHECK(!type1->Maybe(type2) || intersect12->IsInhabited()); |
1170 } | 1170 } |
1171 } | 1171 } |
1172 | 1172 |
1173 // T1->Is(T2) and T1 inhabited implies T1->Maybe(T2) | 1173 // T1->Is(T2) and T1 inhabited implies T1->Maybe(T2) |
1174 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1174 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
1175 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 1175 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
1176 TypeHandle type1 = *it1; | 1176 TypeHandle type1 = *it1; |
1177 TypeHandle type2 = *it2; | 1177 TypeHandle type2 = *it2; |
1178 CHECK(!(type1->Is(type2) && type1->IsInhabited()) || | 1178 CHECK(!(type1->Is(type2) && type1->IsInhabited()) || |
1179 type1->Maybe(type2)); | 1179 type1->Maybe(type2)); |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | 1933 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
1934 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | 1934 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); |
1935 } | 1935 } |
1936 | 1936 |
1937 | 1937 |
1938 TEST(HTypeFromType) { | 1938 TEST(HTypeFromType) { |
1939 CcTest::InitializeVM(); | 1939 CcTest::InitializeVM(); |
1940 ZoneTests().HTypeFromType(); | 1940 ZoneTests().HTypeFromType(); |
1941 HeapTests().HTypeFromType(); | 1941 HeapTests().HTypeFromType(); |
1942 } | 1942 } |
OLD | NEW |