Bug 1450804 - Baldr: forbid pools in br_table baseline (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Tue, 03 Apr 2018 14:28:22 -0500
changeset 411500 4a74066f490773840b9293bf7333622b42cb21a7
parent 411499 64682e402373b73e839314cf3229c1afa68288b4
child 411501 c93a8362c8ac026f28a27f5dc88c5a4cac071a9b
push id101682
push userlwagner@mozilla.com
push dateTue, 03 Apr 2018 19:49:09 +0000
treeherdermozilla-inbound@c93a8362c8ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1450804
milestone61.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 1450804 - Baldr: forbid pools in br_table baseline (r=bbouvier)
js/src/jit/arm/MacroAssembler-arm.cpp
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -4476,16 +4476,17 @@ MacroAssembler::patchFarJump(CodeOffset 
     // When pc is read as the operand of the add, its value is the address of
     // the add instruction + 8.
     *u32 = (targetOffset - addOffset) - 8;
 }
 
 CodeOffset
 MacroAssembler::nopPatchableToCall(const wasm::CallSiteDesc& desc)
 {
+    AutoForbidPools afp(this, /* max number of instructions in scope = */ 1);
     CodeOffset offset(currentOffset());
     ma_nop();
     append(desc, CodeOffset(currentOffset()));
     return offset;
 }
 
 void
 MacroAssembler::patchNopToCall(uint8_t* call, uint8_t* target)
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -3602,17 +3602,17 @@ class BaseCompiler final : public BaseCo
         tableCl.target()->bind(theTable->offset());
         masm.addCodeLabel(tableCl);
 
         masm.jmp(Operand(scratch, switchValue, ScalePointer));
 #elif defined(JS_CODEGEN_ARM)
         // Flush constant pools: offset must reflect the distance from the MOV
         // to the start of the table; as the address of the MOV is given by the
         // label, nothing must come between the bind() and the ma_mov().
-        masm.flush();
+        AutoForbidPools afp(&masm, /* number of instructions in scope = */ 5);
 
         ScratchI32 scratch(*this);
 
         // Compute the offset from the ma_mov instruction to the jump table.
         Label here;
         masm.bind(&here);
         uint32_t offset = here.offset() - theTable->offset();
 
@@ -3635,17 +3635,17 @@ class BaseCompiler final : public BaseCo
 
         masm.ma_li(scratch, &tableCl);
 
         tableCl.target()->bind(theTable->offset());
         masm.addCodeLabel(tableCl);
 
         masm.branchToComputedAddress(BaseIndex(scratch, switchValue, ScalePointer));
 #elif defined(JS_CODEGEN_ARM64)
-        masm.flush();
+        AutoForbidPools afp(&masm, /* number of instructions in scope = */ 4);
 
         ScratchI32 scratch(*this);
 
         ARMRegister s(scratch, 64);
         ARMRegister v(switchValue, 64);
         masm.Adr(s, theTable);
         masm.Add(s, s, Operand(v, vixl::LSL, 3));
         masm.Ldr(s, MemOperand(s, 0));