| 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/hydrogen-types.h" | 7 #include "src/hydrogen-types.h" |
| 8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
| 9 #include "src/types.h" | 9 #include "src/types.h" |
| 10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 typedef uint32_t bitset; | 29 typedef uint32_t bitset; |
| 30 | 30 |
| 31 | 31 |
| 32 struct ZoneRep { | 32 struct ZoneRep { |
| 33 typedef void* Struct; | 33 typedef void* Struct; |
| 34 | 34 |
| 35 static bool IsStruct(Type* t, int tag) { | 35 static bool IsStruct(Type* t, int tag) { |
| 36 return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag; | 36 return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag; |
| 37 } | 37 } |
| 38 static bool IsBitset(Type* t) { return reinterpret_cast<uintptr_t>(t) & 1; } | 38 static bool IsBitset(Type* t) { return reinterpret_cast<uintptr_t>(t) & 1; } |
| 39 static bool IsUnion(Type* t) { return IsStruct(t, 6); } | 39 // HACK: the number 5 below is the value of StructuralType::kUnionTag. |
| 40 static bool IsUnion(Type* t) { return t->IsUnionForTesting(); } |
| 40 | 41 |
| 41 static Struct* AsStruct(Type* t) { | 42 static Struct* AsStruct(Type* t) { |
| 42 return reinterpret_cast<Struct*>(t); | 43 return reinterpret_cast<Struct*>(t); |
| 43 } | 44 } |
| 44 static bitset AsBitset(Type* t) { | 45 static bitset AsBitset(Type* t) { |
| 45 return static_cast<bitset>(reinterpret_cast<uintptr_t>(t) ^ 1u); | 46 return static_cast<bitset>(reinterpret_cast<uintptr_t>(t) ^ 1u); |
| 46 } | 47 } |
| 47 static Struct* AsUnion(Type* t) { | 48 static Struct* AsUnion(Type* t) { |
| 48 return AsStruct(t); | 49 return AsStruct(t); |
| 49 } | 50 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 | 65 |
| 65 struct HeapRep { | 66 struct HeapRep { |
| 66 typedef FixedArray Struct; | 67 typedef FixedArray Struct; |
| 67 | 68 |
| 68 static bool IsStruct(Handle<HeapType> t, int tag) { | 69 static bool IsStruct(Handle<HeapType> t, int tag) { |
| 69 return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag; | 70 return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag; |
| 70 } | 71 } |
| 71 static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); } | 72 static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); } |
| 72 static bool IsUnion(Handle<HeapType> t) { return IsStruct(t, 6); } | 73 // HACK: the number 5 below is the value of StructuralType::kUnionTag. |
| 74 static bool IsUnion(Handle<HeapType> t) { return t->IsUnionForTesting(); } |
| 73 | 75 |
| 74 static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); } | 76 static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); } |
| 75 static bitset AsBitset(Handle<HeapType> t) { | 77 static bitset AsBitset(Handle<HeapType> t) { |
| 76 return static_cast<bitset>(reinterpret_cast<uintptr_t>(*t)); | 78 return static_cast<bitset>(reinterpret_cast<uintptr_t>(*t)); |
| 77 } | 79 } |
| 78 static Struct* AsUnion(Handle<HeapType> t) { return AsStruct(t); } | 80 static Struct* AsUnion(Handle<HeapType> t) { return AsStruct(t); } |
| 79 static int Length(Struct* structured) { return structured->length() - 1; } | 81 static int Length(Struct* structured) { return structured->length() - 1; } |
| 80 | 82 |
| 81 static Isolate* ToRegion(Zone* zone, Isolate* isolate) { return isolate; } | 83 static Isolate* ToRegion(Zone* zone, Isolate* isolate) { return isolate; } |
| 82 | 84 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.PlainNumber)); | 346 CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.PlainNumber)); |
| 345 CHECK(!T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.Integral32)); | 347 CHECK(!T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.Integral32)); |
| 346 CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.PlainNumber)); | 348 CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.PlainNumber)); |
| 347 CHECK(!T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.Integral32)); | 349 CHECK(!T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.Integral32)); |
| 348 } | 350 } |
| 349 | 351 |
| 350 void Range() { | 352 void Range() { |
| 351 // Constructor | 353 // Constructor |
| 352 for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { | 354 for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { |
| 353 for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { | 355 for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { |
| 354 i::Handle<i::Object> min = *i; | 356 double min = (*i)->Number(); |
| 355 i::Handle<i::Object> max = *j; | 357 double max = (*j)->Number(); |
| 356 if (min->Number() > max->Number()) std::swap(min, max); | 358 if (min > max) std::swap(min, max); |
| 357 TypeHandle type = T.Range(min, max); | 359 TypeHandle type = T.Range(min, max); |
| 358 CHECK(type->IsRange()); | 360 CHECK(type->IsRange()); |
| 359 } | 361 } |
| 360 } | 362 } |
| 361 | 363 |
| 362 // Range attributes | 364 // Range attributes |
| 363 for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { | 365 for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { |
| 364 for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { | 366 for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { |
| 365 i::Handle<i::Object> min = *i; | 367 double min = (*i)->Number(); |
| 366 i::Handle<i::Object> max = *j; | 368 double max = (*j)->Number(); |
| 367 if (min->Number() > max->Number()) std::swap(min, max); | 369 if (min > max) std::swap(min, max); |
| 368 TypeHandle type = T.Range(min, max); | 370 TypeHandle type = T.Range(min, max); |
| 369 CHECK(*min == *type->AsRange()->Min()); | 371 CHECK(min == type->AsRange()->Min()); |
| 370 CHECK(*max == *type->AsRange()->Max()); | 372 CHECK(max == type->AsRange()->Max()); |
| 371 } | 373 } |
| 372 } | 374 } |
| 373 | 375 |
| 374 // Functionality & Injectivity: | 376 // Functionality & Injectivity: |
| 375 // Range(min1, max1) = Range(min2, max2) <=> min1 = min2 /\ max1 = max2 | 377 // Range(min1, max1) = Range(min2, max2) <=> min1 = min2 /\ max1 = max2 |
| 376 for (ValueIterator i1 = T.integers.begin(); | 378 for (ValueIterator i1 = T.integers.begin(); |
| 377 i1 != T.integers.end(); ++i1) { | 379 i1 != T.integers.end(); ++i1) { |
| 378 for (ValueIterator j1 = i1; | 380 for (ValueIterator j1 = i1; |
| 379 j1 != T.integers.end(); ++j1) { | 381 j1 != T.integers.end(); ++j1) { |
| 380 for (ValueIterator i2 = T.integers.begin(); | 382 for (ValueIterator i2 = T.integers.begin(); |
| 381 i2 != T.integers.end(); ++i2) { | 383 i2 != T.integers.end(); ++i2) { |
| 382 for (ValueIterator j2 = i2; | 384 for (ValueIterator j2 = i2; |
| 383 j2 != T.integers.end(); ++j2) { | 385 j2 != T.integers.end(); ++j2) { |
| 384 i::Handle<i::Object> min1 = *i1; | 386 double min1 = (*i1)->Number(); |
| 385 i::Handle<i::Object> max1 = *j1; | 387 double max1 = (*j1)->Number(); |
| 386 i::Handle<i::Object> min2 = *i2; | 388 double min2 = (*i2)->Number(); |
| 387 i::Handle<i::Object> max2 = *j2; | 389 double max2 = (*j2)->Number(); |
| 388 if (min1->Number() > max1->Number()) std::swap(min1, max1); | 390 if (min1 > max1) std::swap(min1, max1); |
| 389 if (min2->Number() > max2->Number()) std::swap(min2, max2); | 391 if (min2 > max2) std::swap(min2, max2); |
| 390 TypeHandle type1 = T.Range(min1, max1); | 392 TypeHandle type1 = T.Range(min1, max1); |
| 391 TypeHandle type2 = T.Range(min2, max2); | 393 TypeHandle type2 = T.Range(min2, max2); |
| 392 CHECK(Equal(type1, type2) == (*min1 == *min2 && *max1 == *max2)); | 394 CHECK(Equal(type1, type2) == (min1 == min2 && max1 == max2)); |
| 393 } | 395 } |
| 394 } | 396 } |
| 395 } | 397 } |
| 396 } | 398 } |
| 397 } | 399 } |
| 398 | 400 |
| 399 void Context() { | 401 void Context() { |
| 400 // Constructor | 402 // Constructor |
| 401 for (int i = 0; i < 20; ++i) { | 403 for (int i = 0; i < 20; ++i) { |
| 402 TypeHandle type = T.Random(); | 404 TypeHandle type = T.Random(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 TypeHandle type = *it; | 603 TypeHandle type = *it; |
| 602 TypeHandle const_type = T.Constant(value); | 604 TypeHandle const_type = T.Constant(value); |
| 603 TypeHandle nowof_type = T.NowOf(value); | 605 TypeHandle nowof_type = T.NowOf(value); |
| 604 CHECK(!const_type->Is(type) || | 606 CHECK(!const_type->Is(type) || |
| 605 nowof_type->Is(type) || type->Maybe(const_type)); | 607 nowof_type->Is(type) || type->Maybe(const_type)); |
| 606 } | 608 } |
| 607 } | 609 } |
| 608 } | 610 } |
| 609 | 611 |
| 610 void MinMax() { | 612 void MinMax() { |
| 611 Factory* fac = isolate->factory(); | |
| 612 | |
| 613 // If b is regular numeric bitset, then Range(b->Min(), b->Max())->Is(b). | 613 // If b is regular numeric bitset, then Range(b->Min(), b->Max())->Is(b). |
| 614 // TODO(neis): Need to ignore representation for this to be true. | 614 // TODO(neis): Need to ignore representation for this to be true. |
| 615 /* | 615 /* |
| 616 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 616 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
| 617 TypeHandle type = *it; | 617 TypeHandle type = *it; |
| 618 if (this->IsBitset(type) && type->Is(T.Number) && | 618 if (this->IsBitset(type) && type->Is(T.Number) && |
| 619 !type->Is(T.None) && !type->Is(T.NaN)) { | 619 !type->Is(T.None) && !type->Is(T.NaN)) { |
| 620 TypeHandle range = T.Range( | 620 TypeHandle range = T.Range( |
| 621 isolate->factory()->NewNumber(type->Min()), | 621 isolate->factory()->NewNumber(type->Min()), |
| 622 isolate->factory()->NewNumber(type->Max())); | 622 isolate->factory()->NewNumber(type->Max())); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 Rep::BitsetType::Lub(type), T.region()); | 655 Rep::BitsetType::Lub(type), T.region()); |
| 656 CHECK(lub->Min() <= type->Min() && type->Max() <= lub->Max()); | 656 CHECK(lub->Min() <= type->Min() && type->Max() <= lub->Max()); |
| 657 } | 657 } |
| 658 } | 658 } |
| 659 | 659 |
| 660 // Rangification: If T->Is(Range(-inf,+inf)) and !T->Is(None), then | 660 // Rangification: If T->Is(Range(-inf,+inf)) and !T->Is(None), then |
| 661 // T->Is(Range(T->Min(), T->Max())). | 661 // T->Is(Range(T->Min(), T->Max())). |
| 662 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 662 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
| 663 TypeHandle type = *it; | 663 TypeHandle type = *it; |
| 664 CHECK(!(type->Is(T.Integer) && !type->Is(T.None)) || | 664 CHECK(!(type->Is(T.Integer) && !type->Is(T.None)) || |
| 665 type->Is(T.Range(fac->NewNumber(type->Min()), | 665 type->Is(T.Range(type->Min(), type->Max()))); |
| 666 fac->NewNumber(type->Max())))); | |
| 667 } | 666 } |
| 668 } | 667 } |
| 669 | 668 |
| 670 void BitsetGlb() { | 669 void BitsetGlb() { |
| 671 // Lower: (T->BitsetGlb())->Is(T) | 670 // Lower: (T->BitsetGlb())->Is(T) |
| 672 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 671 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
| 673 TypeHandle type = *it; | 672 TypeHandle type = *it; |
| 674 TypeHandle glb = | 673 TypeHandle glb = |
| 675 Rep::BitsetType::New(Rep::BitsetType::Glb(type), T.region()); | 674 Rep::BitsetType::New(Rep::BitsetType::Glb(type), T.region()); |
| 676 CHECK(glb->Is(type)); | 675 CHECK(glb->Is(type)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 | 820 |
| 822 // Range(X1, Y1)->Is(Range(X2, Y2)) iff X1 >= X2 /\ Y1 <= Y2 | 821 // Range(X1, Y1)->Is(Range(X2, Y2)) iff X1 >= X2 /\ Y1 <= Y2 |
| 823 for (ValueIterator i1 = T.integers.begin(); | 822 for (ValueIterator i1 = T.integers.begin(); |
| 824 i1 != T.integers.end(); ++i1) { | 823 i1 != T.integers.end(); ++i1) { |
| 825 for (ValueIterator j1 = i1; | 824 for (ValueIterator j1 = i1; |
| 826 j1 != T.integers.end(); ++j1) { | 825 j1 != T.integers.end(); ++j1) { |
| 827 for (ValueIterator i2 = T.integers.begin(); | 826 for (ValueIterator i2 = T.integers.begin(); |
| 828 i2 != T.integers.end(); ++i2) { | 827 i2 != T.integers.end(); ++i2) { |
| 829 for (ValueIterator j2 = i2; | 828 for (ValueIterator j2 = i2; |
| 830 j2 != T.integers.end(); ++j2) { | 829 j2 != T.integers.end(); ++j2) { |
| 831 i::Handle<i::Object> min1 = *i1; | 830 double min1 = (*i1)->Number(); |
| 832 i::Handle<i::Object> max1 = *j1; | 831 double max1 = (*j1)->Number(); |
| 833 i::Handle<i::Object> min2 = *i2; | 832 double min2 = (*i2)->Number(); |
| 834 i::Handle<i::Object> max2 = *j2; | 833 double max2 = (*j2)->Number(); |
| 835 if (min1->Number() > max1->Number()) std::swap(min1, max1); | 834 if (min1 > max1) std::swap(min1, max1); |
| 836 if (min2->Number() > max2->Number()) std::swap(min2, max2); | 835 if (min2 > max2) std::swap(min2, max2); |
| 837 TypeHandle type1 = T.Range(min1, max1); | 836 TypeHandle type1 = T.Range(min1, max1); |
| 838 TypeHandle type2 = T.Range(min2, max2); | 837 TypeHandle type2 = T.Range(min2, max2); |
| 839 CHECK(type1->Is(type2) == | 838 CHECK(type1->Is(type2) == (min1 >= min2 && max1 <= max2)); |
| 840 (min1->Number() >= min2->Number() && | |
| 841 max1->Number() <= max2->Number())); | |
| 842 } | 839 } |
| 843 } | 840 } |
| 844 } | 841 } |
| 845 } | 842 } |
| 846 | 843 |
| 847 // Constant(V1)->Is(Constant(V2)) iff V1 = V2 | 844 // Constant(V1)->Is(Constant(V2)) iff V1 = V2 |
| 848 for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { | 845 for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { |
| 849 for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { | 846 for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { |
| 850 Handle<i::Object> value1 = *vt1; | 847 Handle<i::Object> value1 = *vt1; |
| 851 Handle<i::Object> value2 = *vt2; | 848 Handle<i::Object> value2 = *vt2; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 } | 888 } |
| 892 } | 889 } |
| 893 | 890 |
| 894 | 891 |
| 895 // Range-specific subtyping | 892 // Range-specific subtyping |
| 896 | 893 |
| 897 // If IsInteger(v) then Constant(v)->Is(Range(v, v)). | 894 // If IsInteger(v) then Constant(v)->Is(Range(v, v)). |
| 898 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 895 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
| 899 TypeHandle type = *it; | 896 TypeHandle type = *it; |
| 900 if (type->IsConstant() && IsInteger(*type->AsConstant()->Value())) { | 897 if (type->IsConstant() && IsInteger(*type->AsConstant()->Value())) { |
| 901 CHECK(type->Is( | 898 CHECK(type->Is(T.Range(type->AsConstant()->Value()->Number(), |
| 902 T.Range(type->AsConstant()->Value(), type->AsConstant()->Value()))); | 899 type->AsConstant()->Value()->Number()))); |
| 903 } | 900 } |
| 904 } | 901 } |
| 905 | 902 |
| 906 // If Constant(x)->Is(Range(min,max)) then IsInteger(v) and min <= x <= max. | 903 // If Constant(x)->Is(Range(min,max)) then IsInteger(v) and min <= x <= max. |
| 907 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 904 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
| 908 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 905 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
| 909 TypeHandle type1 = *it1; | 906 TypeHandle type1 = *it1; |
| 910 TypeHandle type2 = *it2; | 907 TypeHandle type2 = *it2; |
| 911 if (type1->IsConstant() && type2->IsRange() && type1->Is(type2)) { | 908 if (type1->IsConstant() && type2->IsRange() && type1->Is(type2)) { |
| 912 double x = type1->AsConstant()->Value()->Number(); | 909 double x = type1->AsConstant()->Value()->Number(); |
| 913 double min = type2->AsRange()->Min()->Number(); | 910 double min = type2->AsRange()->Min(); |
| 914 double max = type2->AsRange()->Max()->Number(); | 911 double max = type2->AsRange()->Max(); |
| 915 CHECK(IsInteger(x) && min <= x && x <= max); | 912 CHECK(IsInteger(x) && min <= x && x <= max); |
| 916 } | 913 } |
| 917 } | 914 } |
| 918 } | 915 } |
| 919 | 916 |
| 920 // Lub(Range(x,y))->Is(T.Union(T.Integral32, T.OtherNumber)) | 917 // Lub(Range(x,y))->Is(T.Union(T.Integral32, T.OtherNumber)) |
| 921 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 918 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
| 922 TypeHandle type = *it; | 919 TypeHandle type = *it; |
| 923 if (type->IsRange()) { | 920 if (type->IsRange()) { |
| 924 TypeHandle lub = Rep::BitsetType::New( | 921 TypeHandle lub = Rep::BitsetType::New( |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 } | 1838 } |
| 1842 */ | 1839 */ |
| 1843 } | 1840 } |
| 1844 | 1841 |
| 1845 void GetRange() { | 1842 void GetRange() { |
| 1846 // GetRange(Range(a, b)) = Range(a, b). | 1843 // GetRange(Range(a, b)) = Range(a, b). |
| 1847 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1844 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
| 1848 TypeHandle type1 = *it1; | 1845 TypeHandle type1 = *it1; |
| 1849 if (type1->IsRange()) { | 1846 if (type1->IsRange()) { |
| 1850 typename Type::RangeType* range = type1->GetRange(); | 1847 typename Type::RangeType* range = type1->GetRange(); |
| 1851 CHECK(type1->Min() == range->Min()->Number()); | 1848 CHECK(type1->Min() == range->Min()); |
| 1852 CHECK(type1->Max() == range->Max()->Number()); | 1849 CHECK(type1->Max() == range->Max()); |
| 1853 } | 1850 } |
| 1854 } | 1851 } |
| 1855 | 1852 |
| 1856 // GetRange(Union(Constant(x), Range(min,max))) == Range(min, max). | 1853 // GetRange(Union(Constant(x), Range(min,max))) == Range(min, max). |
| 1857 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { | 1854 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { |
| 1858 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { | 1855 for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { |
| 1859 TypeHandle type1 = *it1; | 1856 TypeHandle type1 = *it1; |
| 1860 TypeHandle type2 = *it2; | 1857 TypeHandle type2 = *it2; |
| 1861 if (type1->IsConstant() && type2->IsRange()) { | 1858 if (type1->IsConstant() && type2->IsRange()) { |
| 1862 TypeHandle u = T.Union(type1, type2); | 1859 TypeHandle u = T.Union(type1, type2); |
| 1863 | 1860 |
| 1864 CHECK(type2->Min() == u->GetRange()->Min()->Number()); | 1861 CHECK(type2->Min() == u->GetRange()->Min()); |
| 1865 CHECK(type2->Max() == u->GetRange()->Max()->Number()); | 1862 CHECK(type2->Max() == u->GetRange()->Max()); |
| 1866 } | 1863 } |
| 1867 } | 1864 } |
| 1868 } | 1865 } |
| 1869 } | 1866 } |
| 1870 | 1867 |
| 1871 template<class Type2, class TypeHandle2, class Region2, class Rep2> | 1868 template<class Type2, class TypeHandle2, class Region2, class Rep2> |
| 1872 void Convert() { | 1869 void Convert() { |
| 1873 Types<Type2, TypeHandle2, Region2> T2( | 1870 Types<Type2, TypeHandle2, Region2> T2( |
| 1874 Rep2::ToRegion(&zone, isolate), isolate); | 1871 Rep2::ToRegion(&zone, isolate), isolate); |
| 1875 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { | 1872 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | 2076 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
| 2080 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | 2077 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); |
| 2081 } | 2078 } |
| 2082 | 2079 |
| 2083 | 2080 |
| 2084 TEST(HTypeFromType) { | 2081 TEST(HTypeFromType) { |
| 2085 CcTest::InitializeVM(); | 2082 CcTest::InitializeVM(); |
| 2086 ZoneTests().HTypeFromType(); | 2083 ZoneTests().HTypeFromType(); |
| 2087 HeapTests().HTypeFromType(); | 2084 HeapTests().HTypeFromType(); |
| 2088 } | 2085 } |
| OLD | NEW |