Fix mochitest failures caused by the patch for bug 498193. r=me.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 17 Mar 2010 09:04:22 +1100
changeset 40285 6eedb7f2c6d1d215a74762e0d8de1f79509a2c1c
parent 40284 975958755e79494abc3f930230e584f685be0a1a
child 40286 7c675b971d31b251c3f85ee37b6da5f256aef540
push id12610
push userrsayre@mozilla.com
push dateMon, 05 Apr 2010 17:26:41 +0000
treeherdermozilla-central@1942c0b4e101 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs498193
milestone1.9.3a3pre
Fix mochitest failures caused by the patch for bug 498193. r=me.
js/src/nanojit/LIR.cpp
--- a/js/src/nanojit/LIR.cpp
+++ b/js/src/nanojit/LIR.cpp
@@ -929,17 +929,27 @@ namespace nanojit
         case LTy_Void:  NanoAssert(0);  break;
         default:        NanoAssert(0);  break;
         }
         return insStore(op, value, base, d, accSet);
     }
 
     LIns* LirWriter::ins_choose(LIns* cond, LIns* iftrue, LIns* iffalse, bool use_cmov)
     {
-        NanoAssert(cond->isCmp());
+        // 'cond' must be a conditional, unless it has been optimized to 0 or
+        // 1.  In that case make it an ==0 test and flip the branches.  It'll
+        // get constant-folded by ExprFilter subsequently.
+        if (!cond->isCmp()) {
+            NanoAssert(cond->isconst());
+            cond = ins_eq0(cond);
+            LInsp tmp = iftrue;
+            iftrue = iffalse;
+            iffalse = tmp;
+        }
+
         if (use_cmov) {
             LOpcode op = LIR_cmov;
             if (iftrue->isI32() && iffalse->isI32()) {
                 op = LIR_cmov;
 #ifdef NANOJIT_64BIT
             } else if (iftrue->isI64() && iffalse->isI64()) {
                 op = LIR_qcmov;
 #endif