Bug 1518210 - Wasm: Don't run --wasm-disable-huge-memory if the platform doesn't support huge memory. r=lth

This commit extends the jit-test runner to support
'skip-variant-if: $FLAG, $COND', and uses this to not run
'--wasm-disable-huge-memory' tests when the platform doesn't support huge
memory.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan Hunt 2019-08-30 02:34:10 +00:00
parent a1b2f83793
commit c1bc991a46
7 changed files with 41 additions and 9 deletions

View File

@ -697,6 +697,16 @@ static bool WasmCachingIsSupported(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
static bool WasmHugeMemoryIsSupported(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
#ifdef WASM_SUPPORTS_HUGE_MEMORY
args.rval().setBoolean(true);
#else
args.rval().setBoolean(false);
#endif
return true;
}
static bool WasmUsesCranelift(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
#ifdef ENABLE_WASM_CRANELIFT
@ -6365,6 +6375,11 @@ gc::ZealModeHelpText),
"wasmCachingIsSupported()",
" Returns a boolean indicating whether WebAssembly caching is supported by the runtime."),
JS_FN_HELP("wasmHugeMemoryIsSupported", WasmHugeMemoryIsSupported, 0, 0,
"wasmHugeMemoryIsSupported()",
" Returns a boolean indicating whether WebAssembly supports using a large"
" virtual memory reservation in order to elide bounds checks on this platform."),
JS_FN_HELP("wasmUsesCranelift", WasmUsesCranelift, 0, 0,
"wasmUsesCranelift()",
" Returns a boolean indicating whether Cranelift is currently enabled for backend\n"

View File

@ -1 +1 @@
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm.js
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js

View File

@ -1 +1 @@
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm.js
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js

View File

@ -1 +1 @@
|jit-test| test-also=--wasm-gc; test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--wasm-gc --wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; include:wasm.js
|jit-test| test-also=--wasm-gc; test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--wasm-gc --wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js

View File

@ -1 +1 @@
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm.js
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js

View File

@ -1,2 +1,2 @@
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported();

View File

@ -86,6 +86,13 @@ def js_quote(quote, s):
os.path.relpath = _relpath
def extend_condition(condition, value):
if condition:
condition += " || "
condition += "({})".format(value)
return condition
class JitTest:
VALGRIND_CMD = []
@ -147,6 +154,7 @@ class JitTest:
# Skip-if condition. We don't have a xulrunner, but we can ask the shell
# directly.
self.skip_if_cond = ''
self.skip_variant_if_cond = {}
# Expected by the test runner. Always true for jit-tests.
self.enable = True
@ -171,11 +179,15 @@ class JitTest:
t.is_module = self.is_module
t.is_binast = self.is_binast
t.skip_if_cond = self.skip_if_cond
t.skip_variant_if_cond = self.skip_variant_if_cond
return t
def copy_and_extend_jitflags(self, variant):
t = self.copy()
t.jitflags.extend(variant)
for flags in variant:
if flags in self.skip_variant_if_cond:
t.skip_if_cond = extend_condition(t.skip_if_cond, self.skip_variant_if_cond[flags])
return t
def copy_variants(self, variants):
@ -273,10 +285,15 @@ class JitTest:
elif name == 'include':
test.other_includes.append(value)
elif name == 'skip-if':
# Ensure that skip-ifs are composable
if test.skip_if_cond:
test.skip_if_cond += " || "
test.skip_if_cond += "({})".format(value)
test.skip_if_cond = extend_condition(test.skip_if_cond, value)
elif name == 'skip-variant-if':
try:
[variant, condition] = value.split(',')
test.skip_variant_if_cond[variant] = extend_condition(
test.skip_if_cond,
condition)
except ValueError:
print("warning: couldn't parse skip-variant-if")
else:
print('{}: warning: unrecognized |jit-test| attribute'
' {}'.format(path, part))