Bug 1315256 - Wasm baseline: clean up more ifdefs. r=h4writer
authorLars T Hansen <lhansen@mozilla.com>
Mon, 07 Nov 2016 15:27:46 +0100
changeset 351476 02620bbac0928ad8f75b37dd3c0de458c7ddfe15
parent 351475 3c814c9606ffc356e5c34571d1745e33781f445f
child 351477 bb5895ace33fc2bbd37a99b7e20f091e3fee18d4
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1315256
milestone52.0a1
Bug 1315256 - Wasm baseline: clean up more ifdefs. r=h4writer
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -186,32 +186,32 @@ static const Register StackPointer = Rea
 #ifdef JS_CODEGEN_X86
 // The selection of EBX here steps gingerly around: the need for EDX
 // to be allocatable for multiply/divide; ECX to be allocatable for
 // shift/rotate; EAX (= ReturnReg) to be allocatable as the joinreg;
 // EBX not being one of the WasmTableCall registers; and needing a
 // temp register for load/store that has a single-byte persona.
 static const Register ScratchRegX86 = ebx;
 
-# define QUOT_REM_I64_CALLOUT
+# define INT_DIV_I64_CALLOUT
 #endif
 
 #ifdef JS_CODEGEN_ARM
 // We need a temp for funcPtrCall.  It can't be any of the
 // WasmTableCall registers, an argument register, or a scratch
 // register, and probably should not be ReturnReg.
 static const Register FuncPtrCallTemp = CallTempReg1;
 
 // We use our own scratch register, because the macro assembler uses
 // the regular scratch register(s) pretty liberally.  We could
 // work around that in several cases but the mess does not seem
 // worth it yet.  CallTempReg2 seems safe.
 static const Register ScratchRegARM = CallTempReg2;
 
-# define QUOT_REM_I64_CALLOUT
+# define INT_DIV_I64_CALLOUT
 # define I64_TO_FLOAT_CALLOUT
 # define FLOAT_TO_I64_CALLOUT
 #endif
 
 class BaseCompiler
 {
     // We define our own ScratchRegister abstractions, deferring to
     // the platform's when possible.
@@ -940,21 +940,17 @@ class BaseCompiler
         return RegI64(invalidRegister64());
     }
 
     RegF64 invalidF64() {
         return RegF64(InvalidFloatReg);
     }
 
     RegI32 fromI64(RegI64 r) {
-#ifdef JS_PUNBOX64
-        return RegI32(r.reg.reg);
-#else
-        return RegI32(r.reg.low);
-#endif
+        return RegI32(lowPart(r));
     }
 
     RegI64 widenI32(RegI32 r) {
         MOZ_ASSERT(!isAvailable(r.reg));
 #ifdef JS_PUNBOX64
         return RegI64(Register64(r.reg));
 #else
         RegI32 high = needI32();
@@ -995,18 +991,16 @@ class BaseCompiler
     void freeI64Except(RegI64 r, RegI32 except) {
 #ifdef JS_PUNBOX64
         MOZ_ASSERT(r.reg.reg == except.reg);
 #else
         MOZ_ASSERT(r.reg.high == except.reg || r.reg.low == except.reg);
         freeI64(r);
         needI32(except);
 #endif
-
-
     }
 
     void freeF64(RegF64 r) {
         freeFPU(r.reg);
     }
 
     void freeF32(RegF32 r) {
         freeFPU(r.reg);
@@ -2517,29 +2511,20 @@ class BaseCompiler
             masm.move32(Imm32(0), srcDest.reg);
             masm.jump(done);
             masm.bind(&notDivByZero);
         } else {
             masm.branchTest32(Assembler::Zero, rhs.reg, rhs.reg, trap(Trap::IntegerDivideByZero));
         }
     }
 
-    void checkDivideByZeroI64(RegI64 rhs, RegI64 srcDest, Label* done) {
+    void checkDivideByZeroI64(RegI64 r) {
         MOZ_ASSERT(!isCompilingAsmJS());
-#if defined(JS_CODEGEN_X64)
-        masm.testq(rhs.reg.reg, rhs.reg.reg);
-        masm.j(Assembler::Zero, trap(Trap::IntegerDivideByZero));
-#elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_ARM)
-        Label nonZero;
-        masm.branchTest32(Assembler::NonZero, rhs.reg.low, rhs.reg.low, &nonZero);
-        masm.branchTest32(Assembler::Zero, rhs.reg.high, rhs.reg.high, trap(Trap::IntegerDivideByZero));
-        masm.bind(&nonZero);
-#else
-        MOZ_CRASH("BaseCompiler platform hook: checkDivideByZeroI64");
-#endif
+        ScratchI32 scratch(*this);
+        masm.branchTest64(Assembler::Zero, r.reg, r.reg, scratch, trap(Trap::IntegerDivideByZero));
     }
 
     void checkDivideSignedOverflowI32(RegI32 rhs, RegI32 srcDest, Label* done, bool zeroOnOverflow) {
         Label notMin;
         masm.branch32(Assembler::NotEqual, srcDest.reg, Imm32(INT32_MIN), &notMin);
         if (zeroOnOverflow) {
             masm.branch32(Assembler::NotEqual, rhs.reg, Imm32(-1), &notMin);
             masm.move32(Imm32(0), srcDest.reg);
@@ -2549,38 +2534,34 @@ class BaseCompiler
             masm.branch32(Assembler::Equal, rhs.reg, Imm32(-1), done);
         } else {
             masm.branch32(Assembler::Equal, rhs.reg, Imm32(-1), trap(Trap::IntegerOverflow));
         }
         masm.bind(&notMin);
     }
 
     void checkDivideSignedOverflowI64(RegI64 rhs, RegI64 srcDest, Label* done, bool zeroOnOverflow) {
-#if defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_ARM)
         MOZ_ASSERT(!isCompilingAsmJS());
         Label notmin;
         masm.branch64(Assembler::NotEqual, srcDest.reg, Imm64(INT64_MIN), &notmin);
         masm.branch64(Assembler::NotEqual, rhs.reg, Imm64(-1), &notmin);
         if (zeroOnOverflow) {
             masm.xor64(srcDest.reg, srcDest.reg);
             masm.jump(done);
         } else {
             masm.jump(trap(Trap::IntegerOverflow));
         }
         masm.bind(&notmin);
-#else
-        MOZ_CRASH("BaseCompiler platform hook: checkDivideSignedOverflowI64");
-#endif
-    }
-
-#ifndef QUOT_REM_I64_CALLOUT
+    }
+
+#ifndef INT_DIV_I64_CALLOUT
     void quotientI64(RegI64 rhs, RegI64 srcDest, IsUnsigned isUnsigned) {
         Label done;
 
-        checkDivideByZeroI64(rhs, srcDest, &done);
+        checkDivideByZeroI64(rhs);
 
         if (!isUnsigned)
             checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(false));
 
 # if defined(JS_CODEGEN_X64)
         // The caller must set up the following situation.
         MOZ_ASSERT(srcDest.reg.reg == rax);
         MOZ_ASSERT(isAvailable(rdx));
@@ -2595,17 +2576,17 @@ class BaseCompiler
         MOZ_CRASH("BaseCompiler platform hook: quotientI64");
 # endif
         masm.bind(&done);
     }
 
     void remainderI64(RegI64 rhs, RegI64 srcDest, IsUnsigned isUnsigned) {
         Label done;
 
-        checkDivideByZeroI64(rhs, srcDest, &done);
+        checkDivideByZeroI64(rhs);
 
         if (!isUnsigned)
             checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(true));
 
 # if defined(JS_CODEGEN_X64)
         // The caller must set up the following situation.
         MOZ_ASSERT(srcDest.reg.reg == rax);
         MOZ_ASSERT(isAvailable(rdx));
@@ -2618,17 +2599,17 @@ class BaseCompiler
             masm.idivq(rhs.reg.reg);
         }
         masm.movq(rdx, rax);
 # else
         MOZ_CRASH("BaseCompiler platform hook: remainderI64");
 # endif
         masm.bind(&done);
     }
-#endif
+#endif // INT_DIV_I64_CALLOUT
 
     void pop2xI32ForShiftOrRotate(RegI32* r0, RegI32* r1) {
 #if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
         *r1 = popI32(specific_ecx);
         *r0 = popI32();
 #else
         pop2xI32(r0, r1);
 #endif
@@ -2707,29 +2688,42 @@ class BaseCompiler
         masm.movl(src.reg.reg, dest.reg);
 #elif defined(JS_NUNBOX32)
         masm.move32(src.reg.low, dest.reg);
 #else
         MOZ_CRASH("BaseCompiler platform hook: wrapI64ToI32");
 #endif
     }
 
-    void extendI32ToI64(RegI32 src, RegI64 dest) {
+    RegI64 popI32ForSignExtendI64() {
+#if defined(JS_CODEGEN_X86)
+        need2xI32(specific_edx, specific_eax);
+        RegI32 r0 = popI32ToSpecific(specific_eax);
+        RegI64 x0 = RegI64(Register64(specific_edx.reg, specific_eax.reg));
+        (void)r0;               // x0 is the widening of r0
+#else
+        RegI32 r0 = popI32();
+        RegI64 x0 = widenI32(r0);
+#endif
+        return x0;
+    }
+
+    void signExtendI32ToI64(RegI32 src, RegI64 dest) {
 #if defined(JS_CODEGEN_X64)
         masm.movslq(src.reg, dest.reg.reg);
 #elif defined(JS_CODEGEN_X86)
         MOZ_ASSERT(dest.reg.low == src.reg);
         MOZ_ASSERT(dest.reg.low == eax);
         MOZ_ASSERT(dest.reg.high == edx);
         masm.cdq();
 #elif defined(JS_CODEGEN_ARM)
         masm.ma_mov(src.reg, dest.reg.low);
         masm.ma_asr(Imm32(31), src.reg, dest.reg.high);
 #else
-        MOZ_CRASH("BaseCompiler platform hook: extendI32ToI64");
+        MOZ_CRASH("BaseCompiler platform hook: signExtendI32ToI64");
 #endif
     }
 
     void extendU32ToI64(RegI32 src, RegI64 dest) {
 #if defined(JS_CODEGEN_X64)
         masm.movl(src.reg, dest.reg.reg);
 #elif defined(JS_NUNBOX32)
         masm.move32(src.reg, dest.reg.low);
@@ -2918,17 +2912,17 @@ class BaseCompiler
         else
             masm.wasmTruncateDoubleToInt64(src.reg, dest.reg, ool->entry(),
                                            ool->rejoin(), temp.reg);
 # else
         MOZ_CRASH("BaseCompiler platform hook: truncateF64ToI64");
 # endif
         return true;
     }
-#endif
+#endif // FLOAT_TO_I64_CALLOUT
 
 #ifndef I64_TO_FLOAT_CALLOUT
     bool convertI64ToFloatNeedsTemp(bool isUnsigned) const {
 # if defined(JS_CODEGEN_X86)
         return isUnsigned && AssemblerX86Shared::HasSSE3();
 # else
         return false;
 # endif
@@ -2950,17 +2944,17 @@ class BaseCompiler
         if (isUnsigned)
             masm.convertUInt64ToDouble(src.reg, dest.reg, temp.reg);
         else
             masm.convertInt64ToDouble(src.reg, dest.reg);
 # else
         MOZ_CRASH("BaseCompiler platform hook: convertI64ToF64");
 # endif
     }
-#endif
+#endif // I64_TO_FLOAT_CALLOUT
 
     void cmp64Set(Assembler::Condition cond, RegI64 lhs, RegI64 rhs, RegI32 dest) {
 #if defined(JS_CODEGEN_X64)
         masm.cmpq(rhs.reg.reg, lhs.reg.reg);
         masm.emitSet(cond, dest.reg);
 #elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_ARM)
         // TODO / OPTIMIZE: This is pretty branchy, we should be able to do better.
         Label done, condTrue;
@@ -3181,27 +3175,24 @@ class BaseCompiler
             Unused << viewType;
             Unused << dest;
             MOZ_CRASH("Compiler bug: Unexpected platform.");
 # endif
         }
     };
 #endif
 
-  private:
     void checkOffset(MemoryAccessDesc* access, RegI32 ptr) {
         if (access->offset() >= OffsetGuardLimit) {
-            masm.branchAdd32(Assembler::CarrySet,
-                             Imm32(access->offset()), ptr.reg,
+            masm.branchAdd32(Assembler::CarrySet, Imm32(access->offset()), ptr.reg,
                              trap(Trap::OutOfBounds));
             access->clearOffset();
         }
     }
 
-  public:
     // This is the temp register passed as the last argument to load()
     MOZ_MUST_USE size_t loadStoreTemps(MemoryAccessDesc& access) {
 #if defined(JS_CODEGEN_ARM)
         if (access.isUnaligned()) {
             switch (access.type()) {
               case Scalar::Float32:
                 return 1;
               case Scalar::Float64:
@@ -3500,17 +3491,17 @@ class BaseCompiler
             masm.emitUnalignedStore(ByteSize(4), ptr.reg, tmp1.reg, 0);
             masm.emitUnalignedStore(ByteSize(4), ptr.reg, tmp2.reg, 4);
         } else {
             BufferOffset st =
                 masm.ma_vstr(src.reg, VFPAddr(ptr.reg, VFPOffImm(0)), Assembler::Always);
             masm.append(access, st.getOffset(), masm.framePushed());
         }
     }
-#endif
+#endif // JS_CODEGEN_ARM
 
     ////////////////////////////////////////////////////////////
 
     // Generally speaking, ABOVE this point there should be no value
     // stack manipulation (calls to popI32 etc).
 
     // Generally speaking, BELOW this point there should be no
     // platform dependencies.  We make an exception for x86 register
@@ -3592,17 +3583,17 @@ class BaseCompiler
     MOZ_MUST_USE bool emitReturn();
     MOZ_MUST_USE bool emitCallArgs(const ValTypeVector& args, FunctionCall& baselineCall);
     MOZ_MUST_USE bool emitCall();
     MOZ_MUST_USE bool emitCallIndirect(bool oldStyle);
     MOZ_MUST_USE bool emitCommonMathCall(uint32_t lineOrBytecode, SymbolicAddress callee,
                                          ValTypeVector& signature, ExprType retType);
     MOZ_MUST_USE bool emitUnaryMathBuiltinCall(SymbolicAddress callee, ValType operandType);
     MOZ_MUST_USE bool emitBinaryMathBuiltinCall(SymbolicAddress callee, ValType operandType);
-#ifdef QUOT_REM_I64_CALLOUT
+#ifdef INT_DIV_I64_CALLOUT
     MOZ_MUST_USE bool emitDivOrModI64BuiltinCall(SymbolicAddress callee, ValType operandType);
 #endif
     MOZ_MUST_USE bool emitGetLocal();
     MOZ_MUST_USE bool emitSetLocal();
     MOZ_MUST_USE bool emitTeeLocal();
     MOZ_MUST_USE bool emitGetGlobal();
     MOZ_MUST_USE bool emitSetGlobal();
     MOZ_MUST_USE bool emitTeeGlobal();
@@ -3636,17 +3627,17 @@ class BaseCompiler
     void emitMultiplyI32();
     void emitMultiplyI64();
     void emitMultiplyF32();
     void emitMultiplyF64();
     void emitQuotientI32();
     void emitQuotientU32();
     void emitRemainderI32();
     void emitRemainderU32();
-#ifndef QUOT_REM_I64_CALLOUT
+#ifndef INT_DIV_I64_CALLOUT
     void emitQuotientI64();
     void emitQuotientU64();
     void emitRemainderI64();
     void emitRemainderU64();
 #endif
     void emitDivideF32();
     void emitDivideF64();
     void emitMinI32();
@@ -3688,49 +3679,47 @@ class BaseCompiler
     void emitAbsF64();
     void emitNegateI32();
     void emitNegateF32();
     void emitNegateF64();
     void emitSqrtF32();
     void emitSqrtF64();
     template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF32ToI32();
     template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF64ToI32();
-#ifndef FLOAT_TO_I64_CALLOUT
+#ifdef FLOAT_TO_I64_CALLOUT
+    MOZ_MUST_USE bool emitConvertFloatingToInt64Callout(SymbolicAddress callee, ValType operandType,
+                                                        ValType resultType);
+#else
     template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF32ToI64();
     template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF64ToI64();
 #endif
     void emitWrapI64ToI32();
     void emitExtendI32ToI64();
     void emitExtendU32ToI64();
     void emitReinterpretF32AsI32();
     void emitReinterpretF64AsI64();
     void emitConvertF64ToF32();
     void emitConvertI32ToF32();
     void emitConvertU32ToF32();
     void emitConvertF32ToF64();
     void emitConvertI32ToF64();
     void emitConvertU32ToF64();
-#ifndef I64_TO_FLOAT_CALLOUT
+#ifdef I64_TO_FLOAT_CALLOUT
+    MOZ_MUST_USE bool emitConvertInt64ToFloatingCallout(SymbolicAddress callee, ValType operandType,
+                                                        ValType resultType);
+#else
     void emitConvertI64ToF32();
     void emitConvertU64ToF32();
     void emitConvertI64ToF64();
     void emitConvertU64ToF64();
 #endif
     void emitReinterpretI32AsF32();
     void emitReinterpretI64AsF64();
     MOZ_MUST_USE bool emitGrowMemory();
     MOZ_MUST_USE bool emitCurrentMemory();
-#ifdef I64_TO_FLOAT_CALLOUT
-    MOZ_MUST_USE bool emitConvertInt64ToFloatingCallout(SymbolicAddress callee, ValType operandType,
-                                                        ValType resultType);
-#endif
-#ifdef FLOAT_TO_I64_CALLOUT
-    MOZ_MUST_USE bool emitConvertFloatingToInt64Callout(SymbolicAddress callee, ValType operandType,
-                                                        ValType resultType);
-#endif
 };
 
 void
 BaseCompiler::emitAddI32()
 {
     int32_t c;
     if (popConstI32(c)) {
         RegI32 r = popI32();
@@ -3905,46 +3894,16 @@ BaseCompiler::emitQuotientU32()
     checkDivideByZeroI32(r1, r0, &done);
     masm.quotient32(r1.reg, r0.reg, IsUnsigned(true));
     masm.bind(&done);
 
     freeI32(r1);
     pushI32(r0);
 }
 
-#ifndef QUOT_REM_I64_CALLOUT
-void
-BaseCompiler::emitQuotientI64()
-{
-# ifdef JS_PUNBOX64
-    RegI64 r0, r1;
-    pop2xI64ForIntDiv(&r0, &r1);
-    quotientI64(r1, r0, IsUnsigned(false));
-    freeI64(r1);
-    pushI64(r0);
-# else
-    MOZ_CRASH("BaseCompiler platform hook: emitQuotientI64");
-# endif
-}
-
-void
-BaseCompiler::emitQuotientU64()
-{
-# ifdef JS_PUNBOX64
-    RegI64 r0, r1;
-    pop2xI64ForIntDiv(&r0, &r1);
-    quotientI64(r1, r0, IsUnsigned(true));
-    freeI64(r1);
-    pushI64(r0);
-# else
-    MOZ_CRASH("BaseCompiler platform hook: emitQuotientU64");
-# endif
-}
-#endif
-
 void
 BaseCompiler::emitRemainderI32()
 {
     // TODO / OPTIMIZE: Fast case if lhs >= 0 and rhs is power of two.
     RegI32 r0, r1;
     pop2xI32ForIntMulDiv(&r0, &r1);
 
     Label done;
@@ -3968,17 +3927,45 @@ BaseCompiler::emitRemainderU32()
     checkDivideByZeroI32(r1, r0, &done);
     masm.remainder32(r1.reg, r0.reg, IsUnsigned(true));
     masm.bind(&done);
 
     freeI32(r1);
     pushI32(r0);
 }
 
-#ifndef QUOT_REM_I64_CALLOUT
+#ifndef INT_DIV_I64_CALLOUT
+void
+BaseCompiler::emitQuotientI64()
+{
+# ifdef JS_PUNBOX64
+    RegI64 r0, r1;
+    pop2xI64ForIntDiv(&r0, &r1);
+    quotientI64(r1, r0, IsUnsigned(false));
+    freeI64(r1);
+    pushI64(r0);
+# else
+    MOZ_CRASH("BaseCompiler platform hook: emitQuotientI64");
+# endif
+}
+
+void
+BaseCompiler::emitQuotientU64()
+{
+# ifdef JS_PUNBOX64
+    RegI64 r0, r1;
+    pop2xI64ForIntDiv(&r0, &r1);
+    quotientI64(r1, r0, IsUnsigned(true));
+    freeI64(r1);
+    pushI64(r0);
+# else
+    MOZ_CRASH("BaseCompiler platform hook: emitQuotientU64");
+# endif
+}
+
 void
 BaseCompiler::emitRemainderI64()
 {
 # ifdef JS_PUNBOX64
     RegI64 r0, r1;
     pop2xI64ForIntDiv(&r0, &r1);
     remainderI64(r1, r0, IsUnsigned(false));
     freeI64(r1);
@@ -3996,17 +3983,17 @@ BaseCompiler::emitRemainderU64()
     pop2xI64ForIntDiv(&r0, &r1);
     remainderI64(r1, r0, IsUnsigned(true));
     freeI64(r1);
     pushI64(r0);
 # else
     MOZ_CRASH("BaseCompiler platform hook: emitRemainderU64");
 # endif
 }
-#endif
+#endif // INT_DIV_I64_CALLOUT
 
 void
 BaseCompiler::emitDivideF32()
 {
     RegF32 r0, r1;
     pop2xF32(&r0, &r1);
     masm.divFloat32(r1.reg, r0.reg);
     freeF32(r1);
@@ -4574,40 +4561,34 @@ BaseCompiler::emitTruncateF64ToI64()
     } else {
         if (!truncateF64ToI64(r0, x0, isUnsigned, invalidF64()))
             return false;
     }
     freeF64(r0);
     pushI64(x0);
     return true;
 }
-#endif
+#endif // FLOAT_TO_I64_CALLOUT
 
 void
 BaseCompiler::emitWrapI64ToI32()
 {
     RegI64 r0 = popI64();
     RegI32 i0 = fromI64(r0);
     wrapI64ToI32(r0, i0);
     freeI64Except(r0, i0);
     pushI32(i0);
 }
 
 void
 BaseCompiler::emitExtendI32ToI64()
 {
-#if defined(JS_CODEGEN_X86)
-    need2xI32(specific_edx, specific_eax);
-    RegI32 r0 = popI32ToSpecific(specific_eax);
-    RegI64 x0 = RegI64(Register64(specific_edx.reg, specific_eax.reg));
-#else
-    RegI32 r0 = popI32();
-    RegI64 x0 = widenI32(r0);
-#endif
-    extendI32ToI64(r0, x0);
+    RegI64 x0 = popI32ForSignExtendI64();
+    RegI32 r0 = RegI32(lowPart(x0));
+    signExtendI32ToI64(r0, x0);
     pushI64(x0);
     // Note: no need to free r0, since it is part of x0
 }
 
 void
 BaseCompiler::emitExtendU32ToI64()
 {
     RegI32 r0 = popI32();
@@ -4744,17 +4725,17 @@ BaseCompiler::emitConvertU64ToF64()
     if (convertI64ToFloatNeedsTemp(IsUnsigned(true)))
         temp = needI32();
     convertI64ToF64(r0, IsUnsigned(true), d0, temp);
     if (temp.reg != Register::Invalid())
         freeI32(temp);
     freeI64(r0);
     pushF64(d0);
 }
-#endif
+#endif // I64_TO_FLOAT_CALLOUT
 
 void
 BaseCompiler::emitReinterpretI32AsF32()
 {
     RegI32 r0 = popI32();
     RegF32 f0 = needF32();
     masm.moveGPRToFloat32(r0.reg, f0.reg);
     freeI32(r0);
@@ -5520,17 +5501,17 @@ BaseCompiler::emitBinaryMathBuiltinCall(
     }
 
     if (deadCode_)
         return true;
 
     return emitCommonMathCall(lineOrBytecode, callee, SigDD_, ExprType::F64);
 }
 
-#ifdef QUOT_REM_I64_CALLOUT
+#ifdef INT_DIV_I64_CALLOUT
 bool
 BaseCompiler::emitDivOrModI64BuiltinCall(SymbolicAddress callee, ValType operandType)
 {
     MOZ_ASSERT(operandType == ValType::I64);
 
     if (deadCode_)
         return true;
 
@@ -5539,17 +5520,17 @@ BaseCompiler::emitDivOrModI64BuiltinCall
     needI64(abiReturnRegI64);
 
     RegI32 temp = needI32();
     RegI64 rhs = popI64();
     RegI64 srcDest = popI64ToSpecific(abiReturnRegI64);
 
     Label done;
 
-    checkDivideByZeroI64(rhs, srcDest, &done);
+    checkDivideByZeroI64(rhs);
 
     if (callee == SymbolicAddress::DivI64)
         checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(false));
     else if (callee == SymbolicAddress::ModI64)
         checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(true));
 
     masm.setupUnalignedABICall(temp.reg);
     masm.passABIArg(srcDest.reg.high);
@@ -5561,17 +5542,17 @@ BaseCompiler::emitDivOrModI64BuiltinCall
     masm.bind(&done);
 
     freeI32(temp);
     freeI64(rhs);
     pushI64(srcDest);
 
     return true;
 }
-#endif
+#endif // INT_DIV_I64_CALLOUT
 
 #ifdef I64_TO_FLOAT_CALLOUT
 bool
 BaseCompiler::emitConvertInt64ToFloatingCallout(SymbolicAddress callee, ValType operandType,
                                                 ValType resultType)
 {
     sync();
 
@@ -5600,17 +5581,17 @@ BaseCompiler::emitConvertInt64ToFloating
         freeF64(rv);
         pushF32(rv2);
     } else {
         pushF64(rv);
     }
 
     return true;
 }
-#endif
+#endif // I64_TO_FLOAT_CALLOUT
 
 #ifdef FLOAT_TO_I64_CALLOUT
 // `Callee` always takes a double, so a float32 input must be converted.
 bool
 BaseCompiler::emitConvertFloatingToInt64Callout(SymbolicAddress callee, ValType operandType,
                                                 ValType resultType)
 {
     RegF64 doubleInput;
@@ -5657,17 +5638,17 @@ BaseCompiler::emitConvertFloatingToInt64
     masm.branch64(Assembler::Equal, rv.reg, Imm64(0x8000000000000000), ool->entry());
     masm.bind(ool->rejoin());
 
     pushI64(rv);
     freeF64(inputVal);
 
     return true;
 }
-#endif
+#endif // FLOAT_TO_I64_CALLOUT
 
 bool
 BaseCompiler::emitGetLocal()
 {
     uint32_t slot;
     if (!iter_.readGetLocal(locals_, &slot))
         return false;
 
@@ -6730,35 +6711,35 @@ BaseCompiler::emitBody()
           }
           case Expr::I64Add:
             CHECK_NEXT(emitBinary(emitAddI64, ValType::I64));
           case Expr::I64Sub:
             CHECK_NEXT(emitBinary(emitSubtractI64, ValType::I64));
           case Expr::I64Mul:
             CHECK_NEXT(emitBinary(emitMultiplyI64, ValType::I64));
           case Expr::I64DivS:
-#ifdef QUOT_REM_I64_CALLOUT
+#ifdef INT_DIV_I64_CALLOUT
             CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::DivI64, ValType::I64));
 #else
             CHECK_NEXT(emitBinary(emitQuotientI64, ValType::I64));
 #endif
           case Expr::I64DivU:
-#ifdef QUOT_REM_I64_CALLOUT
+#ifdef INT_DIV_I64_CALLOUT
             CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::UDivI64, ValType::I64));
 #else
             CHECK_NEXT(emitBinary(emitQuotientU64, ValType::I64));
 #endif
           case Expr::I64RemS:
-#ifdef QUOT_REM_I64_CALLOUT
+#ifdef INT_DIV_I64_CALLOUT
             CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::ModI64, ValType::I64));
 #else
             CHECK_NEXT(emitBinary(emitRemainderI64, ValType::I64));
 #endif
           case Expr::I64RemU:
-#ifdef QUOT_REM_I64_CALLOUT
+#ifdef INT_DIV_I64_CALLOUT
             CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::UModI64, ValType::I64));
 #else
             CHECK_NEXT(emitBinary(emitRemainderU64, ValType::I64));
 #endif
           case Expr::I64TruncSF32:
 #ifdef FLOAT_TO_I64_CALLOUT
             CHECK_NEXT(emitCalloutConversionOOM(emitConvertFloatingToInt64Callout,
                                                 SymbolicAddress::TruncateDoubleToInt64,
@@ -7192,23 +7173,16 @@ BaseCompiler::emitFunction()
         return false;
 
     beginFunction();
 
     UniquePooledLabel functionEnd(newLabel());
     if (!pushControl(&functionEnd))
         return false;
 
-#ifdef JS_CODEGEN_ARM64
-    // FIXME: There is a hack up at the top to allow the baseline
-    // compiler to compile on ARM64 (by defining StackPointer), but
-    // the resulting code cannot run.  So prevent it from running.
-    MOZ_CRASH("Several adjustments required for ARM64 operation");
-#endif
-
     if (!emitBody())
         return false;
 
     if (!iter_.readFunctionEnd())
         return false;
 
     if (!endFunction())
         return false;
@@ -7458,11 +7432,11 @@ js::wasm::BaselineCompileFunction(IonCom
     if (!f.emitFunction())
         return false;
 
     f.finish();
 
     return true;
 }
 
-#undef QUOT_REM_I64_CALLOUT
+#undef INT_DIV_I64_CALLOUT
 #undef I64_TO_FLOAT_CALLOUT
 #undef FLOAT_TO_I64_CALLOUT