Bug 900890 - IonMonkey: Use a dedicated register to unbox the index of SetElementIC. r=jandem a=lsblakk
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Fri, 09 Aug 2013 11:49:40 -0700
changeset 153712 4b9e3bd42389723c557dbc56f8489a6dcbdc53d3
parent 153711 f8dceda8a125976d4b2d379d67a01346a96dfb3b
child 153713 7c8d69378d3a034aa733c4f5bfa631749f71da55
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, lsblakk
bugs900890
milestone25.0a2
Bug 900890 - IonMonkey: Use a dedicated register to unbox the index of SetElementIC. r=jandem a=lsblakk
js/src/ion/CodeGenerator.cpp
js/src/ion/IonCaches.cpp
js/src/ion/IonCaches.h
js/src/ion/LIR-Common.h
js/src/ion/Lowering.cpp
--- a/js/src/ion/CodeGenerator.cpp
+++ b/js/src/ion/CodeGenerator.cpp
@@ -5949,41 +5949,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/ion/IonCaches.cpp
+++ b/js/src/ion/IonCaches.cpp
@@ -2693,21 +2693,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/ion/IonCaches.h
+++ b/js/src/ion/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/ion/LIR-Common.h
+++ b/js/src/ion/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/ion/Lowering.cpp
+++ b/js/src/ion/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);
 }