Backout 72bd41f8ca61 (bug 777383) to see if it fixes a sunspider regression on 64-bit.
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 26 Jul 2012 17:37:09 +0200
changeset 100579 92f34cddc5a6e34091ae9d077868b9b7394fcd44
parent 100578 1cfacf0e86b4aa1d8dcf556e177a468e4f13df61
child 100580 2e71d9e5e868cd89c47da173914fd3e57c9807a9
push id23185
push usermbrubeck@mozilla.com
push dateThu, 26 Jul 2012 20:58:28 +0000
treeherdermozilla-central@8a7ad0adcccf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs777383
milestone17.0a1
backs out72bd41f8ca6117a0d6d09fd47615bb1fedf04288
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 72bd41f8ca61 (bug 777383) to see if it fixes a sunspider regression on 64-bit.
js/src/jsinfer.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -3112,16 +3112,39 @@ TypeObject::print(JSContext *cx)
 
     printf("\n}\n");
 }
 
 /////////////////////////////////////////////////////////////////////
 // Type Analysis
 /////////////////////////////////////////////////////////////////////
 
+/*
+ * If the bytecode immediately following code/pc is a test of the value
+ * pushed by code, that value should be marked as possibly void.
+ */
+static inline bool
+CheckNextTest(jsbytecode *pc)
+{
+    jsbytecode *next = pc + GetBytecodeLength(pc);
+    switch ((JSOp)*next) {
+      case JSOP_IFEQ:
+      case JSOP_IFNE:
+      case JSOP_NOT:
+      case JSOP_OR:
+      case JSOP_AND:
+      case JSOP_TYPEOF:
+      case JSOP_TYPEOFEXPR:
+        return true;
+      default:
+        /* TRAP ok here */
+        return false;
+    }
+}
+
 static inline TypeObject *
 GetInitializerType(JSContext *cx, JSScript *script, jsbytecode *pc)
 {
     if (!script->hasGlobal())
         return NULL;
 
     JSOp op = JSOp(*pc);
     JS_ASSERT(op == JSOP_NEWARRAY || op == JSOP_NEWOBJECT || op == JSOP_NEWINIT);
@@ -3359,16 +3382,19 @@ ScriptAnalysis::analyzeTypesBytecode(JSC
         if (id == NameToId(cx->runtime->atomState.InfinityAtom))
             seen->addType(cx, Type::DoubleType());
 
         /* Handle as a property access. */
         PropertyAccess(cx, script, pc, script->global().getType(cx), false, seen, id);
 
         if (op == JSOP_CALLGNAME)
             pushed[0].addPropagateThis(cx, script, pc, Type::UnknownType());
+
+        if (CheckNextTest(pc))
+            pushed[0].addType(cx, Type::UndefinedType());
         break;
       }
 
       case JSOP_NAME:
       case JSOP_CALLNAME: {
         TypeSet *seen = bytecodeTypes(pc);
         addTypeBarrier(cx, pc, seen, Type::UnknownType());
         seen->addSubset(cx, &pushed[0]);
@@ -3524,16 +3550,18 @@ ScriptAnalysis::analyzeTypesBytecode(JSC
         jsid id = GetAtomId(cx, script, pc, 0);
         TypeSet *seen = script->analysis()->bytecodeTypes(pc);
 
         poppedTypes(pc, 0)->addGetProperty(cx, script, pc, seen, id);
         if (op == JSOP_CALLPROP)
             poppedTypes(pc, 0)->addCallProperty(cx, script, pc, id);
 
         seen->addSubset(cx, &pushed[0]);
+        if (CheckNextTest(pc))
+            pushed[0].addType(cx, Type::UndefinedType());
         break;
       }
 
       /*
        * We only consider ELEM accesses on integers below. Any element access
        * which is accessing a non-integer property must be monitored.
        */
 
@@ -3541,16 +3569,18 @@ ScriptAnalysis::analyzeTypesBytecode(JSC
       case JSOP_CALLELEM: {
         TypeSet *seen = script->analysis()->bytecodeTypes(pc);
 
         poppedTypes(pc, 1)->addGetProperty(cx, script, pc, seen, JSID_VOID);
 
         seen->addSubset(cx, &pushed[0]);
         if (op == JSOP_CALLELEM)
             pushed[0].addPropagateThis(cx, script, pc, Type::UndefinedType(), poppedTypes(pc, 1));
+        if (CheckNextTest(pc))
+            pushed[0].addType(cx, Type::UndefinedType());
         break;
       }
 
       case JSOP_SETELEM:
         poppedTypes(pc, 1)->addSetElement(cx, script, pc, poppedTypes(pc, 2), poppedTypes(pc, 0));
         poppedTypes(pc, 0)->addSubset(cx, &pushed[0]);
         break;