diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index bae334abc56..508eb23b141 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -378,7 +378,7 @@ TypeSet::intersectionEmpty(TypeSet *other) if (unknown() || other->unknown()) return false; - if (unknownObject() && unknownObject()) + if (unknownObject() && other->unknownObject()) return false; if (unknownObject() && other->getObjectCount() > 0) @@ -392,12 +392,14 @@ TypeSet::intersectionEmpty(TypeSet *other) return false; // Test if there are object that are in both TypeSets - for (unsigned i = 0; i < getObjectCount(); i++) { - TypeObjectKey *obj = getObject(i); - if (!obj) - continue; - if (other->hasType(Type::ObjectType(obj))) - return false; + if (!unknownObject()) { + for (unsigned i = 0; i < getObjectCount(); i++) { + TypeObjectKey *obj = getObject(i); + if (!obj) + continue; + if (other->hasType(Type::ObjectType(obj))) + return false; + } } return true;