Bug 1523993: Add JitOptions to disable wasm fast paths; r=luke

This adds a new configure option `--enable-wasm-codegen-debug`, which defaults
to true in debug builds (disable otherwise).

It's a first step so as to be able to use this in both the shell and browser,
using the env variables JIT_OPTION_{JitOption field name}.

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

--HG--
extra : rebase_source : 37c717f4cc225a9a7d162df3b0312b68e39ad07e
This commit is contained in:
Benjamin Bouvier 2019-01-31 18:29:02 +01:00
parent 731692a30b
commit 62e9c068e7
6 changed files with 42 additions and 3 deletions

View File

@ -515,3 +515,14 @@ js_option('--enable-cranelift',
set_config('ENABLE_WASM_CRANELIFT', depends_if('--enable-cranelift')(lambda x: True))
set_define('ENABLE_WASM_CRANELIFT', depends_if('--enable-cranelift')(lambda x: True))
# Support for debugging code generated by wasm backends
# =====================================================
js_option('--enable-wasm-codegen-debug',
default=depends(when=moz_debug)(lambda: True),
help='{Enable|Disable} debugging for wasm codegen')
set_config('WASM_CODEGEN_DEBUG', depends_if('--enable-wasm-codegen-debug')(lambda x: True))
set_define('WASM_CODEGEN_DEBUG', depends_if('--enable-wasm-codegen-debug')(lambda x: True))

View File

@ -273,6 +273,12 @@ DefaultJitOptions::DefaultJitOptions() {
// the traceLogger will not be recording any events.
SET_DEFAULT(enableTraceLogger, false);
#endif
#ifdef WASM_CODEGEN_DEBUG
SET_DEFAULT(enableWasmJitExit, true);
SET_DEFAULT(enableWasmJitEntry, true);
SET_DEFAULT(enableWasmIonFastCalls, true);
#endif
}
bool DefaultJitOptions::isSmallFunction(JSScript* script) const {

View File

@ -74,6 +74,11 @@ struct DefaultJitOptions {
bool wasmDelayTier2;
#ifdef JS_TRACE_LOGGING
bool enableTraceLogger;
#endif
#ifdef WASM_CODEGEN_DEBUG
bool enableWasmJitExit;
bool enableWasmJitEntry;
bool enableWasmIonFastCalls;
#endif
uint32_t baselineWarmUpThreshold;
uint32_t exceptionBailoutThreshold;

View File

@ -4054,7 +4054,12 @@ IonBuilder::InliningResult IonBuilder::inlineWasmCall(CallInfo& callInfo,
// Check that the function doesn't take or return non-compatible JS
// argument types before adding nodes to the MIR graph, otherwise they'd be
// dead code.
if (sig.hasI64ArgOrRet() || sig.temporarilyUnsupportedAnyRef()) {
if (sig.hasI64ArgOrRet() ||
sig.temporarilyUnsupportedAnyRef()
#ifdef WASM_CODEGEN_DEBUG
|| !JitOptions.enableWasmIonFastCalls
#endif
) {
return InliningStatus_NotInlined;
}

View File

@ -154,6 +154,12 @@ bool Instance::callImport(JSContext* cx, uint32_t funcImportIndex,
return false;
}
#ifdef WASM_CODEGEN_DEBUG
if (!JitOptions.enableWasmJitEntry) {
return true;
}
#endif
// The import may already have become optimized.
for (auto t : code().tiers()) {
void* jitExitCode = codeBase(t) + fi.jitExitCodeOffset();

View File

@ -1490,10 +1490,16 @@ static bool EnsureLazyEntryStub(const Instance& instance,
return false;
}
bool disableJitEntry = funcType.temporarilyUnsupportedAnyRef()
#ifdef WASM_CODEGEN_DEBUG
|| !JitOptions.enableWasmJitEntry;
#endif
;
// Functions with anyref don't have jit entries yet, so they should
// mostly behave like asm.js functions. Pretend it's the case, until
// jit entries are implemented.
JSFunction::Flags flags = funcType.temporarilyUnsupportedAnyRef()
JSFunction::Flags flags = disableJitEntry
? JSFunction::ASMJS_NATIVE
: JSFunction::WASM_FUN;
@ -1504,7 +1510,7 @@ static bool EnsureLazyEntryStub(const Instance& instance,
return false;
}
if (funcType.temporarilyUnsupportedAnyRef()) {
if (disableJitEntry) {
fun->setAsmJSIndex(funcIndex);
} else {
fun->setWasmJitEntry(instance.code().getAddressOfJitEntry(funcIndex));