Bug 524158 -re-enable immediate-load optimization on ARM, r=gal.
authorGraydon Hoare <graydon@mozilla.com>
Fri, 23 Oct 2009 11:10:07 -0700
changeset 34334 90c7b4ae73ef0a9769851cb984b5315a3b85e85d
parent 34333 a34f19817220be20d99e7cbdbe908e8393ec5bd5
child 34335 d01080e63d116c297be1976080c02bf100d8d909
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal
bugs524158
milestone1.9.3a1pre
Bug 524158 -re-enable immediate-load optimization on ARM, r=gal.
js/src/nanojit/NativeARM.cpp
--- a/js/src/nanojit/NativeARM.cpp
+++ b/js/src/nanojit/NativeARM.cpp
@@ -1017,51 +1017,41 @@ Assembler::asm_store32(LIns *value, int 
     }
 }
 
 void
 Assembler::asm_restore(LInsp i, Reservation *resv, Register r)
 {
     if (i->isop(LIR_alloc)) {
         asm_add_imm(r, FP, disp(resv));
-    } else if (IsFpReg(r)) {
-        NanoAssert(ARM_VFP);
-
+    } else if (i->isconst()) {
+        if (!resv->arIndex) {
+            i->resv()->clear();
+        }
+        asm_ld_imm(r, i->imm32());
+    }
+    else {
         // We can't easily load immediate values directly into FP registers, so
         // ensure that memory is allocated for the constant and load it from
         // memory.
         int d = findMemFor(i);
-        if (isS8(d >> 2)) {
-            FLDD(r, FP, d);
+        if (ARM_VFP && IsFpReg(r)) {
+            if (isS8(d >> 2)) {
+                FLDD(r, FP, d);
+            } else {
+                FLDD(r, IP, 0);
+                asm_add_imm(IP, FP, d);
+            }
         } else {
-            FLDD(r, IP, 0);
-            asm_add_imm(IP, FP, d);
+            LDR(r, FP, d);
         }
-#if 0
-    // This code tries to use a small constant load to restore the value of r.
-    // However, there was a comment explaining that using this regresses
-    // crypto-aes by about 50%. I do not see that behaviour; however, enabling
-    // this code does cause a JavaScript failure in the first of the
-    // createMandelSet tests in trace-tests. I can't explain either the
-    // original performance issue or the crash that I'm seeing.
-    } else if (i->isconst()) {
-        // asm_ld_imm will automatically select between LDR and MOV as
-        // appropriate.
-        if (!resv->arIndex)
-            i->resv()->clear();
-        asm_ld_imm(r, i->imm32());
-#endif
-    } else {
-        int d = findMemFor(i);
-        LDR(r, FP, d);
     }
-
     verbose_only(
         asm_output("        restore %s",_thisfrag->lirbuf->names->formatRef(i));
-    )
+        )
 }
 
 void
 Assembler::asm_spill(Register rr, int d, bool pop, bool quad)
 {
     (void) pop;
     (void) quad;
     if (d) {