Back out 1aa1a42a471f:bf03279e2b50 (bug 885169) for b2g/Android bustage on a CLOSED TREE
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 24 Jun 2013 18:00:46 -0700
changeset 136337 971b68a8f9cb
parent 136336 91424f675841
child 136338 a36ee93e4159
push id30044
push userphilringnalda@gmail.com
push dateTue, 25 Jun 2013 01:02:04 +0000
treeherdermozilla-inbound@971b68a8f9cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs885169
milestone25.0a1
backs out1aa1a42a471f
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
Back out 1aa1a42a471f:bf03279e2b50 (bug 885169) for b2g/Android bustage on a CLOSED TREE
js/src/ion/IonFrames.cpp
js/src/ion/IonMacroAssembler.cpp
js/src/ion/RegisterSets.h
js/src/ion/Safepoints.cpp
js/src/ion/arm/MacroAssembler-arm.h
--- a/js/src/ion/IonFrames.cpp
+++ b/js/src/ion/IonFrames.cpp
@@ -291,17 +291,17 @@ IonFrameIterator::machineState() const
     SafepointReader reader(ionScript(), safepoint());
     uintptr_t *spill = spillBase();
 
     // see CodeGeneratorShared::saveLive, we are only copying GPRs for now, FPUs
     // are stored after but are not saved in the safepoint.  This means that we
     // are unable to restore any FPUs registers from an OOL VM call.  This can
     // cause some trouble for f.arguments.
     MachineState machine;
-    for (GeneralRegisterBackwardIterator iter(reader.allSpills()); iter.more(); iter++)
+    for (GeneralRegisterIterator iter(reader.allSpills()); iter.more(); iter++)
         machine.setRegisterLocation(*iter, --spill);
 
     return machine;
 }
 
 static void
 CloseLiveIterator(JSContext *cx, const InlineFrameIterator &frame, uint32_t localSlot)
 {
@@ -714,17 +714,17 @@ MarkIonJSFrame(JSTracer *trc, const IonF
     while (safepoint.getValueSlot(&slot)) {
         Value *v = (Value *)layout->slotRef(slot);
         gc::MarkValueRoot(trc, v, "ion-gc-slot");
     }
 
     uintptr_t *spill = frame.spillBase();
     GeneralRegisterSet gcRegs = safepoint.gcSpills();
     GeneralRegisterSet valueRegs = safepoint.valueSpills();
-    for (GeneralRegisterBackwardIterator iter(safepoint.allSpills()); iter.more(); iter++) {
+    for (GeneralRegisterIterator iter(safepoint.allSpills()); iter.more(); iter++) {
         --spill;
         if (gcRegs.has(*iter))
             gc::MarkGCThingRoot(trc, reinterpret_cast<void **>(spill), "ion-gc-spill");
         else if (valueRegs.has(*iter))
             gc::MarkValueRoot(trc, reinterpret_cast<Value *>(spill), "ion-value-spill");
     }
 
 #ifdef JS_NUNBOX32
--- a/js/src/ion/IonMacroAssembler.cpp
+++ b/js/src/ion/IonMacroAssembler.cpp
@@ -139,38 +139,38 @@ MacroAssembler::PushRegsInMask(RegisterS
 {
     int32_t diffF = set.fpus().size() * sizeof(double);
     int32_t diffG = set.gprs().size() * STACK_SLOT_SIZE;
 
 #ifdef JS_CPU_ARM
     if (set.gprs().size() > 1) {
         adjustFrame(diffG);
         startDataTransferM(IsStore, StackPointer, DB, WriteBack);
-        for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
+        for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
             diffG -= STACK_SLOT_SIZE;
             transferReg(*iter);
         }
         finishDataTransfer();
     } else
 #endif
     {
         reserveStack(diffG);
-        for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
+        for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
             diffG -= STACK_SLOT_SIZE;
             storePtr(*iter, Address(StackPointer, diffG));
         }
     }
     JS_ASSERT(diffG == 0);
 
 #ifdef JS_CPU_ARM
     adjustFrame(diffF);
     diffF += transferMultipleByRuns(set.fpus(), IsStore, StackPointer, DB);
 #else
     reserveStack(diffF);
-    for (FloatRegisterBackwardIterator iter(set.fpus()); iter.more(); iter++) {
+    for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
         diffF -= sizeof(double);
         storeDouble(*iter, Address(StackPointer, diffF));
     }
 #endif
     JS_ASSERT(diffF == 0);
 }
 
 void
@@ -185,38 +185,38 @@ MacroAssembler::PopRegsInMaskIgnore(Regi
     // ARM can load multiple registers at once, but only if we want back all
     // the registers we previously saved to the stack.
     if (ignore.empty(true)) {
         diffF -= transferMultipleByRuns(set.fpus(), IsLoad, StackPointer, IA);
         adjustFrame(-reservedF);
     } else
 #endif
     {
-        for (FloatRegisterBackwardIterator iter(set.fpus()); iter.more(); iter++) {
+        for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
             diffF -= sizeof(double);
             if (!ignore.has(*iter))
                 loadDouble(Address(StackPointer, diffF), *iter);
         }
         freeStack(reservedF);
     }
     JS_ASSERT(diffF == 0);
 
 #ifdef JS_CPU_ARM
     if (set.gprs().size() > 1 && ignore.empty(false)) {
         startDataTransferM(IsLoad, StackPointer, IA, WriteBack);
-        for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
+        for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
             diffG -= STACK_SLOT_SIZE;
             transferReg(*iter);
         }
         finishDataTransfer();
         adjustFrame(-reservedG);
     } else
 #endif
     {
-        for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
+        for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
             diffG -= STACK_SLOT_SIZE;
             if (!ignore.has(*iter))
                 loadPtr(Address(StackPointer, diffG), *iter);
         }
         freeStack(reservedG);
     }
     JS_ASSERT(diffG == 0);
 }
--- a/js/src/ion/RegisterSets.h
+++ b/js/src/ion/RegisterSets.h
@@ -391,33 +391,26 @@ class TypedRegisterSet
         takeUnchecked(value.typeReg());
 #elif defined(JS_PUNBOX64)
         takeUnchecked(value.valueReg());
 #else
 #error "Bad architecture"
 #endif
     }
     T getAny() const {
-        // The choice of first or last here is mostly arbitrary, as they are
-        // about the same speed on popular architectures. We choose first, as
-        // it has the advantage of using the "lower" registers more often. These
-        // registers are sometimes more efficient (e.g. optimized encodings for
-        // EAX on x86).
-        return getFirst();
+        JS_ASSERT(!empty());
+        int ireg;
+        JS_FLOOR_LOG2(ireg, bits_);
+        return T::FromCode(ireg);
     }
     T getFirst() const {
         JS_ASSERT(!empty());
         int ireg = js_bitscan_ctz32(bits_);
         return T::FromCode(ireg);
     }
-    T getLast() const {
-        JS_ASSERT(!empty());
-        int ireg = 31 - js_bitscan_clz32(bits_);
-        return T::FromCode(ireg);
-    }
     T takeAny() {
         JS_ASSERT(!empty());
         T reg = getAny();
         take(reg);
         return reg;
     }
     T takeAnyExcluding(T preclude) {
         if (!has(preclude))
@@ -441,22 +434,16 @@ class TypedRegisterSet
 #endif
     }
     T takeFirst() {
         JS_ASSERT(!empty());
         T reg = getFirst();
         take(reg);
         return reg;
     }
-    T takeLast() {
-        JS_ASSERT(!empty());
-        T reg = getLast();
-        take(reg);
-        return reg;
-    }
     void clear() {
         bits_ = 0;
     }
     uint32_t bits() const {
         return bits_;
     }
     uint32_t size() const {
         uint32_t sum2  = (bits_ & 0x55555555) + ((bits_ & 0xaaaaaaaa) >> 1);
@@ -630,19 +617,17 @@ class RegisterSet {
     void maybeTake(TypedOrValueRegister reg) {
         if (reg.hasValue())
             maybeTake(reg.valueReg());
         else if (reg.hasTyped())
             maybeTake(reg.typedReg());
     }
 };
 
-// iterates in whatever order happens to be convenient.
-// Use TypedRegisterBackwardIterator or TypedRegisterForwardIterator if a
-// specific order is required.
+// iterates backwards, that is, rn to r0
 template <typename T>
 class TypedRegisterIterator
 {
     TypedRegisterSet<T> regset_;
 
   public:
     TypedRegisterIterator(TypedRegisterSet<T> regset) : regset_(regset)
     { }
@@ -661,79 +646,47 @@ class TypedRegisterIterator
         regset_.takeAny();
         return *this;
     }
     T operator *() const {
         return regset_.getAny();
     }
 };
 
-// iterates backwards, that is, rn to r0
-template <typename T>
-class TypedRegisterBackwardIterator
-{
-    TypedRegisterSet<T> regset_;
-
-  public:
-    TypedRegisterBackwardIterator(TypedRegisterSet<T> regset) : regset_(regset)
-    { }
-    TypedRegisterBackwardIterator(const TypedRegisterBackwardIterator &other)
-      : regset_(other.regset_)
-    { }
-
-    bool more() const {
-        return !regset_.empty();
-    }
-    TypedRegisterBackwardIterator<T> operator ++(int) {
-        TypedRegisterBackwardIterator<T> old(*this);
-        regset_.takeLast();
-        return old;
-    }
-    TypedRegisterBackwardIterator<T>& operator ++() {
-        regset_.getLast();
-        return *this;
-    }
-    T operator *() const {
-        return regset_.getLast();
-    }
-};
-
 // iterates forwards, that is r0 to rn
 template <typename T>
 class TypedRegisterForwardIterator
 {
     TypedRegisterSet<T> regset_;
 
   public:
     TypedRegisterForwardIterator(TypedRegisterSet<T> regset) : regset_(regset)
     { }
     TypedRegisterForwardIterator(const TypedRegisterForwardIterator &other) : regset_(other.regset_)
     { }
 
     bool more() const {
         return !regset_.empty();
     }
     TypedRegisterForwardIterator<T> operator ++(int) {
-        TypedRegisterForwardIterator<T> old(*this);
+        TypedRegisterIterator<T> old(*this);
         regset_.takeFirst();
         return old;
     }
     TypedRegisterForwardIterator<T>& operator ++() {
         regset_.takeFirst();
         return *this;
     }
     T operator *() const {
         return regset_.getFirst();
     }
 };
 
 typedef TypedRegisterIterator<Register> GeneralRegisterIterator;
 typedef TypedRegisterIterator<FloatRegister> FloatRegisterIterator;
-typedef TypedRegisterBackwardIterator<Register> GeneralRegisterBackwardIterator;
-typedef TypedRegisterBackwardIterator<FloatRegister> FloatRegisterBackwardIterator;
 typedef TypedRegisterForwardIterator<Register> GeneralRegisterForwardIterator;
 typedef TypedRegisterForwardIterator<FloatRegister> FloatRegisterForwardIterator;
 
 class AnyRegisterIterator
 {
     GeneralRegisterIterator geniter_;
     FloatRegisterIterator floatiter_;
 
--- a/js/src/ion/Safepoints.cpp
+++ b/js/src/ion/Safepoints.cpp
@@ -61,17 +61,17 @@ SafepointWriter::writeGcRegs(LSafepoint 
     }
 
     // GC registers are a subset of the spilled registers.
     JS_ASSERT((valueRegs.bits() & ~spilled.bits()) == 0);
     JS_ASSERT((gc.bits() & ~spilled.bits()) == 0);
 
 #ifdef DEBUG
     if (IonSpewEnabled(IonSpew_Safepoints)) {
-        for (GeneralRegisterForwardIterator iter(spilled); iter.more(); iter++) {
+        for (GeneralRegisterIterator iter(spilled); iter.more(); iter++) {
             const char *type = gc.has(*iter)
                                ? "gc"
                                : valueRegs.has(*iter)
                                  ? "value"
                                  : "any";
             IonSpew(IonSpew_Safepoints, "    %s reg: %s", type, (*iter).name());
         }
     }
--- a/js/src/ion/arm/MacroAssembler-arm.h
+++ b/js/src/ion/arm/MacroAssembler-arm.h
@@ -352,17 +352,17 @@ class MacroAssemblerARM : public Assembl
                                    Register rm, DTMMode mode)
     {
         if (mode == IA) {
             return transferMultipleByRunsImpl
                 <FloatRegisterForwardIterator>(set, ls, rm, mode, 1);
         }
         if (mode == DB) {
             return transferMultipleByRunsImpl
-                <FloatRegisterBackwardIterator>(set, ls, rm, mode, -1);
+                <FloatRegisterIterator>(set, ls, rm, mode, -1);
         }
         JS_NOT_REACHED("Invalid data transfer addressing mode");
     }
 
 private:
     // Implementation for transferMultipleByRuns so we can use different
     // iterators for forward/backward traversals.
     // The sign argument should be 1 if we traverse forwards, -1 if we