mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1299356 - Baldr: change handling of when not HaveCompilerSupport (r=bbouvier)
MozReview-Commit-ID: 7eCwuhhbsR
This commit is contained in:
parent
60f3766a41
commit
0b570ff235
@ -25,13 +25,15 @@ function checkFooModule(m) {
|
||||
}
|
||||
|
||||
function propertiesExist() {
|
||||
if (!wasmIsSupported()) {
|
||||
ok(!this["WebAssembly"], "If the device doesn't support, there will be no WebAssembly object");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
ok(WebAssembly, "WebAssembly object should exist");
|
||||
ok(WebAssembly.compile, "WebAssembly.compile function should exist");
|
||||
|
||||
if (!wasmIsSupported())
|
||||
SimpleTest.finish();
|
||||
else
|
||||
runTest();
|
||||
runTest();
|
||||
}
|
||||
|
||||
function compileFail() {
|
||||
|
@ -56,20 +56,6 @@ wasm::HasCompilerSupport(ExclusiveContext* cx)
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
CheckCompilerSupport(JSContext* cx)
|
||||
{
|
||||
if (!HasCompilerSupport(cx)) {
|
||||
#ifdef JS_MORE_DETERMINISTIC
|
||||
fprintf(stderr, "WebAssembly is not supported on the current device.\n");
|
||||
#endif
|
||||
JS_ReportError(cx, "WebAssembly is not supported on the current device.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// (Temporary) Wasm class and static methods
|
||||
|
||||
@ -223,9 +209,6 @@ bool
|
||||
wasm::Eval(JSContext* cx, Handle<TypedArrayObject*> code, HandleObject importObj,
|
||||
MutableHandleWasmInstanceObject instanceObj)
|
||||
{
|
||||
if (!CheckCompilerSupport(cx))
|
||||
return false;
|
||||
|
||||
MutableBytes bytecode = cx->new_<ShareableBytes>();
|
||||
if (!bytecode)
|
||||
return false;
|
||||
@ -318,6 +301,7 @@ const Class js::WasmClass = {
|
||||
JSObject*
|
||||
js::InitWasmClass(JSContext* cx, HandleObject global)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(HasCompilerSupport(cx));
|
||||
MOZ_ASSERT(cx->options().wasm());
|
||||
|
||||
RootedObject proto(cx, global->as<GlobalObject>().getOrCreateObjectPrototype(cx));
|
||||
@ -429,8 +413,7 @@ GetCompileArgs(JSContext* cx, CallArgs callArgs, const char* name, MutableBytes*
|
||||
return false;
|
||||
|
||||
compileArgs->assumptions.newFormat = true;
|
||||
|
||||
return CheckCompilerSupport(cx);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
@ -1337,6 +1320,7 @@ InitConstructor(JSContext* cx, HandleObject wasm, const char* name, MutableHandl
|
||||
JSObject*
|
||||
js::InitWebAssemblyClass(JSContext* cx, HandleObject obj)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(HasCompilerSupport(cx));
|
||||
MOZ_ASSERT(cx->options().wasm());
|
||||
|
||||
Handle<GlobalObject*> global = obj.as<GlobalObject>();
|
||||
|
@ -509,7 +509,7 @@ static bool
|
||||
WasmIsSupported(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setBoolean(wasm::HasCompilerSupport(cx) && cx->options().wasm());
|
||||
args.rval().setBoolean(wasm::HasCompilerSupport(cx));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ js::GlobalObject::getTypedObjectModule() const {
|
||||
GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
if (key == JSProto_Wasm || key == JSProto_WebAssembly)
|
||||
return !cx->options().wasm();
|
||||
return !cx->options().wasm() || !wasm::HasCompilerSupport(cx);
|
||||
|
||||
#ifdef ENABLE_SHARED_ARRAY_BUFFER
|
||||
// Return true if the given constructor has been disabled at run-time.
|
||||
|
Loading…
Reference in New Issue
Block a user