Bug 861857 - TI: Fix testing the intersection between two types. r=jandem, a=bajaj
authorHannes Verschore <hv1989@gmail.com>
Mon, 15 Apr 2013 16:32:28 +0200
changeset 133435 feb577773a0b6c18396093ad2194042c39543a4b
parent 133434 673b1f899184d0b5c4fd104311ffa7b5272f1676
child 133436 367677e9c32cb92934849c9e3202758572b881d8
push id3645
push userryanvm@gmail.com
push dateWed, 17 Apr 2013 20:50:10 +0000
treeherdermozilla-aurora@12e463ae355c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, bajaj
bugs861857
milestone22.0a2
Bug 861857 - TI: Fix testing the intersection between two types. r=jandem, a=bajaj
js/src/jsinfer.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -368,36 +368,38 @@ bool
 TypeSet::intersectionEmpty(TypeSet *other)
 {
     // For unknown/unknownObject there is no reason they couldn't intersect.
     // I.e. we eagerly return their intersection isn't empty.
     // That's ok, since we can't make predictions that can be checked to not hold.
     if (unknown() || other->unknown())
         return false;
 
-    if (unknownObject() && unknownObject())
+    if (unknownObject() && other->unknownObject())
         return false;
 
     if (unknownObject() && other->getObjectCount() > 0)
         return false;
 
     if (other->unknownObject() && getObjectCount() > 0)
         return false;
 
     // Test if there is an intersection in the baseFlags
     if ((baseFlags() & other->baseFlags()) != 0)
         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;
 }
 
 inline void
 TypeSet::addTypesToConstraint(JSContext *cx, TypeConstraint *constraint)
 {