Commit c96864e0 authored by Andreas Haas's avatar Andreas Haas Committed by V8 LUCI CQ

Reland "[wasm] Ship Reference Types""

Spec tests were fixed in the meantime.

R=ecmziegler@chromium.org

Bug: v8:7581
Change-Id: If8e192ea94f9908ec469ebd5ccd876f51e4ea6f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3167492
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarEmanuel Ziegler <ecmziegler@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76960}
parent 06989e1b
...@@ -313,24 +313,11 @@ void CheckBailoutAllowed(LiftoffBailoutReason reason, const char* detail, ...@@ -313,24 +313,11 @@ void CheckBailoutAllowed(LiftoffBailoutReason reason, const char* detail,
#define LIST_FEATURE(name, ...) kFeature_##name, #define LIST_FEATURE(name, ...) kFeature_##name,
constexpr WasmFeatures kExperimentalFeatures{ constexpr WasmFeatures kExperimentalFeatures{
FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(LIST_FEATURE)}; FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(LIST_FEATURE)};
constexpr WasmFeatures kStagedFeatures{
FOREACH_WASM_STAGING_FEATURE_FLAG(LIST_FEATURE)};
#undef LIST_FEATURE #undef LIST_FEATURE
// Bailout is allowed if any experimental feature is enabled. // Bailout is allowed if any experimental feature is enabled.
if (env->enabled_features.contains_any(kExperimentalFeatures)) return; if (env->enabled_features.contains_any(kExperimentalFeatures)) return;
// Staged features should be feature complete in Liftoff according to
// https://v8.dev/docs/wasm-shipping-checklist. Some are not though. They are
// listed here explicitly, with a bug assigned to each of them.
// TODO(7581): Fully implement reftypes in Liftoff.
STATIC_ASSERT(kStagedFeatures.has_reftypes());
if (reason == kRefTypes) {
DCHECK(env->enabled_features.has_reftypes());
return;
}
// Otherwise, bailout is not allowed. // Otherwise, bailout is not allowed.
FATAL("Liftoff bailout should not happen. Cause: %s\n", detail); FATAL("Liftoff bailout should not happen. Cause: %s\n", detail);
} }
......
...@@ -67,12 +67,6 @@ ...@@ -67,12 +67,6 @@
// be shipped with enough lead time to the next branch to allow for // be shipped with enough lead time to the next branch to allow for
// stabilization. // stabilization.
#define FOREACH_WASM_STAGING_FEATURE_FLAG(V) /* (force 80 columns) */ \ #define FOREACH_WASM_STAGING_FEATURE_FLAG(V) /* (force 80 columns) */ \
/* Reference Types, a.k.a. reftypes proposal. */ \
/* https://github.com/WebAssembly/reference-types */ \
/* V8 side owner: ahaas */ \
/* Staged in v7.8. */ \
V(reftypes, "reference type opcodes", false) \
\
/* Tail call / return call proposal. */ \ /* Tail call / return call proposal. */ \
/* https://github.com/webassembly/tail-call */ \ /* https://github.com/webassembly/tail-call */ \
/* V8 side owner: thibaudm */ \ /* V8 side owner: thibaudm */ \
...@@ -96,6 +90,13 @@ ...@@ -96,6 +90,13 @@
/* Shipped in v9.1 * */ \ /* Shipped in v9.1 * */ \
V(simd, "SIMD opcodes", true) \ V(simd, "SIMD opcodes", true) \
\ \
/* Reference Types, a.k.a. reftypes proposal. */ \
/* https://github.com/WebAssembly/reference-types */ \
/* V8 side owner: ahaas */ \
/* Staged in v7.8. */ \
/* Shipped in v9.5 * */ \
V(reftypes, "reference type opcodes", true) \
\
/* Threads proposal. */ \ /* Threads proposal. */ \
/* https://github.com/webassembly/threads */ \ /* https://github.com/webassembly/threads */ \
/* NOTE: This is enabled via chromium flag on desktop systems since v7.4, */ \ /* NOTE: This is enabled via chromium flag on desktop systems since v7.4, */ \
......
...@@ -21,12 +21,8 @@ function assertGlobalIsValid(global) { ...@@ -21,12 +21,8 @@ function assertGlobalIsValid(global) {
assertThrows(() => new WebAssembly.Global({}), TypeError); assertThrows(() => new WebAssembly.Global({}), TypeError);
assertThrows(() => new WebAssembly.Global({value: 'foo'}), TypeError); assertThrows(() => new WebAssembly.Global({value: 'foo'}), TypeError);
assertThrows(() => new WebAssembly.Global({value: 'i128'}), TypeError); assertThrows(() => new WebAssembly.Global({value: 'i128'}), TypeError);
// Without --experimental-wasm-reftypes, globals of type {externref} and {anyfunc}
// are not allowed.
assertThrows(() => new WebAssembly.Global({value: 'externref'}), TypeError);
assertThrows(() => new WebAssembly.Global({value: 'anyfunc'}), TypeError);
for (let type of ['i32', 'f32', 'f64', 'i64']) { for (let type of ['i32', 'f32', 'f64', 'i64', 'externref', 'anyfunc']) {
assertGlobalIsValid(new WebAssembly.Global({value: type})); assertGlobalIsValid(new WebAssembly.Global({value: type}));
} }
})(); })();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment