Bug 900890 - IonMonkey: Use a dedicated register to unbox the index of SetElementIC. r=jandem
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Fri, 09 Aug 2013 11:49:40 -0700
changeset 154938 2045c5f41beee8aba72140caa017630863464664
parent 154937 ce71b5adcb79b723f805da0cc2eeb4824fa58a76
child 154939 2a769b6e0e56326e42d1afec1c5f11d927081c90
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs900890
milestone26.0a1
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
Bug 900890 - IonMonkey: Use a dedicated register to unbox the index of SetElementIC. r=jandem
js/src/jit/CodeGenerator.cpp
js/src/jit/IonCaches.cpp
js/src/jit/IonCaches.h
js/src/jit/LIR-Common.h
js/src/jit/Lowering.cpp
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -5951,41 +5951,41 @@ CodeGenerator::visitGetElementIC(OutOfLi
     masm.jump(ool->rejoin());
     return true;
 }
 
 bool
 CodeGenerator::visitSetElementCacheV(LSetElementCacheV *ins)
 {
     Register obj = ToRegister(ins->object());
-    Register temp0 = ToRegister(ins->temp0());
-    Register temp1 = ToRegister(ins->temp1());
+    Register unboxIndex = ToTempUnboxRegister(ins->tempToUnboxIndex());
+    Register temp = ToRegister(ins->temp());
     ValueOperand index = ToValue(ins, LSetElementCacheV::Index);
     ConstantOrRegister value = TypedOrValueRegister(ToValue(ins, LSetElementCacheV::Value));
 
-    SetElementIC cache(obj, temp0, temp1, index, value, ins->mir()->strict());
+    SetElementIC cache(obj, unboxIndex, temp, index, value, ins->mir()->strict());
 
     return addCache(ins, allocateCache(cache));
 }
 
 bool
 CodeGenerator::visitSetElementCacheT(LSetElementCacheT *ins)
 {
     Register obj = ToRegister(ins->object());
-    Register temp0 = ToRegister(ins->temp0());
-    Register temp1 = ToRegister(ins->temp1());
+    Register unboxIndex = ToTempUnboxRegister(ins->tempToUnboxIndex());
+    Register temp = ToRegister(ins->temp());
     ValueOperand index = ToValue(ins, LSetElementCacheT::Index);
     ConstantOrRegister value;
     const LAllocation *tmp = ins->value();
     if (tmp->isConstant())
         value = *tmp->toConstant();
     else
         value = TypedOrValueRegister(ins->mir()->value()->type(), ToAnyRegister(tmp));
 
-    SetElementIC cache(obj, temp0, temp1, index, value, ins->mir()->strict());
+    SetElementIC cache(obj, unboxIndex, temp, index, value, ins->mir()->strict());
 
     return addCache(ins, allocateCache(cache));
 }
 
 typedef bool (*SetElementICFn)(JSContext *, size_t, HandleObject, HandleValue, HandleValue);
 const VMFunction SetElementIC::UpdateInfo =
     FunctionInfo<SetElementICFn>(SetElementIC::update);
 
--- a/js/src/jit/IonCaches.cpp
+++ b/js/src/jit/IonCaches.cpp
@@ -2662,21 +2662,21 @@ SetElementIC::attachDenseElement(JSConte
         return false;
     masm.branchTestObjShape(Assembler::NotEqual, object(), shape, &failures);
 
     // Ensure the index is an int32 value.
     ValueOperand indexVal = index();
     masm.branchTestInt32(Assembler::NotEqual, indexVal, &failures);
 
     // Unbox the index.
-    Register index = masm.extractInt32(indexVal, temp0());
+    Register index = masm.extractInt32(indexVal, tempToUnboxIndex());
 
     {
         // Load obj->elements.
-        Register elements = temp1();
+        Register elements = temp();
         masm.loadPtr(Address(object(), JSObject::offsetOfElements()), elements);
 
         // Compute the location of the element.
         BaseIndex target(elements, index, TimesEight);
 
         // Guard that we can increase the initialized length.
         Address capacity(elements, ObjectElements::offsetOfCapacity());
         masm.branch32(Assembler::BelowOrEqual, capacity, index, &outOfBounds);
--- a/js/src/jit/IonCaches.h
+++ b/js/src/jit/IonCaches.h
@@ -702,50 +702,50 @@ class GetElementIC : public RepatchIonCa
                (stubCount_ == 0 && failedUpdates_ > MAX_FAILED_UPDATES);
     }
 };
 
 class SetElementIC : public RepatchIonCache
 {
   protected:
     Register object_;
-    Register temp0_;
-    Register temp1_;
+    Register tempToUnboxIndex_;
+    Register temp_;
     ValueOperand index_;
     ConstantOrRegister value_;
     bool strict_;
 
     bool hasDenseStub_ : 1;
 
   public:
-    SetElementIC(Register object, Register temp0, Register temp1,
+    SetElementIC(Register object, Register tempToUnboxIndex, Register temp,
                  ValueOperand index, ConstantOrRegister value,
                  bool strict)
       : object_(object),
-        temp0_(temp0),
-        temp1_(temp1),
+        tempToUnboxIndex_(tempToUnboxIndex),
+        temp_(temp),
         index_(index),
         value_(value),
         strict_(strict),
         hasDenseStub_(false)
     {
     }
 
     CACHE_HEADER(SetElement)
 
     void reset();
 
     Register object() const {
         return object_;
     }
-    Register temp0() const {
-        return temp0_;
+    Register tempToUnboxIndex() const {
+        return temp_;
     }
-    Register temp1() const {
-        return temp1_;
+    Register temp() const {
+        return temp_;
     }
     ValueOperand index() const {
         return index_;
     }
     ConstantOrRegister value() const {
         return value_;
     }
     bool strict() const {
--- a/js/src/jit/LIR-Common.h
+++ b/js/src/jit/LIR-Common.h
@@ -4171,66 +4171,66 @@ class LSetPropertyCacheT : public LInstr
 class LSetElementCacheV : public LInstructionHelper<0, 1 + 2 * BOX_PIECES, 2>
 {
   public:
     LIR_HEADER(SetElementCacheV);
 
     static const size_t Index = 1;
     static const size_t Value = 1 + BOX_PIECES;
 
-    LSetElementCacheV(const LAllocation &object, const LDefinition &elem,
+    LSetElementCacheV(const LAllocation &object, const LDefinition &tempToUnboxIndex,
                       const LDefinition &temp)
     {
         setOperand(0, object);
-        setTemp(0, elem);
+        setTemp(0, tempToUnboxIndex);
         setTemp(1, temp);
     }
     const MSetElementCache *mir() const {
         return mir_->toSetElementCache();
     }
 
     const LAllocation *object() {
         return getOperand(0);
     }
-    const LDefinition *temp0() {
+    const LDefinition *tempToUnboxIndex() {
         return getTemp(0);
     }
-    const LDefinition *temp1() {
+    const LDefinition *temp() {
         return getTemp(1);
     }
 };
 
 class LSetElementCacheT : public LInstructionHelper<0, 2 + BOX_PIECES, 2>
 {
   public:
     LIR_HEADER(SetElementCacheT);
 
     static const size_t Index = 2;
 
     LSetElementCacheT(const LAllocation &object, const LAllocation &value,
-                      const LDefinition &elem, const LDefinition &temp) {
+                      const LDefinition &tempToUnboxIndex, const LDefinition &temp) {
         setOperand(0, object);
         setOperand(1, value);
-        setTemp(0, elem);
+        setTemp(0, tempToUnboxIndex);
         setTemp(1, temp);
     }
     const MSetElementCache *mir() const {
         return mir_->toSetElementCache();
     }
 
     const LAllocation *object() {
         return getOperand(0);
     }
     const LAllocation *value() {
         return getOperand(1);
     }
-    const LDefinition *temp0() {
+    const LDefinition *tempToUnboxIndex() {
         return getTemp(0);
     }
-    const LDefinition *temp1() {
+    const LDefinition *temp() {
         return getTemp(1);
     }
 };
 
 class LCallIteratorStart : public LCallInstructionHelper<1, 1, 0>
 {
   public:
     LIR_HEADER(CallIteratorStart)
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -2520,27 +2520,27 @@ LIRGenerator::visitSetPropertyCache(MSet
 bool
 LIRGenerator::visitSetElementCache(MSetElementCache *ins)
 {
     JS_ASSERT(ins->object()->type() == MIRType_Object);
     JS_ASSERT(ins->index()->type() == MIRType_Value);
 
     LInstruction *lir;
     if (ins->value()->type() == MIRType_Value) {
-        lir = new LSetElementCacheV(useRegister(ins->object()), temp(), temp());
+        lir = new LSetElementCacheV(useRegister(ins->object()), tempToUnbox(), temp());
 
         if (!useBox(lir, LSetElementCacheV::Index, ins->index()))
             return false;
         if (!useBox(lir, LSetElementCacheV::Value, ins->value()))
             return false;
     } else {
         lir = new LSetElementCacheT(
             useRegister(ins->object()),
             useRegisterOrConstant(ins->value()),
-            temp(), temp());
+            tempToUnbox(), temp());
 
         if (!useBox(lir, LSetElementCacheT::Index, ins->index()))
             return false;
     }
 
     return add(lir, ins) && assignSafepoint(lir, ins);
 }