Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Oana Pop Rus 2019-01-24 19:06:45 +02:00
commit 40a2bf6ef7
80 changed files with 408 additions and 356 deletions

View File

@ -9640,29 +9640,32 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
aContentPolicyType == nsIContentPolicy::TYPE_INTERNAL_FRAME,
"DoURILoad thinks this is a frame and InternalLoad does not");
// Only allow URLs able to return data in iframes.
bool doesNotReturnData = false;
NS_URIChainHasFlags(aLoadState->URI(),
nsIProtocolHandler::URI_DOES_NOT_RETURN_DATA,
&doesNotReturnData);
if (doesNotReturnData) {
bool popupBlocked = true;
if (StaticPrefs::dom_block_external_protocol_in_iframes()) {
// Only allow URLs able to return data in iframes.
bool doesNotReturnData = false;
NS_URIChainHasFlags(aLoadState->URI(),
nsIProtocolHandler::URI_DOES_NOT_RETURN_DATA,
&doesNotReturnData);
if (doesNotReturnData) {
bool popupBlocked = true;
// Let's consider external protocols as popups and let's check if the page
// is allowed to open them without abuse regardless of allowed events
if (PopupBlocker::GetPopupControlState() <= PopupBlocker::openBlocked) {
popupBlocked = !PopupBlocker::TryUsePopupOpeningToken();
} else {
nsCOMPtr<nsINode> loadingNode =
mScriptGlobal->AsOuter()->GetFrameElementInternal();
if (loadingNode) {
popupBlocked = !PopupBlocker::CanShowPopupByPermission(
loadingNode->NodePrincipal());
// Let's consider external protocols as popups and let's check if the
// page is allowed to open them without abuse regardless of allowed
// events
if (PopupBlocker::GetPopupControlState() <= PopupBlocker::openBlocked) {
popupBlocked = !PopupBlocker::TryUsePopupOpeningToken();
} else {
nsCOMPtr<nsINode> loadingNode =
mScriptGlobal->AsOuter()->GetFrameElementInternal();
if (loadingNode) {
popupBlocked = !PopupBlocker::CanShowPopupByPermission(
loadingNode->NodePrincipal());
}
}
}
if (popupBlocked) {
return NS_ERROR_UNKNOWN_PROTOCOL;
if (popupBlocked) {
return NS_ERROR_UNKNOWN_PROTOCOL;
}
}
}

View File

@ -10,30 +10,35 @@
<div id='foo'><a href='#'>Click here to test this issue</a></div>
<script>
SimpleTest.waitForExplicitFinish();
let foo = document.getElementById('foo');
foo.addEventListener('click', _ => {
is(ChromeUtils.getPopupControlState(), "openAllowed", "Click events allow popups");
ok(!ChromeUtils.isPopupTokenUnused(), "Popup token has not been used yet");
for (let i = 0; i < 10; ++i) {
let ifr = document.createElement('iframe');
ifr.src = "foo+bar:all_good";
document.body.appendChild(ifr);
function next() {
let foo = document.getElementById('foo');
foo.addEventListener('click', _ => {
is(ChromeUtils.getPopupControlState(), "openAllowed", "Click events allow popups");
ok(ChromeUtils.isPopupTokenUnused(), "Popup token has been used!");
}
ok(!ChromeUtils.isPopupTokenUnused(), "Popup token has not been used yet");
SimpleTest.finish();
for (let i = 0; i < 10; ++i) {
let ifr = document.createElement('iframe');
ifr.src = "foo+bar:all_good";
document.body.appendChild(ifr);
}, {once: true});
is(ChromeUtils.getPopupControlState(), "openAllowed", "Click events allow popups");
ok(ChromeUtils.isPopupTokenUnused(), "Popup token has been used!");
}
setTimeout(_ => {
sendMouseEvent({type:'click'}, 'foo');
}, 0);
SimpleTest.finish();
}, {once: true});
setTimeout(_ => {
sendMouseEvent({type:'click'}, 'foo');
}, 0);
}
SpecialPowers.pushPrefEnv({'set': [
['dom.block_external_protocol_in_iframes', true],
]}, next);
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>

View File

@ -283,7 +283,7 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_baselinejit")))
.setWasmIon(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_ionjit")))
#ifdef ENABLE_WASM_CRANELIFT
.setWasmForceCranelift(
.setWasmCranelift(
GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_cranelift")))
#endif
#ifdef ENABLE_WASM_REFTYPES

View File

@ -73,6 +73,7 @@
#include "vm/StringType.h"
#include "vm/TraceLogging.h"
#include "wasm/AsmJS.h"
#include "wasm/WasmBaselineCompile.h"
#include "wasm/WasmJS.h"
#include "wasm/WasmModule.h"
#include "wasm/WasmSignalHandlers.h"
@ -646,7 +647,7 @@ static bool WasmThreadsSupported(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
bool isSupported = wasm::HasSupport(cx);
#ifdef ENABLE_WASM_CRANELIFT
if (cx->options().wasmForceCranelift()) {
if (cx->options().wasmCranelift()) {
isSupported = false;
}
#endif
@ -659,7 +660,7 @@ static bool WasmBulkMemSupported(JSContext* cx, unsigned argc, Value* vp) {
#ifdef ENABLE_WASM_BULKMEM_OPS
bool isSupported = true;
# ifdef ENABLE_WASM_CRANELIFT
if (cx->options().wasmForceCranelift()) {
if (cx->options().wasmCranelift()) {
isSupported = false;
}
# endif
@ -686,6 +687,12 @@ static bool WasmGcEnabled(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
static bool WasmDebugSupport(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(cx->options().wasmBaseline() && wasm::BaselineCanCompile());
return true;
}
static bool WasmGeneralizedTables(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
#ifdef ENABLE_WASM_GENERALIZED_TABLES
@ -702,14 +709,26 @@ static bool WasmGeneralizedTables(JSContext* cx, unsigned argc, Value* vp) {
static bool WasmCompileMode(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
bool baseline = cx->options().wasmBaseline();
bool ion = cx->options().wasmIon();
#ifdef ENABLE_WASM_CRANELIFT
bool cranelift = cx->options().wasmCranelift();
#else
bool cranelift = false;
#endif
// We default to ion if nothing is enabled, as does the Wasm compiler.
JSString* result;
if (!wasm::HasSupport(cx)) {
result = JS_NewStringCopyZ(cx, "disabled");
} else if (cx->options().wasmBaseline() && cx->options().wasmIon()) {
result = JS_NewStringCopyZ(cx, "baseline-or-ion");
} else if (cx->options().wasmBaseline()) {
result = JS_NewStringCopyZ(cx, "none");
} else if (baseline && ion) {
result = JS_NewStringCopyZ(cx, "baseline+ion");
} else if (baseline && cranelift) {
result = JS_NewStringCopyZ(cx, "baseline+cranelift");
} else if (baseline) {
result = JS_NewStringCopyZ(cx, "baseline");
} else if (cranelift) {
result = JS_NewStringCopyZ(cx, "cranelift");
} else {
result = JS_NewStringCopyZ(cx, "ion");
}
@ -5975,6 +5994,10 @@ gc::ZealModeHelpText),
"wasmGcEnabled(bool)",
" Returns a boolean indicating whether the WebAssembly GC types proposal is enabled."),
JS_FN_HELP("wasmDebugSupport", WasmDebugSupport, 1, 0,
"wasmDebugSupport(bool)",
" Returns a boolean indicating whether the WebAssembly compilers support debugging."),
JS_FN_HELP("wasmGeneralizedTables", WasmGeneralizedTables, 1, 0,
"wasmGeneralizedTables(bool)",
" Returns a boolean indicating whether generalized tables are available.\n"

View File

@ -225,7 +225,7 @@ def main(argv):
if all(['--no-asmjs' in flags for flags in test_flags]):
options.asmjs_enabled = False
options.wasm_enabled = False
if all(['--no-wasm' in flags for flags in test_flags]):
if all(['--wasm-compiler=none' in flags for flags in test_flags]):
options.asmjs_enabled = False
options.wasm_enabled = False

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; error: TestComplete
// |jit-test| test-also-wasm-compiler-ion; error: TestComplete
if (!wasmDebuggingIsSupported())
throw "TestComplete";

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; error: TestComplete
// |jit-test| test-also-wasm-compiler-ion; error: TestComplete
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; error: TestComplete
// |jit-test| test-also-wasm-compiler-ion; error: TestComplete
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; error: TestComplete
// |jit-test| test-also-wasm-compiler-ion; error: TestComplete
if (!wasmDebuggingIsSupported())
throw "TestComplete";

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; error: TestComplete
// |jit-test| test-also-wasm-compiler-ion; error: TestComplete
if (!wasmDebuggingIsSupported())
throw "TestComplete";

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// Checking in debug frame is initialized properly during stack overflow.
var dbg;

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Checking if Debugger.Script.isInCatchScope return false for wasm.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// Checking resumption values for 'null' at onEnterFrame.
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; exitstatus: 3; skip-if: !wasmDebuggingIsSupported()
// Checking resumption values for 'null' at frame's onPop.
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; error: TestComplete; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; error: TestComplete; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module scripts raises onEnterFrame and onLeaveFrame events.
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Checking existence of all frame.offset references during onEnterFrame,
// onLeaveFrame and onStep events in the source code, and that we can

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Checking if we destroying work registers by breakpoint/step handler.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests debugEnabled state of wasm when allowUnobservedAsmJS == true.
load(libdir + "asserts.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module scripts has inspectable locals.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Test single-stepping where the TLS register can be evicted by a non-trivial
// function body.

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module scripts have special URLs.

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline
// |jit-test| skip-if: !wasmDebugSupport()
// Tests that wasm module scripts has inspectable globals and memory.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module scripts handles basic breakpoint operations.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm frame opPop event can access function resumption value.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module scripts have column and line to bytecode offset
// information when source text is generated.

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline
// |jit-test| skip-if: !wasmDebugSupport()
// Tests that JS can be evaluated on wasm module scripts frames.
load(libdir + "wasm.js");

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module can accept URL and sourceMapURL from response
// when instantiateStreaming is used.

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module sourceMappingURL section is parsed.

View File

@ -1,4 +1,4 @@
// |jit-test| test-also-no-wasm-baseline; skip-if: !wasmDebuggingIsSupported()
// |jit-test| test-also-wasm-compiler-ion; skip-if: !wasmDebuggingIsSupported()
// Tests that wasm module scripts raises onEnterFrame and onLeaveFrame events.

View File

@ -1 +1 @@
|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering; include:wasm.js
|jit-test| test-also-wasm-compiler-ion; test-also-wasm-compiler-baseline; test-also-wasm-tiering; include:wasm.js

View File

@ -1 +1 @@
|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering; include:wasm.js
|jit-test| test-also-wasm-compiler-ion; test-also-wasm-compiler-baseline; test-also-wasm-tiering; include:wasm.js

View File

@ -1,3 +1,4 @@
// |jit-test| skip-if: !wasmDebugSupport()
var g = newGlobal({newCompartment: true});
g.parent = this;
g.eval("Debugger(parent).onExceptionUnwind = function () {};");

View File

@ -1,3 +1,4 @@
// |jit-test| skip-if: !wasmDebugSupport()
var g = newGlobal({newCompartment: true});
var dbg = new g.Debugger(this);
var dbg = new Debugger;

View File

@ -1,3 +1,4 @@
// |jit-test| skip-if: !wasmDebugSupport()
var evalInFrame = (function(global) {
var dbgGlobal = newGlobal({newCompartment: true});
var dbg = new dbgGlobal.Debugger();

View File

@ -1,3 +1,5 @@
// |jit-test| skip-if: !wasmDebugSupport()
//
var mod = new WebAssembly.Module(wasmTextToBinary(`
(module
(func (export "func_0") (result i32)

View File

@ -1,3 +1,4 @@
// |jit-test| skip-if: !wasmDebugSupport()
g = newGlobal({newCompartment: true});
g.parent = this;
g.eval("(" + function() {

View File

@ -1,3 +1,4 @@
// |jit-test| skip-if: !wasmDebugSupport()
g = newGlobal({newCompartment: true});
g.parent = this;
g.eval("(" + function() {

View File

@ -1 +1 @@
|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering; include:wasm.js
|jit-test| test-also-wasm-compiler-ion; test-also-wasm-compiler-baseline; test-also-wasm-tiering; include:wasm.js

View File

@ -1 +1 @@
|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering; include:wasm-testharness.js
|jit-test| test-also-wasm-compiler-ion; test-also-wasm-compiler-baseline; test-also-wasm-tiering; include:wasm-testharness.js

View File

@ -1,2 +1,2 @@
|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering
|jit-test| test-also-wasm-compiler-ion; test-also-wasm-compiler-baseline; test-also-wasm-tiering

View File

@ -396,7 +396,7 @@ class JS_PUBLIC_API ContextOptions {
wasmBaseline_(true),
wasmIon_(true),
#ifdef ENABLE_WASM_CRANELIFT
wasmForceCranelift_(false),
wasmCranelift_(false),
#endif
#ifdef ENABLE_WASM_REFTYPES
wasmGc_(false),
@ -476,9 +476,9 @@ class JS_PUBLIC_API ContextOptions {
}
#ifdef ENABLE_WASM_CRANELIFT
bool wasmForceCranelift() const { return wasmForceCranelift_; }
ContextOptions& setWasmForceCranelift(bool flag) {
wasmForceCranelift_ = flag;
bool wasmCranelift() const { return wasmCranelift_; }
ContextOptions& setWasmCranelift(bool flag) {
wasmCranelift_ = flag;
return *this;
}
#endif
@ -595,7 +595,7 @@ class JS_PUBLIC_API ContextOptions {
bool wasmBaseline_ : 1;
bool wasmIon_ : 1;
#ifdef ENABLE_WASM_CRANELIFT
bool wasmForceCranelift_ : 1;
bool wasmCranelift_ : 1;
#endif
#ifdef ENABLE_WASM_REFTYPES
bool wasmGc_ : 1;

View File

@ -51,8 +51,8 @@
# wasm flags
--wasm-gc
--no-wasm-baseline
--no-wasm-ion
--wasm-compiler=ion
--wasm-compiler=baseline
--test-wasm-await-tier2
# CPU instruction set-related

View File

@ -491,9 +491,7 @@ static bool enableNativeRegExp = false;
static bool enableSharedMemory = SHARED_MEMORY_DEFAULT;
static bool enableWasmBaseline = false;
static bool enableWasmIon = false;
#ifdef ENABLE_WASM_CRANELIFT
static bool wasmForceCranelift = false;
#endif
static bool enableWasmCranelift = false;
#ifdef ENABLE_WASM_REFTYPES
static bool enableWasmGc = false;
#endif
@ -10184,23 +10182,38 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
enableBaseline = !op.getBoolOption("no-baseline");
enableIon = !op.getBoolOption("no-ion");
enableAsmJS = !op.getBoolOption("no-asmjs");
enableWasm = !op.getBoolOption("no-wasm");
enableNativeRegExp = !op.getBoolOption("no-native-regexp");
enableWasmBaseline = !op.getBoolOption("no-wasm-baseline");
enableWasmIon = !op.getBoolOption("no-wasm-ion");
#ifdef ENABLE_WASM_CRANELIFT
wasmForceCranelift = op.getBoolOption("wasm-force-cranelift");
#endif
// Default values for wasm.
enableWasm = true;
enableWasmBaseline = true;
enableWasmIon = true;
if (const char* str = op.getStringOption("wasm-compiler")) {
if (strcmp(str, "none") == 0) {
enableWasm = false;
} else if (strcmp(str, "baseline") == 0) {
// Baseline is enabled by default.
enableWasmIon = false;
} else if (strcmp(str, "ion") == 0) {
// Ion is enabled by default.
enableWasmBaseline = false;
} else if (strcmp(str, "cranelift") == 0) {
enableWasmBaseline = false;
enableWasmIon = false;
enableWasmCranelift = true;
} else if (strcmp(str, "baseline+ion") == 0) {
// Default.
} else if (strcmp(str, "baseline+cranelift") == 0) {
// Baseline is enabled by default.
enableWasmIon = false;
enableWasmCranelift = true;
} else {
return OptionFailure("wasm-compiler", str);
}
}
#ifdef ENABLE_WASM_REFTYPES
enableWasmGc = op.getBoolOption("wasm-gc");
# ifdef ENABLE_WASM_CRANELIFT
if (enableWasmGc && wasmForceCranelift) {
fprintf(stderr,
"Do not combine --wasm-gc and --wasm-force-cranelift, they are "
"incompatible.\n");
}
enableWasmGc = enableWasmGc && !wasmForceCranelift;
# endif
#endif
enableWasmVerbose = op.getBoolOption("wasm-verbose");
enableTestWasmAwaitTier2 = op.getBoolOption("test-wasm-await-tier2");
@ -10218,7 +10231,7 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
.setWasmBaseline(enableWasmBaseline)
.setWasmIon(enableWasmIon)
#ifdef ENABLE_WASM_CRANELIFT
.setWasmForceCranelift(wasmForceCranelift)
.setWasmCranelift(enableWasmCranelift)
#endif
#ifdef ENABLE_WASM_REFTYPES
.setWasmGc(enableWasmGc)
@ -10535,7 +10548,7 @@ static void SetWorkerContextOptions(JSContext* cx) {
.setWasmBaseline(enableWasmBaseline)
.setWasmIon(enableWasmIon)
#ifdef ENABLE_WASM_CRANELIFT
.setWasmForceCranelift(wasmForceCranelift)
.setWasmCranelift(enableWasmCranelift)
#endif
#ifdef ENABLE_WASM_REFTYPES
.setWasmGc(enableWasmGc)
@ -10932,16 +10945,12 @@ int main(int argc, char** argv, char** envp) {
!op.addBoolOption('\0', "ion", "Enable IonMonkey (default)") ||
!op.addBoolOption('\0', "no-ion", "Disable IonMonkey") ||
!op.addBoolOption('\0', "no-asmjs", "Disable asm.js compilation") ||
!op.addBoolOption('\0', "no-wasm", "Disable WebAssembly compilation") ||
!op.addBoolOption('\0', "no-wasm-baseline",
"Disable wasm baseline compiler") ||
!op.addBoolOption('\0', "no-wasm-ion", "Disable wasm ion compiler")
#ifdef ENABLE_WASM_CRANELIFT
|| !op.addBoolOption('\0', "wasm-force-cranelift",
"Enable wasm Cranelift compiler")
#endif
|| !op.addBoolOption('\0', "wasm-verbose",
"Enable WebAssembly verbose logging") ||
!op.addStringOption(
'\0', "wasm-compiler", "[option]",
"Choose to enable a subset of the wasm compilers (valid options are "
"none/baseline/ion/cranelift/baseline+ion/baseline+cranelift)") ||
!op.addBoolOption('\0', "wasm-verbose",
"Enable WebAssembly verbose logging") ||
!op.addBoolOption('\0', "test-wasm-await-tier2",
"Forcibly activate tiering and block "
"instantiation on completion of tier2")

View File

@ -304,12 +304,12 @@ class JitTest:
elif name == 'test-also-noasmjs':
if options.asmjs_enabled:
test.test_also.append(['--no-asmjs'])
elif name == 'test-also-no-wasm-baseline':
elif name == 'test-also-wasm-compiler-ion':
if options.wasm_enabled:
test.test_also.append(['--no-wasm-baseline'])
elif name == 'test-also-no-wasm-ion':
test.test_also.append(['--wasm-compiler=ion'])
elif name == 'test-also-wasm-compiler-baseline':
if options.wasm_enabled:
test.test_also.append(['--no-wasm-ion'])
test.test_also.append(['--wasm-compiler=baseline'])
elif name == 'test-also-wasm-tiering':
if options.wasm_enabled:
test.test_also.append(['--test-wasm-await-tier2'])

View File

@ -43,7 +43,7 @@ JITFLAGS = {
],
# Interpreter-only, for tools that cannot handle binary code generation.
'interp': [
['--no-baseline', '--no-asmjs', '--no-wasm', '--no-native-regexp']
['--no-baseline', '--no-asmjs', '--wasm-compiler=none', '--no-native-regexp']
],
'none': [
[] # no flags, normal baseline and ion

View File

@ -1369,10 +1369,10 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED ModuleValidatorShared {
funcImportMap_(cx),
arrayViews_(cx),
compilerEnv_(CompileMode::Once, Tier::Optimized, OptimizedBackend::Ion,
DebugEnabled::False, HasGcTypes::False),
env_(HasGcTypes::False, &compilerEnv_, Shareable::False,
DebugEnabled::False, /* gc types */ false),
env_(/* gc types */ false, &compilerEnv_, Shareable::False,
ModuleKind::AsmJS) {
compilerEnv_.computeParameters(HasGcTypes::False);
compilerEnv_.computeParameters(/* gc types */ false);
env_.minMemoryLength = RoundUpToNextValidAsmJSHeapLength(0);
}
@ -2137,8 +2137,7 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED ModuleValidator
}
}
MutableCompileArgs args =
cx_->new_<CompileArgs>(cx_, std::move(scriptedCaller));
SharedCompileArgs args = CompileArgs::build(cx_, std::move(scriptedCaller));
if (!args) {
return nullptr;
}

View File

@ -23,7 +23,7 @@ update:
--use-sync \
--js ../jit-test/tests/wasm/spec \
--html ../../../testing/web-platform/mozilla/tests/wasm
echo "|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering; include:wasm-testharness.js" > ../jit-test/tests/wasm/spec/directives.txt
echo "|jit-test| test-also-wasm-compiler-ion; test-also-wasm-compiler-baseline; test-also-wasm-tiering; include:wasm-testharness.js" > ../jit-test/tests/wasm/spec/directives.txt
echo "|jit-test| skip-if:true" > ../jit-test/tests/wasm/spec/harness/directives.txt
run:

View File

@ -11449,7 +11449,7 @@ bool BaseCompiler::emitBody() {
#ifdef ENABLE_WASM_GC
case uint16_t(Op::RefEq):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(
@ -11457,13 +11457,13 @@ bool BaseCompiler::emitBody() {
#endif
#ifdef ENABLE_WASM_REFTYPES
case uint16_t(Op::RefNull):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitRefNull());
break;
case uint16_t(Op::RefIsNull):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(
@ -11558,22 +11558,22 @@ bool BaseCompiler::emitBody() {
#endif
#ifdef ENABLE_WASM_GC
case uint16_t(MiscOp::StructNew):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitStructNew());
case uint16_t(MiscOp::StructGet):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitStructGet());
case uint16_t(MiscOp::StructSet):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitStructSet());
case uint16_t(MiscOp::StructNarrow):
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitStructNarrow());

View File

@ -648,8 +648,7 @@ struct ProjectLazyFuncIndex {
static constexpr unsigned LAZY_STUB_LIFO_DEFAULT_CHUNK_SIZE = 8 * 1024;
bool LazyStubTier::createMany(HasGcTypes gcTypesConfigured,
const Uint32Vector& funcExportIndices,
bool LazyStubTier::createMany(const Uint32Vector& funcExportIndices,
const CodeTier& codeTier,
size_t* stubSegmentIndex) {
MOZ_ASSERT(funcExportIndices.length());
@ -673,8 +672,7 @@ bool LazyStubTier::createMany(HasGcTypes gcTypesConfigured,
Maybe<ImmPtr> callee;
callee.emplace(calleePtr, ImmPtr::NoCheckToken());
if (!GenerateEntryStubs(masm, funcExportIndex, fe, callee,
/* asmjs */ false, gcTypesConfigured,
&codeRanges)) {
/* asmjs */ false, &codeRanges)) {
return false;
}
}
@ -769,8 +767,7 @@ bool LazyStubTier::createOne(uint32_t funcExportIndex,
}
size_t stubSegmentIndex;
if (!createMany(codeTier.code().metadata().temporaryGcTypesConfigured,
funcExportIndexes, codeTier, &stubSegmentIndex)) {
if (!createMany(funcExportIndexes, codeTier, &stubSegmentIndex)) {
return false;
}
@ -797,8 +794,7 @@ bool LazyStubTier::createOne(uint32_t funcExportIndex,
return true;
}
bool LazyStubTier::createTier2(HasGcTypes gcTypesConfigured,
const Uint32Vector& funcExportIndices,
bool LazyStubTier::createTier2(const Uint32Vector& funcExportIndices,
const CodeTier& codeTier,
Maybe<size_t>* outStubSegmentIndex) {
if (!funcExportIndices.length()) {
@ -806,8 +802,7 @@ bool LazyStubTier::createTier2(HasGcTypes gcTypesConfigured,
}
size_t stubSegmentIndex;
if (!createMany(gcTypesConfigured, funcExportIndices, codeTier,
&stubSegmentIndex)) {
if (!createMany(funcExportIndices, codeTier, &stubSegmentIndex)) {
return false;
}

View File

@ -312,7 +312,6 @@ enum class MemoryUsage { None = false, Unshared = 1, Shared = 2 };
struct MetadataCacheablePod {
ModuleKind kind;
MemoryUsage memoryUsage;
HasGcTypes temporaryGcTypesConfigured;
uint32_t minMemoryLength;
uint32_t globalDataLength;
Maybe<uint32_t> maxMemoryLength;
@ -323,7 +322,6 @@ struct MetadataCacheablePod {
explicit MetadataCacheablePod(ModuleKind kind)
: kind(kind),
memoryUsage(MemoryUsage::None),
temporaryGcTypesConfigured(HasGcTypes::False),
minMemoryLength(0),
globalDataLength(0),
filenameIsURL(false) {}
@ -501,8 +499,7 @@ class LazyStubTier {
LazyFuncExportVector exports_;
size_t lastStubSegmentIndex_;
bool createMany(HasGcTypes gcTypesEnabled,
const Uint32Vector& funcExportIndices,
bool createMany(const Uint32Vector& funcExportIndices,
const CodeTier& codeTier, size_t* stubSegmentIndex);
public:
@ -523,8 +520,7 @@ class LazyStubTier {
// them in a single stub. Jit entries won't be used until
// setJitEntries() is actually called, after the Code owner has committed
// tier2.
bool createTier2(HasGcTypes gcTypesConfigured,
const Uint32Vector& funcExportIndices,
bool createTier2(const Uint32Vector& funcExportIndices,
const CodeTier& codeTier, Maybe<size_t>* stubSegmentIndex);
void setJitEntries(const Maybe<size_t>& stubSegmentIndex, const Code& code);

View File

@ -24,6 +24,7 @@
#include "jit/ProcessExecutableMemory.h"
#include "util/Text.h"
#include "wasm/WasmBaselineCompile.h"
#include "wasm/WasmCraneliftCompile.h"
#include "wasm/WasmGenerator.h"
#include "wasm/WasmIonCompile.h"
#include "wasm/WasmOpIter.h"
@ -72,27 +73,60 @@ uint32_t wasm::ObservedCPUFeatures() {
#endif
}
CompileArgs::CompileArgs(JSContext* cx, ScriptedCaller&& scriptedCaller)
: scriptedCaller(std::move(scriptedCaller)) {
bool gcEnabled = HasReftypesSupport(cx);
baselineEnabled = cx->options().wasmBaseline();
ionEnabled = cx->options().wasmIon();
SharedCompileArgs
CompileArgs::build(JSContext* cx, ScriptedCaller&& scriptedCaller)
{
bool baseline = BaselineCanCompile() && cx->options().wasmBaseline();
bool ion = IonCanCompile() && cx->options().wasmIon();
#ifdef ENABLE_WASM_CRANELIFT
forceCranelift = cx->options().wasmForceCranelift();
bool cranelift = CraneliftCanCompile() && cx->options().wasmCranelift();
#else
forceCranelift = false;
bool cranelift = false;
#endif
sharedMemoryEnabled =
cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled();
gcTypesConfigured = gcEnabled ? HasGcTypes::True : HasGcTypes::False;
testTiering = cx->options().testWasmAwaitTier2() || JitOptions.wasmDelayTier2;
// Debug information such as source view or debug traps will require
// additional memory and permanently stay in baseline code, so we try to
// only enable it when a developer actually cares: when the debugger tab
// is open.
debugEnabled = cx->realm()->debuggerObservesAsmJS();
bool debug = cx->realm()->debuggerObservesAsmJS();
bool gc = cx->options().wasmGc();
bool sharedMemory = cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled();
bool forceTiering = cx->options().testWasmAwaitTier2() || JitOptions.wasmDelayTier2;
if (debug || gc) {
if (!baseline) {
JS_ReportErrorASCII(cx, "can't use wasm debug/gc without baseline");
return nullptr;
}
ion = false;
cranelift = false;
}
if (forceTiering && (!baseline || (!cranelift && !ion))) {
// This can happen only in testing, and in this case we don't have a
// proper way to signal the error, so just silently override the default,
// instead of adding a skip-if directive to every test using debug/gc.
forceTiering = false;
}
// HasCompilerSupport() should prevent failure here.
MOZ_RELEASE_ASSERT(baseline || ion || cranelift);
CompileArgs* target = cx->new_<CompileArgs>(std::move(scriptedCaller));
if (!target) {
return nullptr;
}
target->baselineEnabled = baseline;
target->ionEnabled = ion;
target->craneliftEnabled = cranelift;
target->debugEnabled = debug;
target->sharedMemoryEnabled = sharedMemory;
target->forceTiering = forceTiering;
target->gcEnabled = gc;
return target;
}
// Classify the current system as one of a set of recognizable classes. This
@ -385,7 +419,7 @@ CompilerEnvironment::CompilerEnvironment(const CompileArgs& args)
CompilerEnvironment::CompilerEnvironment(CompileMode mode, Tier tier,
OptimizedBackend optimizedBackend,
DebugEnabled debugEnabled,
HasGcTypes gcTypesConfigured)
bool gcTypesConfigured)
: state_(InitialWithModeTierDebug),
mode_(mode),
tier_(tier),
@ -393,17 +427,16 @@ CompilerEnvironment::CompilerEnvironment(CompileMode mode, Tier tier,
debug_(debugEnabled),
gcTypes_(gcTypesConfigured) {}
void CompilerEnvironment::computeParameters(HasGcTypes gcFeatureOptIn) {
void CompilerEnvironment::computeParameters(bool gcFeatureOptIn) {
MOZ_ASSERT(state_ == InitialWithModeTierDebug);
if (gcTypes_ == HasGcTypes::True) {
if (gcTypes_) {
gcTypes_ = gcFeatureOptIn;
}
state_ = Computed;
}
void CompilerEnvironment::computeParameters(Decoder& d,
HasGcTypes gcFeatureOptIn) {
void CompilerEnvironment::computeParameters(Decoder& d, bool gcFeatureOptIn) {
MOZ_ASSERT(!isComputed());
if (state_ == InitialWithModeTierDebug) {
@ -411,11 +444,19 @@ void CompilerEnvironment::computeParameters(Decoder& d,
return;
}
bool gcEnabled = args_->gcTypesConfigured == HasGcTypes::True &&
gcFeatureOptIn == HasGcTypes::True;
bool argBaselineEnabled = args_->baselineEnabled || gcEnabled;
bool argIonEnabled = args_->ionEnabled && !gcEnabled;
bool argDebugEnabled = args_->debugEnabled;
bool gcEnabled = args_->gcEnabled && gcFeatureOptIn;
bool baselineEnabled = args_->baselineEnabled;
bool ionEnabled = args_->ionEnabled;
bool debugEnabled = args_->debugEnabled;
bool craneliftEnabled = args_->craneliftEnabled;
bool forceTiering = args_->forceTiering;
bool hasSecondTier = ionEnabled || craneliftEnabled;
MOZ_ASSERT_IF(gcEnabled || debugEnabled, baselineEnabled);
MOZ_ASSERT_IF(forceTiering, baselineEnabled && hasSecondTier);
// HasCompilerSupport() should prevent failure here
MOZ_RELEASE_ASSERT(baselineEnabled || ionEnabled || craneliftEnabled);
uint32_t codeSectionSize = 0;
@ -424,35 +465,19 @@ void CompilerEnvironment::computeParameters(Decoder& d,
codeSectionSize = range.size;
}
// Attempt to default to ion if baseline is disabled.
bool baselineEnabled = BaselineCanCompile() && argBaselineEnabled;
bool debugEnabled = BaselineCanCompile() && argDebugEnabled;
bool ionEnabled = IonCanCompile() && (argIonEnabled || !baselineEnabled);
#ifdef ENABLE_WASM_CRANELIFT
bool forceCranelift = args_->forceCranelift;
#endif
// HasCompilerSupport() should prevent failure here
MOZ_RELEASE_ASSERT(baselineEnabled || ionEnabled);
if (baselineEnabled && ionEnabled && !debugEnabled && CanUseExtraThreads() &&
(TieringBeneficial(codeSectionSize) || args_->testTiering)) {
if (baselineEnabled && hasSecondTier && CanUseExtraThreads() &&
(TieringBeneficial(codeSectionSize) || forceTiering)) {
mode_ = CompileMode::Tier1;
tier_ = Tier::Baseline;
} else {
mode_ = CompileMode::Once;
tier_ = debugEnabled || !ionEnabled ? Tier::Baseline : Tier::Optimized;
tier_ = hasSecondTier ? Tier::Optimized : Tier::Baseline;
}
optimizedBackend_ = OptimizedBackend::Ion;
#ifdef ENABLE_WASM_CRANELIFT
if (forceCranelift) {
optimizedBackend_ = OptimizedBackend::Cranelift;
}
#endif
optimizedBackend_ = craneliftEnabled ? OptimizedBackend::Cranelift : OptimizedBackend::Ion;
debug_ = debugEnabled ? DebugEnabled::True : DebugEnabled::False;
gcTypes_ = gcEnabled ? HasGcTypes::True : HasGcTypes::False;
gcTypes_ = gcEnabled;
state_ = Computed;
}
@ -524,7 +549,7 @@ SharedModule wasm::CompileBuffer(const CompileArgs& args,
CompilerEnvironment compilerEnv(args);
ModuleEnvironment env(
args.gcTypesConfigured, &compilerEnv,
args.gcEnabled, &compilerEnv,
args.sharedMemoryEnabled ? Shareable::True : Shareable::False);
if (!DecodeModuleEnvironment(d, &env)) {
return nullptr;
@ -551,10 +576,9 @@ void wasm::CompileTier2(const CompileArgs& args, const Bytes& bytecode,
UniqueChars error;
Decoder d(bytecode, 0, &error);
HasGcTypes gcTypesConfigured =
HasGcTypes::False; // No optimized backend support yet
bool gcTypesConfigured = false; // No optimized backend support yet
OptimizedBackend optimizedBackend =
args.forceCranelift ? OptimizedBackend::Cranelift : OptimizedBackend::Ion;
args.craneliftEnabled ? OptimizedBackend::Cranelift : OptimizedBackend::Ion;
CompilerEnvironment compilerEnv(CompileMode::Tier2, Tier::Optimized,
optimizedBackend, DebugEnabled::False,
@ -567,8 +591,7 @@ void wasm::CompileTier2(const CompileArgs& args, const Bytes& bytecode,
return;
}
MOZ_ASSERT(env.gcTypesEnabled() == HasGcTypes::False,
"can't ion-compile with gc types yet");
MOZ_ASSERT(!env.gcTypesEnabled(), "can't ion-compile with gc types yet");
ModuleGenerator mg(args, &env, cancelled, &error);
if (!mg.init()) {
@ -678,7 +701,7 @@ SharedModule wasm::CompileStreaming(
{
Decoder d(envBytes, 0, error, warnings);
env.emplace(args.gcTypesConfigured, &compilerEnv,
env.emplace(args.gcEnabled, &compilerEnv,
args.sharedMemoryEnabled ? Shareable::True : Shareable::False);
if (!DecodeModuleEnvironment(d, env.ptr())) {
return nullptr;

View File

@ -42,33 +42,44 @@ struct ScriptedCaller {
// Describes all the parameters that control wasm compilation.
struct CompileArgs;
typedef RefPtr<CompileArgs> MutableCompileArgs;
typedef RefPtr<const CompileArgs> SharedCompileArgs;
struct CompileArgs : ShareableBase<CompileArgs> {
ScriptedCaller scriptedCaller;
UniqueChars sourceMapURL;
bool baselineEnabled;
bool forceCranelift;
bool debugEnabled;
bool ionEnabled;
bool craneliftEnabled;
bool debugEnabled;
bool sharedMemoryEnabled;
HasGcTypes gcTypesConfigured;
bool testTiering;
bool forceTiering;
bool gcEnabled;
// CompileArgs has two constructors:
//
// - one through a factory function `build`, which checks that flags are
// consistent with each other.
// - one that gives complete access to underlying fields.
//
// You should use the first one in general, unless you have a very good
// reason (i.e. no JSContext around and you know which flags have been used).
static SharedCompileArgs build(JSContext* cx, ScriptedCaller&& scriptedCaller);
explicit CompileArgs(ScriptedCaller&& scriptedCaller)
: scriptedCaller(std::move(scriptedCaller)),
baselineEnabled(false),
forceCranelift(false),
debugEnabled(false),
ionEnabled(false),
craneliftEnabled(false),
debugEnabled(false),
sharedMemoryEnabled(false),
gcTypesConfigured(HasGcTypes::False),
testTiering(false) {}
CompileArgs(JSContext* cx, ScriptedCaller&& scriptedCaller);
forceTiering(false),
gcEnabled(false) {}
};
typedef RefPtr<CompileArgs> MutableCompileArgs;
typedef RefPtr<const CompileArgs> SharedCompileArgs;
// Return the estimated compiled (machine) code size for the given bytecode size
// compiled at the given tier.

View File

@ -30,6 +30,14 @@ using namespace js;
using namespace js::jit;
using namespace js::wasm;
bool wasm::CraneliftCanCompile() {
#ifdef JS_CODEGEN_X64
return true;
#else
return false;
#endif
}
static inline SymbolicAddress ToSymbolicAddress(BD_SymbolicAddress bd) {
switch (bd) {
case BD_SymbolicAddress::GrowMemory:
@ -274,6 +282,9 @@ bool wasm::CraneliftCompileFunctions(const ModuleEnvironment& env,
CompiledCode* code,
ExclusiveDeferredValidationState& dvs,
UniqueChars* error) {
MOZ_RELEASE_ASSERT(CraneliftCanCompile());
MOZ_ASSERT(env.tier() == Tier::Optimized);
MOZ_ASSERT(env.optimizedBackend() == OptimizedBackend::Cranelift);
MOZ_ASSERT(!env.isAsmJS());

View File

@ -26,6 +26,12 @@
namespace js {
namespace wasm {
#ifdef ENABLE_WASM_CRANELIFT
MOZ_MUST_USE bool CraneliftCanCompile();
#else
MOZ_MUST_USE inline bool CraneliftCanCompile() { return false; }
#endif
// Generates code with Cranelift.
MOZ_MUST_USE bool CraneliftCompileFunctions(
const ModuleEnvironment& env, LifoAlloc& lifo,

View File

@ -1056,7 +1056,6 @@ SharedMetadata ModuleGenerator::finishMetadata(const Bytes& bytecode) {
// Copy over data from the ModuleEnvironment.
metadata_->memoryUsage = env_->memoryUsage;
metadata_->temporaryGcTypesConfigured = env_->gcTypesConfigured;
metadata_->minMemoryLength = env_->minMemoryLength;
metadata_->maxMemoryLength = env_->maxMemoryLength;
metadata_->startFuncIndex = env_->startFuncIndex;

View File

@ -36,6 +36,7 @@
#include "vm/StringType.h"
#include "wasm/WasmBaselineCompile.h"
#include "wasm/WasmCompile.h"
#include "wasm/WasmCraneliftCompile.h"
#include "wasm/WasmInstance.h"
#include "wasm/WasmIonCompile.h"
#include "wasm/WasmModule.h"
@ -59,7 +60,7 @@ extern mozilla::Atomic<bool> fuzzingSafe;
bool wasm::HasReftypesSupport(JSContext* cx) {
#ifdef ENABLE_WASM_CRANELIFT
if (cx->options().wasmForceCranelift()) {
if (cx->options().wasmCranelift()) {
return false;
}
#endif
@ -102,14 +103,22 @@ bool wasm::HasCompilerSupport(JSContext* cx) {
}
#endif
return BaselineCanCompile() || IonCanCompile();
return BaselineCanCompile() || IonCanCompile() || CraneliftCanCompile();
}
bool wasm::HasOptimizedCompilerTier(JSContext* cx) {
return (cx->options().wasmIon() && IonCanCompile())
#ifdef ENABLE_WASM_CRANELIFT
|| (cx->options().wasmCranelift() && CraneliftCanCompile())
#endif
;
}
// Return whether wasm compilation is allowed by prefs. This check
// only makes sense if HasCompilerSupport() is true.
static bool HasAvailableCompilerTier(JSContext* cx) {
return (cx->options().wasmBaseline() && BaselineCanCompile()) ||
(cx->options().wasmIon() && IonCanCompile());
HasOptimizedCompilerTier(cx);
}
bool wasm::HasSupport(JSContext* cx) {
@ -119,7 +128,6 @@ bool wasm::HasSupport(JSContext* cx) {
bool wasm::HasStreamingSupport(JSContext* cx) {
// This should match EnsureStreamSupport().
return HasSupport(cx) &&
cx->runtime()->offThreadPromiseState.ref().initialized() &&
CanUseExtraThreads() && cx->runtime()->consumeStreamCallback &&
@ -127,7 +135,7 @@ bool wasm::HasStreamingSupport(JSContext* cx) {
}
bool wasm::HasCachingSupport(JSContext* cx) {
return HasStreamingSupport(cx) && cx->options().wasmIon() && IonCanCompile();
return HasStreamingSupport(cx) && HasOptimizedCompilerTier(cx);
}
static bool ToWebAssemblyValue(JSContext* cx, ValType targetType, HandleValue v,
@ -409,8 +417,7 @@ bool wasm::Eval(JSContext* cx, Handle<TypedArrayObject*> code,
return false;
}
MutableCompileArgs compileArgs =
cx->new_<CompileArgs>(cx, std::move(scriptedCaller));
SharedCompileArgs compileArgs = CompileArgs::build(cx, std::move(scriptedCaller));
if (!compileArgs) {
return false;
}
@ -1032,14 +1039,14 @@ static bool GetBufferSource(JSContext* cx, JSObject* obj, unsigned errorNumber,
return true;
}
static MutableCompileArgs InitCompileArgs(JSContext* cx,
const char* introducer) {
static SharedCompileArgs InitCompileArgs(JSContext* cx,
const char* introducer) {
ScriptedCaller scriptedCaller;
if (!DescribeScriptedCaller(cx, &scriptedCaller, introducer)) {
return nullptr;
}
return cx->new_<CompileArgs>(cx, std::move(scriptedCaller));
return CompileArgs::build(cx, std::move(scriptedCaller));
}
static bool ReportCompileWarnings(JSContext* cx,
@ -3338,7 +3345,7 @@ class ResolveResponseClosure : public NativeObject {
static const unsigned RESERVED_SLOTS = 4;
static const Class class_;
static ResolveResponseClosure* create(JSContext* cx, CompileArgs& args,
static ResolveResponseClosure* create(JSContext* cx, const CompileArgs& args,
HandleObject promise, bool instantiate,
HandleObject importObj) {
MOZ_ASSERT_IF(importObj, instantiate);
@ -3350,7 +3357,7 @@ class ResolveResponseClosure : public NativeObject {
}
args.AddRef();
obj->setReservedSlot(COMPILE_ARGS_SLOT, PrivateValue(&args));
obj->setReservedSlot(COMPILE_ARGS_SLOT, PrivateValue((void*)&args));
obj->setReservedSlot(PROMISE_OBJ_SLOT, ObjectValue(*promise));
obj->setReservedSlot(INSTANTIATE_SLOT, BooleanValue(instantiate));
obj->setReservedSlot(IMPORT_OBJ_SLOT, ObjectOrNullValue(importObj));
@ -3459,7 +3466,7 @@ static bool ResolveResponse(JSContext* cx, CallArgs callArgs,
const char* introducer = instantiate ? "WebAssembly.instantiateStreaming"
: "WebAssembly.compileStreaming";
MutableCompileArgs compileArgs = InitCompileArgs(cx, introducer);
SharedCompileArgs compileArgs = InitCompileArgs(cx, introducer);
if (!compileArgs) {
return false;
}

View File

@ -40,6 +40,10 @@ namespace wasm {
bool HasCompilerSupport(JSContext* cx);
// Return whether WebAssembly has support for an optimized compiler backend.
bool HasOptimizedCompilerTier(JSContext* cx);
// Return whether WebAssembly is supported on this platform. This determines
// whether the WebAssembly object is exposed to JS and takes into account
// configuration options that disable various modes.

View File

@ -132,12 +132,10 @@ bool Module::finishTier2(const LinkData& linkData2,
}
}
HasGcTypes gcTypesConfigured = code().metadata().temporaryGcTypesConfigured;
const CodeTier& tier2 = code().codeTier(Tier::Optimized);
Maybe<size_t> stub2Index;
if (!stubs2->createTier2(gcTypesConfigured, funcExportIndices, tier2,
&stub2Index)) {
if (!stubs2->createTier2(funcExportIndices, tier2, &stub2Index)) {
return false;
}

View File

@ -587,8 +587,7 @@ inline bool OpIter<Policy>::Join(StackType one, StackType two,
return true;
}
if (env_.gcTypesEnabled() == HasGcTypes::True && one.isReference() &&
two.isReference()) {
if (env_.gcTypesEnabled() && one.isReference() && two.isReference()) {
if (env_.isRefSubtypeOf(NonAnyToValType(two), NonAnyToValType(one))) {
*result = one;
return true;
@ -709,8 +708,8 @@ inline bool OpIter<Policy>::popWithType(StackType expectedType, Value* value) {
StackType observedType = tv.type();
if (!(MOZ_LIKELY(observedType == expectedType) ||
observedType == StackType::TVar || expectedType == StackType::TVar ||
(env_.gcTypesEnabled() == HasGcTypes::True &&
observedType.isReference() && expectedType.isReference() &&
(env_.gcTypesEnabled() && observedType.isReference() &&
expectedType.isReference() &&
env_.isRefSubtypeOf(NonAnyToValType(observedType),
NonAnyToValType(expectedType))))) {
return typeMismatch(observedType, expectedType);
@ -768,7 +767,7 @@ inline bool OpIter<Policy>::topWithType(ValType expectedType, Value* value) {
if (!MOZ_UNLIKELY(observed == expected)) {
if (observed == StackType::TVar ||
(env_.gcTypesEnabled() == HasGcTypes::True && observed.isReference() &&
(env_.gcTypesEnabled() && observed.isReference() &&
expected.isReference() &&
env_.isRefSubtypeOf(NonAnyToValType(observed), expectedType))) {
tv.typeRef() = expected;
@ -844,12 +843,11 @@ inline bool OpIter<Policy>::readBlockType(ExprType* type) {
known = true;
break;
case uint8_t(ExprType::Ref):
known = env_.gcTypesEnabled() == HasGcTypes::True &&
uncheckedRefTypeIndex < MaxTypes &&
known = env_.gcTypesEnabled() && uncheckedRefTypeIndex < MaxTypes &&
uncheckedRefTypeIndex < env_.types.length();
break;
case uint8_t(ExprType::AnyRef):
known = env_.gcTypesEnabled() == HasGcTypes::True;
known = env_.gcTypesEnabled();
break;
case uint8_t(ExprType::Limit):
break;
@ -2090,7 +2088,7 @@ inline bool OpIter<Policy>::readTableGet(uint32_t* tableIndex, Value* index) {
if (env_.tables[*tableIndex].kind != TableKind::AnyRef) {
return fail("table.get only on tables of anyref");
}
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return fail("anyref support not enabled");
}
@ -2132,7 +2130,7 @@ inline bool OpIter<Policy>::readTableGrow(uint32_t* tableIndex, Value* delta,
if (env_.tables[*tableIndex].kind != TableKind::AnyRef) {
return fail("table.grow only on tables of anyref");
}
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return fail("anyref support not enabled");
}
@ -2174,7 +2172,7 @@ inline bool OpIter<Policy>::readTableSet(uint32_t* tableIndex, Value* index,
if (env_.tables[*tableIndex].kind != TableKind::AnyRef) {
return fail("table.set only on tables of anyref");
}
if (env_.gcTypesEnabled() == HasGcTypes::False) {
if (!env_.gcTypesEnabled()) {
return fail("anyref support not enabled");
}

View File

@ -287,7 +287,6 @@ static void CallFuncExport(MacroAssembler& masm, const FuncExport& fe,
// must map from the ABI of ExportFuncPtr to the export's signature's ABI.
static bool GenerateInterpEntry(MacroAssembler& masm, const FuncExport& fe,
const Maybe<ImmPtr>& funcPtr,
HasGcTypes gcTypesConfigured,
Offsets* offsets) {
AssertExpectedSP(masm);
masm.haltingAlign(CodeAlignment);
@ -512,7 +511,7 @@ static void GenerateJitEntryThrow(MacroAssembler& masm, unsigned frameSize) {
static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex,
const FuncExport& fe, const Maybe<ImmPtr>& funcPtr,
HasGcTypes gcTypesConfigured, Offsets* offsets) {
Offsets* offsets) {
AssertExpectedSP(masm);
RegisterOrSP sp = masm.getStackPointer();
@ -1893,13 +1892,12 @@ static bool GenerateDebugTrapStub(MacroAssembler& masm, Label* throwLabel,
bool wasm::GenerateEntryStubs(MacroAssembler& masm, size_t funcExportIndex,
const FuncExport& fe, const Maybe<ImmPtr>& callee,
bool isAsmJS, HasGcTypes gcTypesConfigured,
CodeRangeVector* codeRanges) {
bool isAsmJS, CodeRangeVector* codeRanges) {
MOZ_ASSERT(!callee == fe.hasEagerStubs());
MOZ_ASSERT_IF(isAsmJS, fe.hasEagerStubs());
Offsets offsets;
if (!GenerateInterpEntry(masm, fe, callee, gcTypesConfigured, &offsets)) {
if (!GenerateInterpEntry(masm, fe, callee, &offsets)) {
return false;
}
if (!codeRanges->emplaceBack(CodeRange::InterpEntry, fe.funcIndex(),
@ -1911,8 +1909,7 @@ bool wasm::GenerateEntryStubs(MacroAssembler& masm, size_t funcExportIndex,
return true;
}
if (!GenerateJitEntry(masm, funcExportIndex, fe, callee, gcTypesConfigured,
&offsets)) {
if (!GenerateJitEntry(masm, funcExportIndex, fe, callee, &offsets)) {
return false;
}
if (!codeRanges->emplaceBack(CodeRange::JitEntry, fe.funcIndex(), offsets)) {
@ -1973,7 +1970,7 @@ bool wasm::GenerateStubs(const ModuleEnvironment& env,
continue;
}
if (!GenerateEntryStubs(masm, i, fe, noAbsolute, env.isAsmJS(),
env.gcTypesConfigured, &code->codeRanges)) {
&code->codeRanges)) {
return false;
}
}

View File

@ -41,7 +41,6 @@ extern bool GenerateEntryStubs(jit::MacroAssembler& masm,
size_t funcExportIndex,
const FuncExport& funcExport,
const Maybe<jit::ImmPtr>& callee, bool isAsmJS,
HasGcTypes gcTypesConfigured,
CodeRangeVector* codeRanges);
extern void GenerateTrapExitMachineState(jit::MachineState* machine,

View File

@ -666,8 +666,6 @@ enum ModuleKind { Wasm, AsmJS };
enum class Shareable { False, True };
enum class HasGcTypes { False, True };
// The LitVal class represents a single WebAssembly value of a given value
// type, mostly for the purpose of numeric literals and initializers. A LitVal
// does not directly map to a JS value since there is not (currently) a precise

View File

@ -395,7 +395,7 @@ bool wasm::EncodeLocalEntries(Encoder& e, const ValTypeVector& locals) {
}
static bool DecodeValType(Decoder& d, ModuleKind kind, uint32_t numTypes,
HasGcTypes gcTypesEnabled, ValType* type) {
bool gcTypesEnabled, ValType* type) {
uint8_t uncheckedCode;
uint32_t uncheckedRefTypeIndex;
if (!d.readValType(&uncheckedCode, &uncheckedRefTypeIndex)) {
@ -410,13 +410,13 @@ static bool DecodeValType(Decoder& d, ModuleKind kind, uint32_t numTypes,
*type = ValType(ValType::Code(uncheckedCode));
return true;
case uint8_t(ValType::AnyRef):
if (gcTypesEnabled == HasGcTypes::False) {
if (!gcTypesEnabled) {
return d.fail("reference types not enabled");
}
*type = ValType(ValType::Code(uncheckedCode));
return true;
case uint8_t(ValType::Ref): {
if (gcTypesEnabled == HasGcTypes::False) {
if (!gcTypesEnabled) {
return d.fail("reference types not enabled");
}
if (uncheckedRefTypeIndex >= numTypes) {
@ -441,8 +441,7 @@ static bool ValidateRefType(Decoder& d, const TypeDefVector& types,
}
bool wasm::DecodeLocalEntries(Decoder& d, ModuleKind kind,
const TypeDefVector& types,
HasGcTypes gcTypesEnabled,
const TypeDefVector& types, bool gcTypesEnabled,
ValTypeVector* locals) {
uint32_t numLocalEntries;
if (!d.readVarU32(&numLocalEntries)) {
@ -938,7 +937,7 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
#endif
#ifdef ENABLE_WASM_GC
case uint16_t(MiscOp::StructNew): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
uint32_t unusedUint;
@ -946,14 +945,14 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
CHECK(iter.readStructNew(&unusedUint, &unusedArgs));
}
case uint16_t(MiscOp::StructGet): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
uint32_t unusedUint1, unusedUint2;
CHECK(iter.readStructGet(&unusedUint1, &unusedUint2, &nothing));
}
case uint16_t(MiscOp::StructSet): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
uint32_t unusedUint1, unusedUint2;
@ -961,7 +960,7 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
&nothing));
}
case uint16_t(MiscOp::StructNarrow): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
ValType unusedTy, unusedTy2;
@ -975,7 +974,7 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
}
#ifdef ENABLE_WASM_GC
case uint16_t(Op::RefEq): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
CHECK(iter.readComparison(ValType::AnyRef, &nothing, &nothing));
@ -984,14 +983,14 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
#endif
#ifdef ENABLE_WASM_REFTYPES
case uint16_t(Op::RefNull): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
CHECK(iter.readRefNull());
break;
}
case uint16_t(Op::RefIsNull): {
if (env.gcTypesEnabled() == HasGcTypes::False) {
if (!env.gcTypesEnabled()) {
return iter.unrecognizedOpcode(&op);
}
CHECK(iter.readConversion(ValType::AnyRef, ValType::I32, &nothing));
@ -1325,7 +1324,7 @@ static bool DecodeFuncType(Decoder& d, ModuleEnvironment* env,
static bool DecodeStructType(Decoder& d, ModuleEnvironment* env,
TypeStateVector* typeState, uint32_t typeIndex) {
if (env->gcTypesEnabled() == HasGcTypes::False) {
if (!env->gcTypesEnabled()) {
return d.fail("Structure types not enabled");
}
@ -1451,7 +1450,7 @@ static bool DecodeGCFeatureOptInSection(Decoder& d, ModuleEnvironment* env) {
"The current version is 2.");
}
env->gcFeatureOptIn = HasGcTypes::True;
env->gcFeatureOptIn = true;
return d.finishSection(*range, "gcfeatureoptin");
}
#endif
@ -1607,7 +1606,7 @@ static bool DecodeLimits(Decoder& d, Limits* limits,
return true;
}
static bool DecodeTableTypeAndLimits(Decoder& d, HasGcTypes gcTypesEnabled,
static bool DecodeTableTypeAndLimits(Decoder& d, bool gcTypesEnabled,
TableDescVector* tables) {
uint8_t elementType;
if (!d.readFixedU8(&elementType)) {
@ -1619,7 +1618,7 @@ static bool DecodeTableTypeAndLimits(Decoder& d, HasGcTypes gcTypesEnabled,
tableKind = TableKind::AnyFunction;
#ifdef ENABLE_WASM_GENERALIZED_TABLES
} else if (elementType == uint8_t(TypeCode::AnyRef)) {
if (gcTypesEnabled == HasGcTypes::False) {
if (!gcTypesEnabled) {
return d.fail("reference types not enabled");
}
tableKind = TableKind::AnyRef;
@ -1672,7 +1671,7 @@ static bool GlobalIsJSCompatible(Decoder& d, ValType type, bool isMutable) {
}
static bool DecodeGlobalType(Decoder& d, const TypeDefVector& types,
HasGcTypes gcTypesEnabled, ValType* type,
bool gcTypesEnabled, ValType* type,
bool* isMutable) {
if (!DecodeValType(d, ModuleKind::Wasm, types.length(), gcTypesEnabled,
type)) {
@ -1993,7 +1992,7 @@ static bool DecodeInitializerExpression(Decoder& d, ModuleEnvironment* env,
break;
}
case uint16_t(Op::RefNull): {
if (env->gcTypesEnabled() == HasGcTypes::False) {
if (!env->gcTypesEnabled()) {
return d.fail("unexpected initializer expression");
}
if (!expected.isReference()) {
@ -2022,8 +2021,7 @@ static bool DecodeInitializerExpression(Decoder& d, ModuleEnvironment* env,
"initializer expression must reference a global immutable import");
}
if (expected.isReference()) {
if (!(env->gcTypesEnabled() == HasGcTypes::True &&
globals[i].type().isReference() &&
if (!(env->gcTypesEnabled() && globals[i].type().isReference() &&
env->isRefSubtypeOf(globals[i].type(), expected))) {
return d.fail(
"type mismatch: initializer type and expected type don't match");
@ -2422,9 +2420,9 @@ bool wasm::DecodeModuleEnvironment(Decoder& d, ModuleEnvironment* env) {
if (!DecodeGCFeatureOptInSection(d, env)) {
return false;
}
HasGcTypes gcFeatureOptIn = env->gcFeatureOptIn;
bool gcFeatureOptIn = env->gcFeatureOptIn;
#else
HasGcTypes gcFeatureOptIn = HasGcTypes::False;
bool gcFeatureOptIn = false;
#endif
env->compilerEnv->computeParameters(d, gcFeatureOptIn);
@ -2793,10 +2791,9 @@ bool wasm::Validate(JSContext* cx, const ShareableBytes& bytecode,
Decoder d(bytecode.bytes, 0, error);
#ifdef ENABLE_WASM_REFTYPES
HasGcTypes gcTypesConfigured =
HasReftypesSupport(cx) ? HasGcTypes::True : HasGcTypes::False;
bool gcTypesConfigured = HasReftypesSupport(cx);
#else
HasGcTypes gcTypesConfigured = HasGcTypes::False;
bool gcTypesConfigured = false;
#endif
CompilerEnvironment compilerEnv(CompileMode::Once, Tier::Optimized,

View File

@ -68,7 +68,7 @@ struct CompilerEnvironment {
Tier tier_;
OptimizedBackend optimizedBackend_;
DebugEnabled debug_;
HasGcTypes gcTypes_;
bool gcTypes_;
};
};
@ -82,15 +82,15 @@ struct CompilerEnvironment {
// value of gcTypes.
CompilerEnvironment(CompileMode mode, Tier tier,
OptimizedBackend optimizedBackend,
DebugEnabled debugEnabled, HasGcTypes gcTypesConfigured);
DebugEnabled debugEnabled, bool gcTypesConfigured);
// Compute any remaining compilation parameters.
void computeParameters(Decoder& d, HasGcTypes gcFeatureOptIn);
void computeParameters(Decoder& d, bool gcFeatureOptIn);
// Compute any remaining compilation parameters. Only use this method if
// the CompilerEnvironment was created with values for mode, tier, and
// debug.
void computeParameters(HasGcTypes gcFeatureOptIn);
void computeParameters(bool gcFeatureOptIn);
bool isComputed() const { return state_ == Computed; }
CompileMode mode() const {
@ -109,7 +109,7 @@ struct CompilerEnvironment {
MOZ_ASSERT(isComputed());
return debug_;
}
HasGcTypes gcTypes() const {
bool gcTypes() const {
MOZ_ASSERT(isComputed());
return gcTypes_;
}
@ -132,14 +132,6 @@ struct ModuleEnvironment {
// Constant parameters for the entire compilation:
const ModuleKind kind;
const Shareable sharedMemoryEnabled;
// `gcTypesConfigured` reflects the value of the flags --wasm-gc and
// javascript.options.wasm_gc. These flags will disappear eventually, thus
// allowing the removal of this variable and its replacement everywhere by
// the value HasGcTypes::True.
//
// For now, the value is used to control whether we emit code to suppress GC
// while wasm activations are on the stack.
const HasGcTypes gcTypesConfigured;
CompilerEnvironment* const compilerEnv;
// Module fields decoded from the module environment (or initialized while
@ -147,12 +139,12 @@ struct ModuleEnvironment {
#ifdef ENABLE_WASM_REFTYPES
// `gcFeatureOptIn` reflects the presence in a module of a GcFeatureOptIn
// section. This variable will be removed eventually, allowing it to be
// replaced everywhere by the value HasGcTypes::True.
// replaced everywhere by the value true.
//
// The flag is used in the value of gcTypesEnabled(), which controls whether
// ref types and struct types and associated instructions are accepted
// during validation.
HasGcTypes gcFeatureOptIn;
bool gcFeatureOptIn;
#endif
MemoryUsage memoryUsage;
uint32_t minMemoryLength;
@ -177,16 +169,15 @@ struct ModuleEnvironment {
Maybe<Name> moduleName;
NameVector funcNames;
explicit ModuleEnvironment(HasGcTypes gcTypesConfigured,
explicit ModuleEnvironment(bool gcTypesConfigured,
CompilerEnvironment* compilerEnv,
Shareable sharedMemoryEnabled,
ModuleKind kind = ModuleKind::Wasm)
: kind(kind),
sharedMemoryEnabled(sharedMemoryEnabled),
gcTypesConfigured(gcTypesConfigured),
compilerEnv(compilerEnv),
#ifdef ENABLE_WASM_REFTYPES
gcFeatureOptIn(HasGcTypes::False),
gcFeatureOptIn(false),
#endif
memoryUsage(MemoryUsage::None),
minMemoryLength(0),
@ -206,7 +197,7 @@ struct ModuleEnvironment {
size_t numFuncDefs() const {
return funcTypes.length() - funcImportGlobalDataOffsets.length();
}
HasGcTypes gcTypesEnabled() const { return compilerEnv->gcTypes(); }
bool gcTypesEnabled() const { return compilerEnv->gcTypes(); }
bool usesMemory() const { return memoryUsage != MemoryUsage::None; }
bool usesSharedMemory() const { return memoryUsage == MemoryUsage::Shared; }
bool isAsmJS() const { return kind == ModuleKind::AsmJS; }
@ -219,7 +210,7 @@ struct ModuleEnvironment {
bool isRefSubtypeOf(ValType one, ValType two) const {
MOZ_ASSERT(one.isReference());
MOZ_ASSERT(two.isReference());
MOZ_ASSERT(gcTypesEnabled() == HasGcTypes::True);
MOZ_ASSERT(gcTypesEnabled());
return one == two || two == ValType::AnyRef || one == ValType::NullRef ||
(one.isRef() && two.isRef() && isStructPrefixOf(two, one));
}
@ -792,7 +783,7 @@ MOZ_MUST_USE bool DecodeValidatedLocalEntries(Decoder& d,
MOZ_MUST_USE bool DecodeLocalEntries(Decoder& d, ModuleKind kind,
const TypeDefVector& types,
HasGcTypes gcTypesEnabled,
bool gcTypesEnabled,
ValTypeVector* locals);
// Returns whether the given [begin, end) prefix of a module's bytecode starts a

View File

@ -865,7 +865,7 @@ static void ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx) {
.setWasmIon(useWasmIon)
.setWasmBaseline(useWasmBaseline)
#ifdef ENABLE_WASM_CRANELIFT
.setWasmForceCranelift(useWasmCranelift)
.setWasmCranelift(useWasmCranelift)
#endif
#ifdef ENABLE_WASM_REFTYPES
.setWasmGc(useWasmGc)

View File

@ -456,6 +456,19 @@ VARCACHE_PREF(
RelaxedAtomicBool, false
)
// Block multiple external protocol URLs in iframes per single event.
#ifdef NIGHTLY_BUILD
#define PREF_VALUE true
#else
#define PREF_VALUE false
#endif
VARCACHE_PREF(
"dom.block_external_protocol_in_iframes",
dom_block_external_protocol_in_iframes,
bool, PREF_VALUE
)
#undef PREF_VALUE
// Block multiple window.open() per single event.
VARCACHE_PREF(
"dom.block_multiple_popups",

View File

@ -1031,10 +1031,6 @@ void HttpChannelChild::OnStopRequest(
static_cast<uint32_t>(channelStatus)));
MOZ_ASSERT(NS_IsMainThread());
if (mOnStopRequestCalled && !mIPCOpen) {
return;
}
if (mDivertingToParent) {
MOZ_RELEASE_ASSERT(
!mFlushedForDiversion,
@ -1191,32 +1187,29 @@ void HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest,
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mIsPending);
auto checkForBlockedContent = [&]() {
// NB: We use aChannelStatus here instead of mStatus because if there was an
// nsCORSListenerProxy on this request, it will override the tracking
// protection's return value.
if (aChannelStatus == NS_ERROR_TRACKING_URI ||
aChannelStatus == NS_ERROR_MALWARE_URI ||
aChannelStatus == NS_ERROR_UNWANTED_URI ||
aChannelStatus == NS_ERROR_BLOCKED_URI ||
aChannelStatus == NS_ERROR_HARMFUL_URI ||
aChannelStatus == NS_ERROR_PHISHING_URI) {
nsCString list, provider, fullhash;
// NB: We use aChannelStatus here instead of mStatus because if there was an
// nsCORSListenerProxy on this request, it will override the tracking
// protection's return value.
if (aChannelStatus == NS_ERROR_TRACKING_URI ||
aChannelStatus == NS_ERROR_MALWARE_URI ||
aChannelStatus == NS_ERROR_UNWANTED_URI ||
aChannelStatus == NS_ERROR_BLOCKED_URI ||
aChannelStatus == NS_ERROR_HARMFUL_URI ||
aChannelStatus == NS_ERROR_PHISHING_URI) {
nsCString list, provider, fullhash;
nsresult rv = GetMatchedList(list);
NS_ENSURE_SUCCESS_VOID(rv);
nsresult rv = GetMatchedList(list);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedProvider(provider);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedProvider(provider);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedFullHash(fullhash);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedFullHash(fullhash);
NS_ENSURE_SUCCESS_VOID(rv);
UrlClassifierCommon::SetBlockedContent(this, aChannelStatus, list,
provider, fullhash);
}
};
checkForBlockedContent();
UrlClassifierCommon::SetBlockedContent(this, aChannelStatus, list, provider,
fullhash);
}
MOZ_ASSERT(!mOnStopRequestCalled, "We should not call OnStopRequest twice");
@ -3794,15 +3787,6 @@ void HttpChannelChild::ActorDestroy(ActorDestroyReason aWhy) {
// and BackgroundChild might have pending IPC messages.
// Clean up BackgroundChild at this time to prevent memleak.
if (aWhy != Deletion) {
// The actor tree might get destroyed before we get the OnStopRequest.
// So if we didn't get it, we send it here in order to prevent any leaks.
// Ocasionally we will get the OnStopRequest message after this, in which
// case we just ignore it as we've already cleared the listener.
if (!mOnStopRequestCalled && mListener) {
DoPreOnStopRequest(NS_ERROR_ABORT);
DoOnStopRequest(this, NS_ERROR_ABORT, mListenerContext);
}
CleanupBackgroundChannel();
}
}

View File

@ -1 +1 @@
leak-threshold: [tab:409600]
leak-threshold: [tab:358400]

View File

@ -1,3 +1,5 @@
disabled:
if asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
lsan-allowed: [Alloc, CreateCDMProxy, MakeUnique, Malloc, NewPage, Realloc, mozilla::EMEDecryptor::EMEDecryptor, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::dom::MediaKeys::CreateCDMProxy, mozilla::dom::nsIContentChild::GetConstructedEventTarget]
leak-threshold: [default:51200]

View File

@ -1,5 +1,3 @@
[clearkey-events.https.html]
expected:
if os == "android": TIMEOUT
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213

View File

@ -1,6 +1,3 @@
[clearkey-generate-request-disallowed-input.https.html]
expected:
if os == "android": TIMEOUT
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213

View File

@ -1,6 +1,4 @@
[clearkey-invalid-license.https.html]
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
[Update with invalid Clear Key license]
expected:
if os == "android": FAIL

View File

@ -1,6 +1,3 @@
[clearkey-keystatuses-multiple-sessions.https.html]
expected:
if os == "android": TIMEOUT
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213

View File

@ -1,6 +1,4 @@
[clearkey-mp4-playback-temporary-clear-encrypted-segmented.https.html]
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
[org.w3.clearkey, temporary, mp4, playback, encrypted and clear sources in separate segments]
expected:
if os == "android": FAIL

View File

@ -1,6 +1,4 @@
[clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html]
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
[org.w3.clearkey, successful playback, temporary, mp4, multiple keys, sequential, readyState]
expected:
if os == "android": FAIL

View File

@ -1,6 +1,4 @@
[clearkey-mp4-setmediakeys-again-after-resetting-src.https.html]
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
[org.w3.clearkey, setmediakeys again after resetting src]
expected:
if os == "android": FAIL

View File

@ -1,6 +1,3 @@
[clearkey-mp4-setmediakeys-at-same-time.https.html]
expected:
if os == "android": TIMEOUT
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213

View File

@ -1,6 +1,4 @@
[clearkey-mp4-setmediakeys-multiple-times-with-different-mediakeys.https.html]
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
[org.w3.clearkey, setmediakeys multiple times with different mediakeys]
expected:
if os == "android": FAIL

View File

@ -1,6 +1,4 @@
[clearkey-mp4-setmediakeys-multiple-times-with-the-same-mediakeys.https.html]
disabled:
if os == "linux" and asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1522213
[org.w3.clearkey, setmediakeys multiple times with the same mediakeys]
expected:
if os == "android": FAIL