Bug 930327 - Don't deoptimize the type of a coerced argument if it has other uses. r=jandem, a=abillings
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 11 Nov 2013 14:50:26 -0500
changeset 167431 6a029d2f649b4cf0a0a3146f3bbb6158e43997fb
parent 167430 f8c34ae74b104c476536cf744518dfe768c881a1
child 167432 e85fb903fc48ebb43fe3e83a0ee04e174ab66c68
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, abillings
bugs930327
milestone27.0a2
Bug 930327 - Don't deoptimize the type of a coerced argument if it has other uses. r=jandem, a=abillings
js/src/jit/IonBuilder.cpp
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -9034,19 +9034,28 @@ IonBuilder::jsop_setarg(uint32_t arg)
      {
          for (size_t i = 0; i < val->numOperands(); i++) {
             MDefinition *op = val->getOperand(i);
             if (op->isParameter() &&
                 op->toParameter()->index() == (int32_t)arg &&
                 op->resultTypeSet() &&
                 op->resultTypeSet()->empty())
             {
-                JS_ASSERT(op->resultTypeSet() == &argTypes[arg]);
-                if (!argTypes[arg].addType(types::Type::UnknownType(), temp_->lifoAlloc()))
-                    return false;
+                bool otherUses = false;
+                for (MUseDefIterator iter(op); iter; iter++) {
+                    MDefinition *def = iter.def();
+                    if (def == val)
+                        continue;
+                    otherUses = true;
+                }
+                if (!otherUses) {
+                    JS_ASSERT(op->resultTypeSet() == &argTypes[arg]);
+                    if (!argTypes[arg].addType(types::Type::UnknownType(), temp_->lifoAlloc()))
+                        return false;
+                }
             }
         }
     }
 
     current->setArg(arg);
     return true;
 }