Bug 1334504 - Baldr: remove movw/movt requirement for wasm on ARM (r=bbouvier)

MozReview-Commit-ID: IPYbhkYqPwU

--HG--
extra : rebase_source : 7eab849de87d86547b0bcbb0aef8c5505aa28041
This commit is contained in:
Luke Wagner 2017-03-22 17:17:50 -05:00
parent e24cd03181
commit 0f64a61281
4 changed files with 57 additions and 24 deletions

View File

@ -1872,15 +1872,51 @@ setARMHwCapFlags('vfp');
asmCompile('stdlib', 'ffi', 'heap',
USE_ASM + `
var atomic_cmpxchg = stdlib.Atomics.compareExchange;
var atomic_exchange = stdlib.Atomics.exchange;
var atomic_add = stdlib.Atomics.add;
var atomic_sub = stdlib.Atomics.sub;
var atomic_and = stdlib.Atomics.and;
var atomic_or = stdlib.Atomics.or;
var atomic_xor = stdlib.Atomics.xor;
var i8a = new stdlib.Int8Array(heap);
function do_cas() {
var v = 0;
v = atomic_cmpxchg(i8a, 100, 0, -1);
return v|0;
}
function do_xchg() {
var v = 0;
v = atomic_exchange(i8a, 200, 37);
return v|0;
}
function do_add() {
var v = 0;
v = atomic_add(i8a, 10, 37);
return v|0;
}
function do_sub() {
var v = 0;
v = atomic_sub(i8a, 10, 37);
return v|0;
}
function do_and() {
var v = 0;
v = atomic_and(i8a, 10, 37);
return v|0;
}
function do_or() {
var v = 0;
v = atomic_or(i8a, 10, 37);
return v|0;
}
function do_xor() {
var v = 0;
v = atomic_xor(i8a, 10, 37);
return v|0;
}
return { xchg: do_xchg }
return { cas:do_cas, xchg: do_xchg, add: do_add, sub: do_sub, and: do_and, or: do_or, xor: do_xor }
`);

View File

@ -893,11 +893,12 @@ LIRGeneratorARM::visitAsmJSCompareExchangeHeap(MAsmJSCompareExchangeHeap* ins)
if (byteSize(ins->access().type()) != 4 && !HasLDSTREXBHD()) {
LAsmJSCompareExchangeCallout* lir =
new(alloc()) LAsmJSCompareExchangeCallout(useRegisterAtStart(base),
useRegisterAtStart(ins->oldValue()),
useRegisterAtStart(ins->newValue()),
useFixed(ins->tls(), WasmTlsReg),
temp(), temp());
new(alloc()) LAsmJSCompareExchangeCallout(useFixedAtStart(base, IntArgReg2),
useFixedAtStart(ins->oldValue(), IntArgReg3),
useFixedAtStart(ins->newValue(), CallTempReg0),
useFixedAtStart(ins->tls(), WasmTlsReg),
tempFixed(IntArgReg0),
tempFixed(IntArgReg1));
defineReturn(lir, ins);
return;
}
@ -917,17 +918,18 @@ LIRGeneratorARM::visitAsmJSAtomicExchangeHeap(MAsmJSAtomicExchangeHeap* ins)
MOZ_ASSERT(ins->access().type() < Scalar::Float32);
MOZ_ASSERT(ins->access().offset() == 0);
const LAllocation base = useRegisterAtStart(ins->base());
const LAllocation value = useRegisterAtStart(ins->value());
if (byteSize(ins->access().type()) < 4 && !HasLDSTREXBHD()) {
// Call out on ARMv6.
defineReturn(new(alloc()) LAsmJSAtomicExchangeCallout(base, value,
useFixed(ins->tls(), WasmTlsReg),
temp(), temp()), ins);
defineReturn(new(alloc()) LAsmJSAtomicExchangeCallout(useFixedAtStart(ins->base(), IntArgReg2),
useFixedAtStart(ins->value(), IntArgReg3),
useFixedAtStart(ins->tls(), WasmTlsReg),
tempFixed(IntArgReg0),
tempFixed(IntArgReg1)), ins);
return;
}
const LAllocation base = useRegisterAtStart(ins->base());
const LAllocation value = useRegisterAtStart(ins->value());
define(new(alloc()) LAsmJSAtomicExchangeHeap(base, value), ins);
}
@ -942,10 +944,11 @@ LIRGeneratorARM::visitAsmJSAtomicBinopHeap(MAsmJSAtomicBinopHeap* ins)
if (byteSize(ins->access().type()) != 4 && !HasLDSTREXBHD()) {
LAsmJSAtomicBinopCallout* lir =
new(alloc()) LAsmJSAtomicBinopCallout(useRegisterAtStart(base),
useRegisterAtStart(ins->value()),
useFixed(ins->tls(), WasmTlsReg),
temp(), temp());
new(alloc()) LAsmJSAtomicBinopCallout(useFixedAtStart(base, IntArgReg2),
useFixedAtStart(ins->value(), IntArgReg3),
useFixedAtStart(ins->tls(), WasmTlsReg),
tempFixed(IntArgReg0),
tempFixed(IntArgReg1));
defineReturn(lir, ins);
return;
}

View File

@ -2341,8 +2341,9 @@ class BaseCompiler
masm.breakpoint();
// Patch the add in the prologue so that it checks against the correct
// frame size.
// frame size. Flush the constant pool in case it needs to be patched.
MOZ_ASSERT(maxFramePushed_ >= localSize_);
masm.flush();
masm.patchAdd32ToPtr(stackAddOffset_, Imm32(-int32_t(maxFramePushed_ - localSize_)));
// Since we just overflowed the stack, to be on the safe side, pop the

View File

@ -65,13 +65,6 @@ wasm::HasCompilerSupport(JSContext* cx)
if (!wasm::HaveSignalHandlers())
return false;
#if defined(JS_CODEGEN_ARM)
// movw/t are required for the loadWasmActivationFromSymbolicAddress in
// GenerateProfilingPrologue/Epilogue to avoid using the constant pool.
if (!HasMOVWT())
return false;
#endif
#if defined(JS_CODEGEN_NONE) || defined(JS_CODEGEN_ARM64)
return false;
#else