Remove Type::Array bit and replace with Type::GlobalObject

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1074133002

Cr-Commit-Position: refs/heads/master@{#27749}
This commit is contained in:
titzer 2015-04-10 06:29:37 -07:00 committed by Commit bot
parent 8c98cc074e
commit 277be506c8
6 changed files with 119 additions and 47 deletions

View File

@ -22,7 +22,6 @@ HType HType::FromType(typename T::TypeHandle type) {
if (type->Is(T::String())) return HType::String(); if (type->Is(T::String())) return HType::String();
if (type->Is(T::Boolean())) return HType::Boolean(); if (type->Is(T::Boolean())) return HType::Boolean();
if (type->Is(T::Undefined())) return HType::Undefined(); if (type->Is(T::Undefined())) return HType::Undefined();
if (type->Is(T::Array())) return HType::JSArray();
if (type->Is(T::Object())) return HType::JSObject(); if (type->Is(T::Object())) return HType::JSObject();
if (type->Is(T::Receiver())) return HType::JSReceiver(); if (type->Is(T::Receiver())) return HType::JSReceiver();
return HType::Tagged(); return HType::Tagged();

View File

@ -178,7 +178,7 @@ TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) {
if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset(); if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset();
if (type->IsRange()) return type->AsRange()->Bound(); if (type->IsRange()) return type->AsRange()->Bound();
if (type->IsContext()) return kInternal & kTaggedPointer; if (type->IsContext()) return kInternal & kTaggedPointer;
if (type->IsArray()) return kArray; if (type->IsArray()) return kOtherObject;
if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction
UNREACHABLE(); UNREACHABLE();
return kNone; return kNone;
@ -234,10 +234,10 @@ TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
case JS_CONTEXT_EXTENSION_OBJECT_TYPE: case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case JS_GENERATOR_OBJECT_TYPE: case JS_GENERATOR_OBJECT_TYPE:
case JS_MODULE_TYPE: case JS_MODULE_TYPE:
case JS_GLOBAL_OBJECT_TYPE:
case JS_BUILTINS_OBJECT_TYPE: case JS_BUILTINS_OBJECT_TYPE:
case JS_GLOBAL_PROXY_TYPE: case JS_GLOBAL_PROXY_TYPE:
case JS_ARRAY_BUFFER_TYPE: case JS_ARRAY_BUFFER_TYPE:
case JS_ARRAY_TYPE:
case JS_TYPED_ARRAY_TYPE: case JS_TYPED_ARRAY_TYPE:
case JS_DATA_VIEW_TYPE: case JS_DATA_VIEW_TYPE:
case JS_SET_TYPE: case JS_SET_TYPE:
@ -248,8 +248,8 @@ TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
case JS_WEAK_SET_TYPE: case JS_WEAK_SET_TYPE:
if (map->is_undetectable()) return kUndetectable; if (map->is_undetectable()) return kUndetectable;
return kOtherObject; return kOtherObject;
case JS_ARRAY_TYPE: case JS_GLOBAL_OBJECT_TYPE:
return kArray; return kGlobalObject;
case JS_FUNCTION_TYPE: case JS_FUNCTION_TYPE:
return kOtherObject; // TODO(rossberg): there should be a Function type. return kOtherObject; // TODO(rossberg): there should be a Function type.
case JS_REGEXP_TYPE: case JS_REGEXP_TYPE:

View File

@ -208,7 +208,7 @@ namespace internal {
V(InternalizedString, 1u << 13 | REPRESENTATION(kTaggedPointer)) \ V(InternalizedString, 1u << 13 | REPRESENTATION(kTaggedPointer)) \
V(OtherString, 1u << 14 | REPRESENTATION(kTaggedPointer)) \ V(OtherString, 1u << 14 | REPRESENTATION(kTaggedPointer)) \
V(Undetectable, 1u << 15 | REPRESENTATION(kTaggedPointer)) \ V(Undetectable, 1u << 15 | REPRESENTATION(kTaggedPointer)) \
V(Array, 1u << 16 | REPRESENTATION(kTaggedPointer)) \ V(GlobalObject, 1u << 16 | REPRESENTATION(kTaggedPointer)) \
V(OtherObject, 1u << 17 | REPRESENTATION(kTaggedPointer)) \ V(OtherObject, 1u << 17 | REPRESENTATION(kTaggedPointer)) \
V(Proxy, 1u << 18 | REPRESENTATION(kTaggedPointer)) \ V(Proxy, 1u << 18 | REPRESENTATION(kTaggedPointer)) \
V(Internal, 1u << 19 | REPRESENTATION(kTagged | kUntagged)) \ V(Internal, 1u << 19 | REPRESENTATION(kTagged | kUntagged)) \
@ -228,7 +228,7 @@ namespace internal {
V(NumberOrString, kNumber | kString) \ V(NumberOrString, kNumber | kString) \
V(PlainPrimitive, kNumberOrString | kBoolean | kNull | kUndefined) \ V(PlainPrimitive, kNumberOrString | kBoolean | kNull | kUndefined) \
V(Primitive, kSymbol | kPlainPrimitive) \ V(Primitive, kSymbol | kPlainPrimitive) \
V(DetectableObject, kArray | kOtherObject) \ V(DetectableObject, kGlobalObject | kOtherObject) \
V(DetectableReceiver, kDetectableObject | kProxy) \ V(DetectableReceiver, kDetectableObject | kProxy) \
V(Detectable, kDetectableReceiver | kNumber | kName) \ V(Detectable, kDetectableReceiver | kNumber | kName) \
V(Object, kDetectableObject | kUndetectable) \ V(Object, kDetectableObject | kUndetectable) \

View File

@ -433,7 +433,7 @@ void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) {
RECURSE(Visit(value)); RECURSE(Visit(value));
} }
NarrowType(expr, Bounds(Type::Array(zone()))); NarrowType(expr, Bounds(Type::Object(zone())));
} }

View File

@ -1018,16 +1018,23 @@ struct Tests : Rep {
CheckUnordered(T.InternalizedString, T.Symbol); CheckUnordered(T.InternalizedString, T.Symbol);
CheckSub(T.Object, T.Receiver); CheckSub(T.Object, T.Receiver);
CheckSub(T.Array, T.Object);
CheckSub(T.Proxy, T.Receiver); CheckSub(T.Proxy, T.Receiver);
CheckUnordered(T.Object, T.Proxy); CheckSub(T.OtherObject, T.Object);
CheckSub(T.Undetectable, T.Object);
CheckSub(T.DetectableObject, T.Object);
CheckSub(T.GlobalObject, T.DetectableObject);
CheckSub(T.OtherObject, T.DetectableObject);
CheckSub(T.GlobalObject, T.Object);
CheckSub(T.GlobalObject, T.Receiver);
CheckUnordered(T.Object, T.Proxy);
CheckUnordered(T.GlobalObject, T.OtherObject);
CheckUnordered(T.DetectableObject, T.Undetectable);
// Subtyping between concrete structural types // Subtyping between concrete structural types
CheckSub(T.ObjectClass, T.Object); CheckSub(T.ObjectClass, T.Object);
CheckSub(T.ArrayClass, T.Object); CheckSub(T.ArrayClass, T.OtherObject);
CheckSub(T.ArrayClass, T.Array);
CheckSub(T.UninitializedClass, T.Internal); CheckSub(T.UninitializedClass, T.Internal);
CheckUnordered(T.ObjectClass, T.ArrayClass); CheckUnordered(T.ObjectClass, T.ArrayClass);
CheckUnordered(T.UninitializedClass, T.Null); CheckUnordered(T.UninitializedClass, T.Null);
@ -1039,7 +1046,8 @@ struct Tests : Rep {
CheckSub(T.ObjectConstant1, T.Object); CheckSub(T.ObjectConstant1, T.Object);
CheckSub(T.ObjectConstant2, T.Object); CheckSub(T.ObjectConstant2, T.Object);
CheckSub(T.ArrayConstant, T.Object); CheckSub(T.ArrayConstant, T.Object);
CheckSub(T.ArrayConstant, T.Array); CheckSub(T.ArrayConstant, T.OtherObject);
CheckSub(T.ArrayConstant, T.Receiver);
CheckSub(T.UninitializedConstant, T.Internal); CheckSub(T.UninitializedConstant, T.Internal);
CheckUnordered(T.ObjectConstant1, T.ObjectConstant2); CheckUnordered(T.ObjectConstant1, T.ObjectConstant2);
CheckUnordered(T.ObjectConstant1, T.ArrayConstant); CheckUnordered(T.ObjectConstant1, T.ArrayConstant);
@ -1052,7 +1060,8 @@ struct Tests : Rep {
CheckUnordered(T.ObjectConstant2, T.ArrayClass); CheckUnordered(T.ObjectConstant2, T.ArrayClass);
CheckUnordered(T.ArrayConstant, T.ObjectClass); CheckUnordered(T.ArrayConstant, T.ObjectClass);
CheckSub(T.NumberArray, T.Array); CheckSub(T.NumberArray, T.OtherObject);
CheckSub(T.NumberArray, T.Receiver);
CheckSub(T.NumberArray, T.Object); CheckSub(T.NumberArray, T.Object);
CheckUnordered(T.StringArray, T.AnyArray); CheckUnordered(T.StringArray, T.AnyArray);
@ -1341,7 +1350,8 @@ struct Tests : Rep {
CheckDisjoint(T.String, T.Symbol); CheckDisjoint(T.String, T.Symbol);
CheckDisjoint(T.InternalizedString, T.Symbol); CheckDisjoint(T.InternalizedString, T.Symbol);
CheckOverlap(T.Object, T.Receiver); CheckOverlap(T.Object, T.Receiver);
CheckOverlap(T.Array, T.Object); CheckOverlap(T.OtherObject, T.Object);
CheckOverlap(T.GlobalObject, T.Object);
CheckOverlap(T.Proxy, T.Receiver); CheckOverlap(T.Proxy, T.Receiver);
CheckDisjoint(T.Object, T.Proxy); CheckDisjoint(T.Object, T.Proxy);
@ -1357,14 +1367,14 @@ struct Tests : Rep {
CheckOverlap(T.ObjectConstant1, T.Object); CheckOverlap(T.ObjectConstant1, T.Object);
CheckOverlap(T.ObjectConstant2, T.Object); CheckOverlap(T.ObjectConstant2, T.Object);
CheckOverlap(T.ArrayConstant, T.Object); CheckOverlap(T.ArrayConstant, T.Object);
CheckOverlap(T.ArrayConstant, T.Array); CheckOverlap(T.ArrayConstant, T.Receiver);
CheckOverlap(T.ObjectConstant1, T.ObjectConstant1); CheckOverlap(T.ObjectConstant1, T.ObjectConstant1);
CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2); CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2);
CheckDisjoint(T.ObjectConstant1, T.ArrayConstant); CheckDisjoint(T.ObjectConstant1, T.ArrayConstant);
CheckDisjoint(T.ObjectConstant1, T.ArrayClass); CheckOverlap(T.ObjectConstant1, T.ArrayClass);
CheckDisjoint(T.ObjectConstant2, T.ArrayClass); CheckOverlap(T.ObjectConstant2, T.ArrayClass);
CheckDisjoint(T.ArrayConstant, T.ObjectClass); CheckOverlap(T.ArrayConstant, T.ObjectClass);
CheckOverlap(T.NumberArray, T.Array); CheckOverlap(T.NumberArray, T.Receiver);
CheckDisjoint(T.NumberArray, T.AnyArray); CheckDisjoint(T.NumberArray, T.AnyArray);
CheckDisjoint(T.NumberArray, T.StringArray); CheckDisjoint(T.NumberArray, T.StringArray);
CheckOverlap(T.MethodFunction, T.Object); CheckOverlap(T.MethodFunction, T.Object);
@ -1511,28 +1521,28 @@ struct Tests : Rep {
void Union4() { void Union4() {
// Class-class // Class-class
CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Object); CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Object);
CheckUnordered(T.Union(T.ObjectClass, T.ArrayClass), T.Array); CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.OtherObject);
CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.Array); CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.Receiver);
CheckDisjoint(T.Union(T.ObjectClass, T.ArrayClass), T.Number); CheckDisjoint(T.Union(T.ObjectClass, T.ArrayClass), T.Number);
// Constant-constant // Constant-constant
CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Object); CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Object);
CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayConstant), T.Array); CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.OtherObject);
CheckUnordered( CheckUnordered(
T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ObjectClass); T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ObjectClass);
CheckOverlap( CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.OtherObject);
T.Union(T.ObjectConstant1, T.ArrayConstant), T.Array);
CheckDisjoint( CheckDisjoint(
T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number); T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number);
CheckOverlap( CheckOverlap(
T.Union(T.ObjectConstant1, T.ArrayConstant), T.ObjectClass); // !!! T.Union(T.ObjectConstant1, T.ArrayConstant), T.ObjectClass); // !!!
// Bitset-array // Bitset-array
CHECK(this->IsBitset(T.Union(T.AnyArray, T.Array))); CHECK(this->IsBitset(T.Union(T.AnyArray, T.Receiver)));
CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number))); CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number)));
CheckEqual(T.Union(T.AnyArray, T.Array), T.Array); CheckEqual(T.Union(T.AnyArray, T.Receiver), T.Receiver);
CheckUnordered(T.Union(T.AnyArray, T.String), T.Array); CheckEqual(T.Union(T.AnyArray, T.OtherObject), T.OtherObject);
CheckUnordered(T.Union(T.AnyArray, T.String), T.Receiver);
CheckOverlap(T.Union(T.NumberArray, T.String), T.Object); CheckOverlap(T.Union(T.NumberArray, T.String), T.Object);
CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number); CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number);
@ -1548,27 +1558,26 @@ struct Tests : Rep {
// Bitset-class // Bitset-class
CheckSub(T.Union(T.ObjectClass, T.SignedSmall), CheckSub(T.Union(T.ObjectClass, T.SignedSmall),
T.Union(T.Object, T.Number)); T.Union(T.Object, T.Number));
CheckSub(T.Union(T.ObjectClass, T.Array), T.Object); CheckSub(T.Union(T.ObjectClass, T.OtherObject), T.Object);
CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array); CheckUnordered(T.Union(T.ObjectClass, T.String), T.OtherObject);
CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object); CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object);
CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number); CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number);
// Bitset-constant // Bitset-constant
CheckSub( CheckSub(
T.Union(T.ObjectConstant1, T.Signed32), T.Union(T.Object, T.Number)); T.Union(T.ObjectConstant1, T.Signed32), T.Union(T.Object, T.Number));
CheckSub(T.Union(T.ObjectConstant1, T.Array), T.Object); CheckSub(T.Union(T.ObjectConstant1, T.OtherObject), T.Object);
CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.Array); CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.OtherObject);
CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object); CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object);
CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number); CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number);
// Class-constant // Class-constant
CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object); CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object);
CheckUnordered(T.ObjectClass, T.Union(T.ObjectConstant1, T.ArrayClass)); CheckUnordered(T.ObjectClass, T.Union(T.ObjectConstant1, T.ArrayClass));
CheckSub( CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass),
T.Union(T.ObjectConstant1, T.ArrayClass), T.Union(T.Array, T.Object)); T.Union(T.Receiver, T.Object));
CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.ArrayConstant); CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.ArrayConstant);
CheckDisjoint( CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectConstant2);
T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectConstant2);
CheckOverlap( CheckOverlap(
T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectClass); // !!! T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectClass); // !!!
@ -1603,7 +1612,7 @@ struct Tests : Rep {
CheckEqual( CheckEqual(
T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)), T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)),
T.Union(T.AnyArray, T.NumberArray)); T.Union(T.AnyArray, T.NumberArray));
CheckSub(T.Union(T.AnyArray, T.NumberArray), T.Array); CheckSub(T.Union(T.AnyArray, T.NumberArray), T.OtherObject);
// Function-union // Function-union
CheckEqual( CheckEqual(
@ -1618,8 +1627,8 @@ struct Tests : Rep {
T.Union(T.ObjectConstant1, T.ObjectConstant2)), T.Union(T.ObjectConstant1, T.ObjectConstant2)),
T.Union(T.ObjectConstant2, T.ObjectConstant1)); T.Union(T.ObjectConstant2, T.ObjectConstant1));
CheckEqual(T.Union(T.Union(T.Number, T.ArrayClass), CheckEqual(T.Union(T.Union(T.Number, T.ArrayClass),
T.Union(T.SignedSmall, T.Array)), T.Union(T.SignedSmall, T.Receiver)),
T.Union(T.Number, T.Array)); T.Union(T.Number, T.Receiver));
} }
void Intersect() { void Intersect() {
@ -1763,7 +1772,6 @@ struct Tests : Rep {
// Bitset-class // Bitset-class
CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass); CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass);
CheckEqual(T.Semantic(T.Intersect(T.ObjectClass, T.Array)), T.None);
CheckEqual(T.Semantic(T.Intersect(T.ObjectClass, T.Number)), T.None); CheckEqual(T.Semantic(T.Intersect(T.ObjectClass, T.Number)), T.None);
// Bitset-array // Bitset-array
@ -1784,7 +1792,7 @@ struct Tests : Rep {
// Class-constant // Class-constant
CHECK(T.Intersect(T.ObjectConstant1, T.ObjectClass)->IsInhabited()); // !!! CHECK(T.Intersect(T.ObjectConstant1, T.ObjectClass)->IsInhabited()); // !!!
CHECK(!T.Intersect(T.ArrayClass, T.ObjectConstant2)->IsInhabited()); CHECK(T.Intersect(T.ArrayClass, T.ObjectConstant2)->IsInhabited());
// Array-union // Array-union
CheckEqual( CheckEqual(
@ -1834,13 +1842,11 @@ struct Tests : Rep {
// Union-union // Union-union
CheckEqual(T.Intersect(T.Union(T.Number, T.ArrayClass), CheckEqual(T.Intersect(T.Union(T.Number, T.ArrayClass),
T.Union(T.SignedSmall, T.Array)), T.Union(T.SignedSmall, T.Receiver)),
T.Union(T.SignedSmall, T.ArrayClass)); T.Union(T.SignedSmall, T.ArrayClass));
CheckEqual( CheckEqual(T.Intersect(T.Union(T.Number, T.ObjectClass),
T.Intersect( T.Union(T.Signed32, T.OtherObject)),
T.Union(T.Number, T.ObjectClass), T.Union(T.Signed32, T.ObjectClass));
T.Union(T.Signed32, T.Array)),
T.Signed32);
CheckEqual( CheckEqual(
T.Intersect( T.Intersect(
T.Union(T.ObjectConstant2, T.ObjectConstant1), T.Union(T.ObjectConstant2, T.ObjectConstant1),
@ -1958,6 +1964,66 @@ struct Tests : Rep {
} }
} }
} }
void GlobalObjectType() {
i::Handle<i::Context> context1 = v8::Utils::OpenHandle(
*v8::Context::New(reinterpret_cast<v8::Isolate*>(isolate)));
Handle<i::GlobalObject> global_object1(context1->global_object());
TypeHandle GlobalObjectConstant1 =
Type::Constant(global_object1, Rep::ToRegion(&zone, isolate));
i::Handle<i::Context> context2 = v8::Utils::OpenHandle(
*v8::Context::New(reinterpret_cast<v8::Isolate*>(isolate)));
Handle<i::GlobalObject> global_object2(context2->global_object());
TypeHandle GlobalObjectConstant2 =
Type::Constant(global_object2, Rep::ToRegion(&zone, isolate));
CheckSub(GlobalObjectConstant1, T.DetectableObject);
CheckSub(GlobalObjectConstant2, T.DetectableObject);
CheckSub(GlobalObjectConstant1, T.GlobalObject);
CheckSub(GlobalObjectConstant2, T.GlobalObject);
CheckSub(GlobalObjectConstant1, T.Object);
CheckSub(GlobalObjectConstant2, T.Object);
CheckUnordered(T.GlobalObject, T.OtherObject);
CheckUnordered(GlobalObjectConstant1, T.OtherObject);
CheckUnordered(GlobalObjectConstant2, T.OtherObject);
CheckUnordered(GlobalObjectConstant1, GlobalObjectConstant2);
CheckDisjoint(T.GlobalObject, T.ObjectClass);
CheckDisjoint(GlobalObjectConstant1, T.ObjectClass);
CheckDisjoint(GlobalObjectConstant2, T.ArrayClass);
CheckUnordered(T.Union(T.ObjectClass, T.ArrayClass), T.GlobalObject);
CheckUnordered(T.Union(T.ObjectClass, T.ArrayClass), GlobalObjectConstant1);
CheckUnordered(T.Union(T.ObjectClass, T.ArrayClass), GlobalObjectConstant2);
CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.GlobalObject);
CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass),
GlobalObjectConstant1);
CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass),
GlobalObjectConstant2);
CheckUnordered(T.Union(T.ObjectClass, T.String), T.GlobalObject);
CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass),
T.Union(T.GlobalObject, T.Object));
CheckDisjoint(T.Union(GlobalObjectConstant1, T.ArrayClass),
GlobalObjectConstant2);
CheckEqual(T.Union(T.Union(T.Number, GlobalObjectConstant1),
T.Union(T.SignedSmall, T.GlobalObject)),
T.Union(T.Number, T.GlobalObject));
CheckEqual(T.Semantic(T.Intersect(T.ObjectClass, T.GlobalObject)), T.None);
CHECK(!T.Intersect(T.ArrayClass, GlobalObjectConstant2)->IsInhabited());
CheckEqual(T.Intersect(T.Union(T.Number, T.OtherObject),
T.Union(T.Signed32, T.GlobalObject)),
T.Signed32);
}
}; };
typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests; typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests;
@ -2132,3 +2198,9 @@ TEST(HTypeFromType_zone) { ZoneTests().HTypeFromType(); }
TEST(HTypeFromType_heap) { HeapTests().HTypeFromType(); } TEST(HTypeFromType_heap) { HeapTests().HTypeFromType(); }
TEST(GlobalObjectType_zone) { ZoneTests().GlobalObjectType(); }
TEST(GlobalObjectType_heap) { HeapTests().GlobalObjectType(); }

View File

@ -76,6 +76,7 @@ class Types {
uninitialized = isolate->factory()->uninitialized_value(); uninitialized = isolate->factory()->uninitialized_value();
SmiConstant = Type::Constant(smi, region); SmiConstant = Type::Constant(smi, region);
Signed32Constant = Type::Constant(signed32, region); Signed32Constant = Type::Constant(signed32, region);
ObjectConstant1 = Type::Constant(object1, region); ObjectConstant1 = Type::Constant(object1, region);
ObjectConstant2 = Type::Constant(object2, region); ObjectConstant2 = Type::Constant(object2, region);
ArrayConstant = Type::Constant(array, region); ArrayConstant = Type::Constant(array, region);