| Index: src/types.h
|
| diff --git a/src/types.h b/src/types.h
|
| index 8490cbb2ed1ecb74493d8f9d20cc8bc9f7443af9..bd96ddefce08f4935b9ddb4788b761bb259b47d1 100644
|
| --- a/src/types.h
|
| +++ b/src/types.h
|
| @@ -787,6 +787,7 @@ class TypeImpl<Config>::RangeType : public StructuralType {
|
|
|
| static RangeHandle New(
|
| i::Handle<i::Object> min, i::Handle<i::Object> max, Region* region) {
|
| + DCHECK(IsInteger(min->Number()) && IsInteger(max->Number()));
|
| DCHECK(min->Number() <= max->Number());
|
| RangeHandle type = Config::template cast<RangeType>(
|
| StructuralType::New(StructuralType::kRangeTag, 3, region));
|
| @@ -801,6 +802,18 @@ class TypeImpl<Config>::RangeType : public StructuralType {
|
| return New(lim.min, lim.max, region);
|
| }
|
|
|
| + // Returns the least integers-only supertype that's not a range. If there is
|
| + // no such supertype, it returns Range(-inf, +inf) instead.
|
| + TypeHandle Weaken(Region* region) {
|
| + bitset lub = this->BitsetLub();
|
| + if (BitsetType::Is(SEMANTIC(BitsetType::kOtherNumber), lub)) {
|
| + return New(
|
| + Config::factory(region)->NewNumber(-V8_INFINITY),
|
| + Config::factory(region)->NewNumber(+V8_INFINITY), region);
|
| + }
|
| + return BitsetType::New(lub, region);
|
| + }
|
| +
|
| static RangeType* cast(TypeImpl* type) {
|
| DCHECK(type->IsRange());
|
| return static_cast<RangeType*>(type);
|
| @@ -947,6 +960,10 @@ struct ZoneTypeConfig {
|
| static inline i::Handle<V> struct_get_value(Struct* structure, int i);
|
| template<class V> static inline void struct_set_value(
|
| Struct* structure, int i, i::Handle<V> x);
|
| +
|
| + static inline Factory* factory(Zone* zone) {
|
| + return zone->isolate()->factory();
|
| + }
|
| };
|
|
|
| typedef TypeImpl<ZoneTypeConfig> Type;
|
| @@ -995,6 +1012,10 @@ struct HeapTypeConfig {
|
| template<class V>
|
| static inline void struct_set_value(
|
| i::Handle<Struct> structure, int i, i::Handle<V> x);
|
| +
|
| + static inline Factory* factory(Isolate* isolate) {
|
| + return isolate->factory();
|
| + }
|
| };
|
|
|
| typedef TypeImpl<HeapTypeConfig> HeapType;
|
|
|