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 971b68a8f9cb ☠ ☠
authorDan Gohman <sunfish@google.com>
Mon, 24 Jun 2013 15:58:00 -0700
changeset 136312 1aa1a42a471f5931de97c0d20ec4bb59cd66469f
parent 136311 bf03279e2b5098195c1c0f89301134ec2fd6ea52
child 136313 5ccd0b486a97cd5d9aa8c2a4eee651bde37026ba
push id30035
push usersunfish@google.com
push dateMon, 24 Jun 2013 23:13:47 +0000
treeherdermozilla-inbound@1aa1a42a471f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs885169
milestone24.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/ion/RegisterSets.h
--- a/js/src/ion/RegisterSets.h
+++ b/js/src/ion/RegisterSets.h
@@ -391,20 +391,22 @@ class TypedRegisterSet
         takeUnchecked(value.typeReg());
 #elif defined(JS_PUNBOX64)
         takeUnchecked(value.valueReg());
 #else
 #error "Bad architecture"
 #endif
     }
     T getAny() const {
-        JS_ASSERT(!empty());
-        int ireg;
-        JS_FLOOR_LOG2(ireg, bits_);
-        return T::FromCode(ireg);
+        // 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());
         int ireg = js_bitscan_ctz32(bits_);
         return T::FromCode(ireg);
     }
     T getLast() const {
         JS_ASSERT(!empty());