Bug 998173 - SpiderMonkey: Harmonize x86 and x64's MacroAssembler finish functions. r=bbouvier
authorDan Gohman <sunfish@mozilla.com>
Fri, 18 Apr 2014 11:13:44 -0700
changeset 198869 898d176bfd222dcab64908670cffc21f22c278d0
parent 198868 b46a88e69236a8180d60d99d8caebb4b8012f447
child 198870 b771f66230b009c100c95769847fd949061b3fb2
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs998173
milestone31.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 998173 - SpiderMonkey: Harmonize x86 and x64's MacroAssembler finish functions. r=bbouvier
js/src/jit/x64/MacroAssembler-x64.cpp
js/src/jit/x86/MacroAssembler-x86.cpp
--- a/js/src/jit/x64/MacroAssembler-x64.cpp
+++ b/js/src/jit/x64/MacroAssembler-x64.cpp
@@ -77,28 +77,26 @@ MacroAssemblerX64::loadConstantFloat32(f
     JmpSrc j = masm.movss_ripr(dest.code());
     JmpSrc prev = JmpSrc(flt.uses.use(j.offset()));
     masm.setNextJump(j, prev);
 }
 
 void
 MacroAssemblerX64::finish()
 {
-    JS_STATIC_ASSERT(CodeAlignment >= sizeof(double));
-
-    if (!doubles_.empty() || !floats_.empty())
+    if (!doubles_.empty())
         masm.align(sizeof(double));
-
     for (size_t i = 0; i < doubles_.length(); i++) {
         Double &dbl = doubles_[i];
         bind(&dbl.uses);
         masm.doubleConstant(dbl.value);
     }
 
-    // No need to align on sizeof(float) as we are aligned on sizeof(double);
+    if (!floats_.empty())
+        masm.align(sizeof(float));
     for (size_t i = 0; i < floats_.length(); i++) {
         Float &flt = floats_[i];
         bind(&flt.uses);
         masm.floatConstant(flt.value);
     }
 
     MacroAssemblerX86Shared::finish();
 }
--- a/js/src/jit/x86/MacroAssembler-x86.cpp
+++ b/js/src/jit/x86/MacroAssembler-x86.cpp
@@ -108,27 +108,28 @@ MacroAssemblerX86::addConstantFloat32(fl
         return;
     masm.addss_mr(reinterpret_cast<const void *>(flt->uses.prev()), dest.code());
     flt->uses.setPrev(masm.size());
 }
 
 void
 MacroAssemblerX86::finish()
 {
-    if (doubles_.empty() && floats_.empty())
-        return;
-
-    masm.align(sizeof(double));
+    if (!doubles_.empty())
+        masm.align(sizeof(double));
     for (size_t i = 0; i < doubles_.length(); i++) {
         CodeLabel cl(doubles_[i].uses);
         writeDoubleConstant(doubles_[i].value, cl.src());
         enoughMemory_ &= addCodeLabel(cl);
         if (!enoughMemory_)
             return;
     }
+
+    if (!floats_.empty())
+        masm.align(sizeof(float));
     for (size_t i = 0; i < floats_.length(); i++) {
         CodeLabel cl(floats_[i].uses);
         writeFloatConstant(floats_[i].value, cl.src());
         enoughMemory_ &= addCodeLabel(cl);
         if (!enoughMemory_)
             return;
     }
 }