Bug 885169 - Reverse the default register allocation order so that low registers like eax on x86/x64 are preferred over high registers. r=h4writer
☠☠ backed out by d35342e7bcd0 ☠ ☠
authorDan Gohman <sunfish@google.com>
Wed, 04 Sep 2013 21:16:07 -0700
changeset 145631 997672af6fc8750c7dcee69595ec1d40e82d50f1
parent 145630 7a887cc385cb4250ab9199641db1a592ca57dd2b
child 145632 9ff14d43346dd6b92d8c863d63c28bcf7e55ce5f
push id25216
push useremorley@mozilla.com
push dateThu, 05 Sep 2013 10:06:42 +0000
treeherdermozilla-central@676322e0166c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs885169
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 885169 - Reverse the default register allocation order so that low registers like eax on x86/x64 are preferred over high registers. r=h4writer
js/src/jit/RegisterSets.h
--- a/js/src/jit/RegisterSets.h
+++ b/js/src/jit/RegisterSets.h
@@ -395,18 +395,22 @@ class TypedRegisterSet
         takeUnchecked(value.typeReg());
 #elif defined(JS_PUNBOX64)
         takeUnchecked(value.valueReg());
 #else
 #error "Bad architecture"
 #endif
     }
     T getAny() const {
-        JS_ASSERT(!empty());
-        return T::FromCode(mozilla::FloorLog2(bits_));
+        // 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();
     }
     T getFirst() const {
         JS_ASSERT(!empty());
         return T::FromCode(mozilla::CountTrailingZeroes32(bits_));
     }
     T getLast() const {
         JS_ASSERT(!empty());
         int ireg = 31 - mozilla::CountLeadingZeroes32(bits_);