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/compiler/types.h" | 7 #include "src/compiler/types.h" |
8 #include "src/crankshaft/hydrogen-types.h" | 8 #include "src/crankshaft/hydrogen-types.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 CheckSub(T.ArrayConstant, T.Object); | 642 CheckSub(T.ArrayConstant, T.Object); |
643 CheckSub(T.ArrayConstant, T.OtherObject); | 643 CheckSub(T.ArrayConstant, T.OtherObject); |
644 CheckSub(T.ArrayConstant, T.Receiver); | 644 CheckSub(T.ArrayConstant, T.Receiver); |
645 CheckSub(T.UninitializedConstant, T.Internal); | 645 CheckSub(T.UninitializedConstant, T.Internal); |
646 CheckUnordered(T.ObjectConstant1, T.ObjectConstant2); | 646 CheckUnordered(T.ObjectConstant1, T.ObjectConstant2); |
647 CheckUnordered(T.ObjectConstant1, T.ArrayConstant); | 647 CheckUnordered(T.ObjectConstant1, T.ArrayConstant); |
648 CheckUnordered(T.UninitializedConstant, T.Null); | 648 CheckUnordered(T.UninitializedConstant, T.Null); |
649 CheckUnordered(T.UninitializedConstant, T.Undefined); | 649 CheckUnordered(T.UninitializedConstant, T.Undefined); |
650 } | 650 } |
651 | 651 |
652 void Contains() { | |
653 // T->Contains(V) iff Constant(V)->Is(T) | |
654 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | |
655 for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { | |
656 Type* type = *it; | |
657 Handle<i::Object> value = *vt; | |
658 Type* const_type = T.Constant(value); | |
659 CHECK(type->Contains(value) == const_type->Is(type)); | |
660 } | |
661 } | |
662 } | |
663 | |
664 void Maybe() { | 652 void Maybe() { |
665 // T->Maybe(Any) iff T inhabited | 653 // T->Maybe(Any) iff T inhabited |
666 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 654 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
667 Type* type = *it; | 655 Type* type = *it; |
668 CHECK(type->Maybe(T.Any) == type->IsInhabited()); | 656 CHECK(type->Maybe(T.Any) == type->IsInhabited()); |
669 } | 657 } |
670 | 658 |
671 // T->Maybe(None) never | 659 // T->Maybe(None) never |
672 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 660 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
673 Type* type = *it; | 661 Type* type = *it; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 TEST(MinMax) { Tests().MinMax(); } | 1086 TEST(MinMax) { Tests().MinMax(); } |
1099 | 1087 |
1100 TEST(BitsetGlb) { Tests().BitsetGlb(); } | 1088 TEST(BitsetGlb) { Tests().BitsetGlb(); } |
1101 | 1089 |
1102 TEST(BitsetLub) { Tests().BitsetLub(); } | 1090 TEST(BitsetLub) { Tests().BitsetLub(); } |
1103 | 1091 |
1104 TEST(Is1) { Tests().Is1(); } | 1092 TEST(Is1) { Tests().Is1(); } |
1105 | 1093 |
1106 TEST(Is2) { Tests().Is2(); } | 1094 TEST(Is2) { Tests().Is2(); } |
1107 | 1095 |
1108 TEST(Contains) { Tests().Contains(); } | |
1109 | |
1110 TEST(Maybe) { Tests().Maybe(); } | 1096 TEST(Maybe) { Tests().Maybe(); } |
1111 | 1097 |
1112 TEST(Union1) { Tests().Union1(); } | 1098 TEST(Union1) { Tests().Union1(); } |
1113 | 1099 |
1114 TEST(Union2) { Tests().Union2(); } | 1100 TEST(Union2) { Tests().Union2(); } |
1115 | 1101 |
1116 TEST(Union3) { Tests().Union3(); } | 1102 TEST(Union3) { Tests().Union3(); } |
1117 | 1103 |
1118 TEST(Union4) { Tests().Union4(); } | 1104 TEST(Union4) { Tests().Union4(); } |
1119 | 1105 |
1120 TEST(Intersect) { Tests().Intersect(); } | 1106 TEST(Intersect) { Tests().Intersect(); } |
1121 | 1107 |
1122 TEST(Distributivity) { Tests().Distributivity(); } | 1108 TEST(Distributivity) { Tests().Distributivity(); } |
1123 | 1109 |
1124 TEST(GetRange) { Tests().GetRange(); } | 1110 TEST(GetRange) { Tests().GetRange(); } |
OLD | NEW |