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 149144 23b7a978c567c2ea7ec4ffa1182122adbaffbe8b
parent 149143 bfd9bfa0505f8f1291792d49f74c594aabbeabcb
child 149145 e79e40a382d4fae4c016c7e7549b61fc21d08e78
child 149152 fbf4385d454eb74c280755cd624ea926d8054c8b
child 149154 3fa6204004ee3a284b842c00e6de5a93644c0319
child 149163 c2fd15c0427e4061149368ff84252de6640e9667
child 149166 f0b4b17d3305a363ca8495dc8914081c0524de10
child 149169 e0655b8558c0b98f7f40b0cf101978a35f996e64
child 149175 0ee448675b4a246466de601df48827b00da9f400
push id368
push userbbajaj@mozilla.com
push dateMon, 09 Sep 2013 22:57:58 +0000
treeherdermozilla-release@5a4f47ae1217 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, lsblakk
bugs900890
milestone24.0
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
@@ -5682,41 +5682,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
@@ -2608,21 +2608,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
@@ -686,50 +686,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
@@ -3993,66 +3993,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
@@ -2422,27 +2422,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);
 }