зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1656335 - Improve wasm gating on ARM. r=jseward
Generalizes wasm::HasSupport() on 32-bit ARM so that we check whether the atomic operations are available in all cases, not just when running on the simulator. This was a dumb bug, but an old one. Effectively this means we get wasm only with ARMv7, which we've been assuming anyway. Now we gate it properly. Changes a whitebox test case that explicitly sets the ARM hw capabilities to set capabilities that will pass the new test even on non-simulator builds, and handles the run-time error that results when command line switches select a compiler that has stronger requirements than that general requirement, leaving an empty set of available compilers. (The baseline compiler requires IDIV support.) Renames the test case appropriately. Differential Revision: https://phabricator.services.mozilla.com/D85547
This commit is contained in:
Родитель
df3643be96
Коммит
8998a3e856
|
@ -0,0 +1,32 @@
|
|||
// |jit-test| skip-if: !this.setARMHwCapFlags
|
||||
|
||||
// This will disable the idiv instruction and thus make the baseline compiler
|
||||
// unavailable, so we must be prepared for a run-time error below in the
|
||||
// baseline-only configuration.
|
||||
setARMHwCapFlags('vfp,armv7');
|
||||
|
||||
// The flags above should be sufficient for there to be a WebAssembly object.
|
||||
assertEq(typeof WebAssembly, "object");
|
||||
|
||||
try {
|
||||
var i = new WebAssembly.Instance(
|
||||
new WebAssembly.Module(
|
||||
wasmTextToBinary('(module (func (export "") (result i32) (i32.const 42)))')));
|
||||
assertEq(i.exports[""](), 42);
|
||||
} catch (e) {
|
||||
if (String(e).match(/no WebAssembly compiler available/)) {
|
||||
switch (wasmCompileMode()) {
|
||||
case "none":
|
||||
// This is fine: the limited feature set combined with command line
|
||||
// compiler selection caused all compilers to be disabled.
|
||||
break;
|
||||
default:
|
||||
// This is not fine: if there's a compiler available then we should
|
||||
// not get an error.
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
// Some other error, propagate it.
|
||||
throw e;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// |jit-test| skip-if: !this.setARMHwCapFlags
|
||||
|
||||
setARMHwCapFlags('vfp');
|
||||
|
||||
if (typeof WebAssembly !== "undefined") {
|
||||
var i = new WebAssembly.Instance(
|
||||
new WebAssembly.Module(
|
||||
wasmTextToBinary('(module (func (export "") (result i32) (i32.const 42)))')));
|
||||
assertEq(i.exports[""](), 42);
|
||||
}
|
|
@ -197,8 +197,6 @@ class Simulator {
|
|||
Simulator();
|
||||
~Simulator();
|
||||
|
||||
static bool supportsAtomics() { return HasLDSTREXBHD(); }
|
||||
|
||||
// The currently executing Simulator instance. Potentially there can be one
|
||||
// for each native thread.
|
||||
static Simulator* Current();
|
||||
|
|
|
@ -529,9 +529,6 @@ class Simulator : public DecoderVisitor {
|
|||
static uintptr_t StackLimit() {
|
||||
return Simulator::Current()->stackLimit();
|
||||
}
|
||||
static bool supportsAtomics() {
|
||||
return true;
|
||||
}
|
||||
template<typename T> T Read(uintptr_t address);
|
||||
template <typename T> void Write(uintptr_t address_, T value);
|
||||
JS::ProfilingFrameIterator::RegisterState registerState();
|
||||
|
|
|
@ -213,8 +213,6 @@ class Simulator {
|
|||
Simulator();
|
||||
~Simulator();
|
||||
|
||||
static bool supportsAtomics() { return true; }
|
||||
|
||||
// The currently executing Simulator instance. Potentially there can be one
|
||||
// for each native thread.
|
||||
static Simulator* Current();
|
||||
|
|
|
@ -215,8 +215,6 @@ class Simulator {
|
|||
Simulator();
|
||||
~Simulator();
|
||||
|
||||
static bool supportsAtomics() { return true; }
|
||||
|
||||
// The currently executing Simulator instance. Potentially there can be one
|
||||
// for each native thread.
|
||||
static Simulator* Current();
|
||||
|
|
|
@ -384,17 +384,18 @@ bool wasm::HasPlatformSupport(JSContext* cx) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
// Wasm threads require support for atomic operations.
|
||||
if (!HasLDSTREXBHD()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Wasm threads require 8-byte lock-free atomics.
|
||||
if (!jit::AtomicOperations::isLockfree8()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef JS_SIMULATOR
|
||||
if (!Simulator::supportsAtomics()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Test only whether the compilers are supported on the hardware, not whether
|
||||
// they are enabled.
|
||||
return BaselinePlatformSupport() || IonPlatformSupport() ||
|
||||
|
|
Загрузка…
Ссылка в новой задаче