Bug 1577757 - Add a compile-time option for wasm multi-value r=luke

Differential Revision: https://phabricator.services.mozilla.com/D44142

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andy Wingo 2019-10-01 14:30:35 +00:00
parent cb72b07f82
commit dd3580208d
5 changed files with 45 additions and 1 deletions

View File

@ -566,3 +566,19 @@ js_option('--enable-wasm-private-reftypes',
set_config('WASM_PRIVATE_REFTYPES', depends_if('--enable-wasm-private-reftypes')(lambda x: True))
set_define('WASM_PRIVATE_REFTYPES', depends_if('--enable-wasm-private-reftypes')(lambda x: True))
# Support for the WebAssembly multi-value proposal.
# =====================================================
@depends(milestone.is_nightly, building_js)
def default_wasm_multi_value(is_nightly, building_js):
return is_nightly and building_js
js_option('--enable-wasm-multi-value',
default=default_wasm_multi_value,
help='{Enable|Disable} support for the experimental WebAssembly '
'multi-value proposal')
set_config('ENABLE_WASM_MULTI_VALUE', depends_if('--enable-wasm-multi-value')(lambda x: True))
set_define('ENABLE_WASM_MULTI_VALUE', depends_if('--enable-wasm-multi-value')(lambda x: True))

View File

@ -778,6 +778,12 @@ static bool WasmGcEnabled(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
static bool WasmMultiValueEnabled(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(wasm::HasMultiValueSupport(cx));
return true;
}
static bool WasmDebugSupport(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(cx->options().wasmBaseline() &&
@ -6584,6 +6590,10 @@ gc::ZealModeHelpText),
"wasmGcEnabled()",
" Returns a boolean indicating whether the WebAssembly GC types proposal is enabled."),
JS_FN_HELP("wasmMultiValueEnabled", WasmMultiValueEnabled, 1, 0,
"wasmMultiValueEnabled()",
" Returns a boolean indicating whether the WebAssembly multi-value proposal is enabled."),
JS_FN_HELP("wasmDebugSupport", WasmDebugSupport, 1, 0,
"wasmDebugSupport()",
" Returns a boolean indicating whether the WebAssembly compilers support debugging."),

View File

@ -232,7 +232,7 @@ assertErrorMessage(() => wasmEval(moduleWithSections([
// Diagnose nonstandard block signature types.
for (var bad of [0xff, 0, 1, 0x3f])
assertErrorMessage(() => wasmEval(moduleWithSections([sigSection([v2vSig]), declSection([0]), bodySection([funcBody({locals:[], body:[BlockCode, bad, EndCode]})])])), CompileError, /invalid inline block type/);
assertErrorMessage(() => wasmEval(moduleWithSections([sigSection([v2vSig]), declSection([0]), bodySection([funcBody({locals:[], body:[BlockCode, bad, EndCode]})])])), CompileError, /invalid .*block type/);
// Ensure all invalid opcodes rejected
for (let op of undefinedOpcodes) {

View File

@ -87,6 +87,19 @@ bool wasm::HasGcSupport(JSContext* cx) {
#endif
}
bool wasm::HasMultiValueSupport(JSContext* cx) {
#ifdef ENABLE_WASM_CRANELIFT
if (cx->options().wasmCranelift()) {
return false;
}
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
return true;
#else
return false;
#endif
}
bool wasm::HasCompilerSupport(JSContext* cx) {
#if !MOZ_LITTLE_ENDIAN || defined(JS_CODEGEN_NONE)
return false;

View File

@ -69,6 +69,11 @@ bool HasReftypesSupport(JSContext* cx);
bool HasGcSupport(JSContext* cx);
// Returns true if WebAssembly as configured by compile-time flags and run-time
// options can support multi-value block and function returns (evolving).
bool HasMultiValueSupport(JSContext* cx);
// Compiles the given binary wasm module given the ArrayBufferObject
// and links the module's imports with the given import object.