Skip to content

Commit

Permalink
Bug 1879179 - wasm: Remove exceptions feature flag. r=bvisness
Browse files Browse the repository at this point in the history
Exceptions has shipped for a while and is stable. We should
be able to remove the flag.

Differential Revision: https://phabricator.services.mozilla.com/D201870
  • Loading branch information
eqrion committed Feb 27, 2024
1 parent ad5665f commit 7715c08
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 99 deletions.
9 changes: 0 additions & 9 deletions js/public/WasmFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@
/* flag force enable */ false, \
/* flag fuzz enable */ true, \
/* preference name */ extended_const) \
FEATURE( \
/* capitalized name */ Exceptions, \
/* lower case name */ exceptions, \
/* compile predicate */ true, \
/* compiler predicate */ AnyCompilerAvailable(cx), \
/* flag predicate */ true, \
/* flag force enable */ WasmExnRefFlag(cx), \
/* flag fuzz enable */ true, \
/* preference name */ exceptions) \
FEATURE( \
/* capitalized name */ ExnRef, \
/* lower case name */ exnref, \
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit-test/etc/wasm/generate-spectests/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ url = "https://github.com/WebAssembly/exception-handling"
branch = "main"
parent = "spec"
# Skip in jit-test when it's not enabled
directive = "; --setpref=wasm_exceptions=true; --setpref=wasm_exnref=true; skip-if: !wasmExceptionsEnabled()"
directive = "; --setpref=wasm_exnref=true; skip-if: !wasmExnRefEnabled()"
excluded_tests = [
# harness doesn't support exnref, because JS-API globals can't use it
"ref_null.wast.js"
Expand Down
4 changes: 2 additions & 2 deletions js/src/jit-test/lib/wasm-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ const MozPrefix = 0xff;

const definedOpcodes =
[0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
...(wasmExceptionsEnabled() ? [0x06, 0x07, 0x08, 0x09] : []),
0x06, 0x07, 0x08, 0x09,
...(wasmExnRefEnabled() ? [0x0a] : []),
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11,
...(wasmTailCallsEnabled() ? [0x12, 0x13] : []),
...(wasmFunctionReferencesEnabled() ? [0x14] : []),
...(wasmTailCallsEnabled() &&
wasmFunctionReferencesEnabled() ? [0x15] : []),
...(wasmExceptionsEnabled() ? [0x18, 0x19] : []),
0x18, 0x19,
0x1a, 0x1b, 0x1c,
...(wasmExnRefEnabled() ? [0x1f] : []),
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit-test/tests/wasm/exceptions/directives.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
|jit-test| test-also=--setpref=wasm_exnref=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; include:wasm.js; skip-if: !wasmExceptionsEnabled()
|jit-test| test-also=--setpref=wasm_exnref=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; include:wasm.js
7 changes: 1 addition & 6 deletions js/src/jit-test/tests/wasm/features.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// |jit-test| test-also=--setpref=wasm_extended_const=true; test-also=--setpref=wasm_exceptions=true;
// |jit-test| test-also=--setpref=wasm_extended_const=true;

// Test that if a feature is 'experimental' then we must be in a nightly build,
// and if a feature is 'released' then it must be enabled on release and beta.
Expand Down Expand Up @@ -67,11 +67,6 @@ for (let [name, enabled, test] of releasedFeaturesMaybeDisabledAnyway) {

let releasedFeatures = [
['threads', wasmThreadsEnabled(), `(module (memory 1 1 shared))`],
[
'exceptions',
wasmExceptionsEnabled(),
`(module (type (func)) (tag (type 0)))`
],
[
'extended-const',
wasmExtendedConstEnabled(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_exceptions=true; --setpref=wasm_exnref=true; skip-if: !wasmExceptionsEnabled()
|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_exnref=true; skip-if: !wasmExnRefEnabled()
2 changes: 0 additions & 2 deletions js/src/jit-test/tests/wasm/tail-calls/exceptions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// |jit-test| --setpref=wasm_exceptions=true; skip-if: !wasmExceptionsEnabled()

// Simple test with return_call.
var ins = wasmEvalText(`(module
(tag $exn)
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit-test/tests/wasm/tail-calls/litmus3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled()
// |jit-test| skip-if: !wasmTailCallsEnabled()

// Mutually recursive functions implement a multi-entry loop using tail calls,
// with exception handling.
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit-test/tests/wasm/tail-calls/litmus4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled()
// |jit-test| skip-if: !wasmTailCallsEnabled()

// Mutually recursive functions implement a multi-entry loop using indirect tail
// calls, with exception handling.
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit-test/tests/wasm/tail-calls/litmus8.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled()
// |jit-test| skip-if: !wasmTailCallsEnabled()

// Tail-call litmus test with multiple results
//
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit-test/tests/wasm/tail-calls/litmus9.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled()
// |jit-test| skip-if: !wasmTailCallsEnabled()

// Tail-call litmus test with multiple results
//
Expand Down
18 changes: 0 additions & 18 deletions js/src/wasm/WasmBaselineCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9989,36 +9989,18 @@ bool BaseCompiler::emitBody() {
case uint16_t(Op::Else):
CHECK_NEXT(emitElse());
case uint16_t(Op::Try):
if (!moduleEnv_.exceptionsEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitTry());
case uint16_t(Op::Catch):
if (!moduleEnv_.exceptionsEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitCatch());
case uint16_t(Op::CatchAll):
if (!moduleEnv_.exceptionsEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitCatchAll());
case uint16_t(Op::Delegate):
if (!moduleEnv_.exceptionsEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK(emitDelegate());
iter_.popDelegate();
NEXT();
case uint16_t(Op::Throw):
if (!moduleEnv_.exceptionsEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitThrow());
case uint16_t(Op::Rethrow):
if (!moduleEnv_.exceptionsEnabled()) {
return iter_.unrecognizedOpcode(&op);
}
CHECK_NEXT(emitRethrow());
case uint16_t(Op::ThrowRef):
if (!moduleEnv_.exnrefEnabled()) {
Expand Down
18 changes: 0 additions & 18 deletions js/src/wasm/WasmIonCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8012,37 +8012,19 @@ static bool EmitBodyExprs(FunctionCompiler& f) {
case uint16_t(Op::Else):
CHECK(EmitElse(f));
case uint16_t(Op::Try):
if (!f.moduleEnv().exceptionsEnabled()) {
return f.iter().unrecognizedOpcode(&op);
}
CHECK(EmitTry(f));
case uint16_t(Op::Catch):
if (!f.moduleEnv().exceptionsEnabled()) {
return f.iter().unrecognizedOpcode(&op);
}
CHECK(EmitCatch(f));
case uint16_t(Op::CatchAll):
if (!f.moduleEnv().exceptionsEnabled()) {
return f.iter().unrecognizedOpcode(&op);
}
CHECK(EmitCatchAll(f));
case uint16_t(Op::Delegate):
if (!f.moduleEnv().exceptionsEnabled()) {
return f.iter().unrecognizedOpcode(&op);
}
if (!EmitDelegate(f)) {
return false;
}
break;
case uint16_t(Op::Throw):
if (!f.moduleEnv().exceptionsEnabled()) {
return f.iter().unrecognizedOpcode(&op);
}
CHECK(EmitThrow(f));
case uint16_t(Op::Rethrow):
if (!f.moduleEnv().exceptionsEnabled()) {
return f.iter().unrecognizedOpcode(&op);
}
CHECK(EmitRethrow(f));
case uint16_t(Op::ThrowRef):
if (!f.moduleEnv().exnrefEnabled()) {
Expand Down
16 changes: 7 additions & 9 deletions js/src/wasm/WasmJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5351,15 +5351,13 @@ static bool WebAssemblyClassFinish(JSContext* cx, HandleObject object,
}
}

if (ExceptionsAvailable(cx)) {
constexpr NameAndProtoKey exceptionEntries[] = {
{"Tag", JSProto_WasmTag},
{"Exception", JSProto_WasmException},
};
for (const auto& entry : exceptionEntries) {
if (!WebAssemblyDefineConstructor(cx, wasm, entry, &ctorValue, &id)) {
return false;
}
constexpr NameAndProtoKey exceptionEntries[] = {
{"Tag", JSProto_WasmTag},
{"Exception", JSProto_WasmException},
};
for (const auto& entry : exceptionEntries) {
if (!WebAssemblyDefineConstructor(cx, wasm, entry, &ctorValue, &id)) {
return false;
}
}

Expand Down
22 changes: 0 additions & 22 deletions js/src/wasm/WasmValidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,31 +1285,19 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
CHECK(iter.readRefIsNull(&nothing));
}
case uint16_t(Op::Try):
if (!env.exceptionsEnabled()) {
return iter.unrecognizedOpcode(&op);
}
CHECK(iter.readTry(&unusedType));
case uint16_t(Op::Catch): {
if (!env.exceptionsEnabled()) {
return iter.unrecognizedOpcode(&op);
}
LabelKind unusedKind;
uint32_t unusedIndex;
CHECK(iter.readCatch(&unusedKind, &unusedIndex, &unusedType,
&unusedType, &nothings));
}
case uint16_t(Op::CatchAll): {
if (!env.exceptionsEnabled()) {
return iter.unrecognizedOpcode(&op);
}
LabelKind unusedKind;
CHECK(iter.readCatchAll(&unusedKind, &unusedType, &unusedType,
&nothings));
}
case uint16_t(Op::Delegate): {
if (!env.exceptionsEnabled()) {
return iter.unrecognizedOpcode(&op);
}
uint32_t unusedDepth;
if (!iter.readDelegate(&unusedDepth, &unusedType, &nothings)) {
return false;
Expand All @@ -1318,16 +1306,10 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
break;
}
case uint16_t(Op::Throw): {
if (!env.exceptionsEnabled()) {
return iter.unrecognizedOpcode(&op);
}
uint32_t unusedIndex;
CHECK(iter.readThrow(&unusedIndex, &nothings));
}
case uint16_t(Op::Rethrow): {
if (!env.exceptionsEnabled()) {
return iter.unrecognizedOpcode(&op);
}
uint32_t unusedDepth;
CHECK(iter.readRethrow(&unusedDepth));
}
Expand Down Expand Up @@ -2479,10 +2461,6 @@ static bool DecodeTagSection(Decoder& d, ModuleEnvironment* env) {
return true;
}

if (!env->exceptionsEnabled()) {
return d.fail("exceptions not enabled");
}

uint32_t numDefs;
if (!d.readVarU32(&numDefs)) {
return d.fail("expected number of tags");
Expand Down
6 changes: 0 additions & 6 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7711,12 +7711,6 @@
mirror: always
set_spidermonkey_pref: startup

- name: javascript.options.wasm_exceptions
type: bool
value: true
mirror: always
set_spidermonkey_pref: startup

- name: javascript.options.wasm_exnref
type: bool
value: @IS_EARLY_BETA_OR_EARLIER@
Expand Down

0 comments on commit 7715c08

Please sign in to comment.