[cleanup] Remove Wasm exception-handling runtime flag

It's been enabled by default since Chromium M95.

Also removes duplicate setup code for WebAssembly.Tag JS API
from WasmJs::InstallConditionalFeatures, since we're guaranteed
to set it up via the non-conditional WasmJs::Install.

Bug: v8:8091
Change-Id: Ic500feb655ad4fc0703ed226504847ca6d940537
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3996810
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84074}
This commit is contained in:
Adam Klein 2022-11-01 11:35:28 -07:00 committed by V8 LUCI CQ
parent 8e3b455f53
commit 76ae4f56df
39 changed files with 46 additions and 276 deletions

View File

@ -1529,6 +1529,7 @@ class V8_EXPORT Isolate {
V8_DEPRECATED("Wasm SIMD is always enabled")
void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback);
V8_DEPRECATED("Wasm exceptions are always enabled")
void SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback callback);
void SetSharedArrayBufferConstructorEnabledCallback(

View File

@ -9600,13 +9600,15 @@ CALLBACK_SETTER(WasmAsyncResolvePromiseCallback,
CALLBACK_SETTER(WasmLoadSourceMapCallback, WasmLoadSourceMapCallback,
wasm_load_source_map_callback)
CALLBACK_SETTER(WasmExceptionsEnabledCallback, WasmExceptionsEnabledCallback,
wasm_exceptions_enabled_callback)
CALLBACK_SETTER(SharedArrayBufferConstructorEnabledCallback,
SharedArrayBufferConstructorEnabledCallback,
sharedarraybuffer_constructor_enabled_callback)
void Isolate::SetWasmExceptionsEnabledCallback(
WasmExceptionsEnabledCallback callback) {
// Exceptions are always enabled
}
void Isolate::SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback) {
// SIMD is always enabled
}

View File

@ -2955,18 +2955,6 @@ bool Isolate::IsSharedArrayBufferConstructorEnabled(Handle<Context> context) {
return false;
}
bool Isolate::AreWasmExceptionsEnabled(Handle<Context> context) {
#if V8_ENABLE_WEBASSEMBLY
if (wasm_exceptions_enabled_callback()) {
v8::Local<v8::Context> api_context = v8::Utils::ToLocal(context);
return wasm_exceptions_enabled_callback()(api_context);
}
return v8_flags.experimental_wasm_eh;
#else
return false;
#endif // V8_ENABLE_WEBASSEMBLY
}
Handle<Context> Isolate::GetIncumbentContext() {
JavaScriptFrameIterator it(this);

View File

@ -768,8 +768,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
bool IsSharedArrayBufferConstructorEnabled(Handle<Context> context);
bool AreWasmExceptionsEnabled(Handle<Context> context);
THREAD_LOCAL_TOP_ADDRESS(Context, pending_handler_context)
THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_entrypoint)
THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_constant_pool)

View File

@ -2978,7 +2978,7 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
}
DECODE(Rethrow) {
CHECK_PROTOTYPE_OPCODE(eh);
this->detected_->Add(kFeature_eh);
BranchDepthImmediate imm(this, this->pc_ + 1, validate);
if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
Control* c = control_at(imm.depth);
@ -2992,7 +2992,7 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
}
DECODE(Throw) {
CHECK_PROTOTYPE_OPCODE(eh);
this->detected_->Add(kFeature_eh);
TagIndexImmediate imm(this, this->pc_ + 1, validate);
if (!this->Validate(this->pc_ + 1, imm)) return 0;
ArgVector args = PeekArgs(imm.tag->ToFunctionSig());
@ -3003,7 +3003,7 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
}
DECODE(Try) {
CHECK_PROTOTYPE_OPCODE(eh);
this->detected_->Add(kFeature_eh);
BlockTypeImmediate imm(this->enabled_, this, this->pc_ + 1, this->module_,
validate);
if (!this->Validate(this->pc_ + 1, imm)) return 0;
@ -3019,7 +3019,7 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
}
DECODE(Catch) {
CHECK_PROTOTYPE_OPCODE(eh);
this->detected_->Add(kFeature_eh);
TagIndexImmediate imm(this, this->pc_ + 1, validate);
if (!this->Validate(this->pc_ + 1, imm)) return 0;
DCHECK(!control_.empty());
@ -3052,7 +3052,7 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
}
DECODE(Delegate) {
CHECK_PROTOTYPE_OPCODE(eh);
this->detected_->Add(kFeature_eh);
BranchDepthImmediate imm(this, this->pc_ + 1, validate);
// -1 because the current try block is not included in the count.
if (!this->Validate(this->pc_ + 1, imm, control_depth() - 1)) return 0;
@ -3078,7 +3078,7 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
}
DECODE(CatchAll) {
CHECK_PROTOTYPE_OPCODE(eh);
this->detected_->Add(kFeature_eh);
DCHECK(!control_.empty());
Control* c = &control_.back();
if (!VALIDATE(c->is_try())) {

View File

@ -561,13 +561,7 @@ class ModuleDecoderTemplate : public Decoder {
DecodeDataCountSection();
break;
case kTagSectionCode:
if (enabled_features_.has_eh()) {
DecodeTagSection();
} else {
errorf(pc(),
"unexpected section <%s> (enable with --experimental-wasm-eh)",
SectionName(section_code));
}
DecodeTagSection();
break;
case kStringRefSectionCode:
if (enabled_features_.has_stringref()) {
@ -847,10 +841,6 @@ class ModuleDecoderTemplate : public Decoder {
}
case kExternalTag: {
// ===== Imported tag ================================================
if (!enabled_features_.has_eh()) {
errorf(pos, "unknown import kind 0x%02x", import->kind);
break;
}
import->index = static_cast<uint32_t>(module_->tags.size());
module_->num_imported_tags++;
const WasmTagSig* tag_sig = nullptr;
@ -1034,10 +1024,6 @@ class ModuleDecoderTemplate : public Decoder {
break;
}
case kExternalTag: {
if (!enabled_features_.has_eh()) {
errorf(pos, "invalid export kind 0x%02x", exp->kind);
break;
}
WasmTag* tag = nullptr;
exp->index = consume_tag_index(module_.get(), &tag);
break;

View File

@ -100,14 +100,8 @@
// #############################################################################
// Shipped features (enabled by default). Remove the feature flag once they hit
// stable and are expected to stay enabled.
#define FOREACH_WASM_SHIPPED_FEATURE_FLAG(V) /* (force 80 columns) */ \
/* Exception handling proposal. */ \
/* https://github.com/WebAssembly/exception-handling */ \
/* V8 side owner: thibaudm */ \
/* Staged in v8.9 */ \
/* Shipped in v9.5 */ \
V(eh, "exception handling opcodes", true) \
\
#define FOREACH_WASM_SHIPPED_FEATURE_FLAG(V) /* (force 80 columns) */
// Combination of all available wasm feature flags.
#define FOREACH_WASM_FEATURE_FLAG(V) \
FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(V) \

View File

@ -33,9 +33,7 @@ WasmFeatures WasmFeatures::FromIsolate(Isolate* isolate) {
WasmFeatures WasmFeatures::FromContext(Isolate* isolate,
Handle<Context> context) {
WasmFeatures features = WasmFeatures::FromFlags();
if (isolate->AreWasmExceptionsEnabled(context)) {
features.Add(kFeature_eh);
}
// This space intentionally left blank for future Wasm origin trials.
return features;
}

View File

@ -16,6 +16,7 @@
// Features that are always enabled and do not have a flag.
#define FOREACH_WASM_NON_FLAG_FEATURE(V) \
V(eh, "exception handling opcodes", true) \
V(reftypes, "reference type opcodes", true) \
V(simd, "SIMD opcodes", true) \
V(threads, "thread opcodes", true)

View File

@ -3069,29 +3069,27 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
}
// Setup Exception
if (enabled_features.has_eh()) {
Handle<JSFunction> tag_constructor =
InstallConstructorFunc(isolate, webassembly, "Tag", WebAssemblyTag);
Handle<JSObject> tag_proto =
SetupConstructor(isolate, tag_constructor, i::WASM_TAG_OBJECT_TYPE,
WasmTagObject::kHeaderSize, "WebAssembly.Tag");
context->set_wasm_tag_constructor(*tag_constructor);
Handle<JSFunction> tag_constructor =
InstallConstructorFunc(isolate, webassembly, "Tag", WebAssemblyTag);
Handle<JSObject> tag_proto =
SetupConstructor(isolate, tag_constructor, i::WASM_TAG_OBJECT_TYPE,
WasmTagObject::kHeaderSize, "WebAssembly.Tag");
context->set_wasm_tag_constructor(*tag_constructor);
if (enabled_features.has_type_reflection()) {
InstallFunc(isolate, tag_proto, "type", WebAssemblyTagType, 0);
}
// Set up runtime exception constructor.
Handle<JSFunction> exception_constructor = InstallConstructorFunc(
isolate, webassembly, "Exception", WebAssemblyException);
SetDummyInstanceTemplate(isolate, exception_constructor);
Handle<JSObject> exception_proto = SetupConstructor(
isolate, exception_constructor, i::WASM_EXCEPTION_PACKAGE_TYPE,
WasmExceptionPackage::kHeaderSize, "WebAssembly.Exception");
InstallFunc(isolate, exception_proto, "getArg", WebAssemblyExceptionGetArg,
2);
InstallFunc(isolate, exception_proto, "is", WebAssemblyExceptionIs, 1);
context->set_wasm_exception_constructor(*exception_constructor);
if (enabled_features.has_type_reflection()) {
InstallFunc(isolate, tag_proto, "type", WebAssemblyTagType, 0);
}
// Set up runtime exception constructor.
Handle<JSFunction> exception_constructor = InstallConstructorFunc(
isolate, webassembly, "Exception", WebAssemblyException);
SetDummyInstanceTemplate(isolate, exception_constructor);
Handle<JSObject> exception_proto = SetupConstructor(
isolate, exception_constructor, i::WASM_EXCEPTION_PACKAGE_TYPE,
WasmExceptionPackage::kHeaderSize, "WebAssembly.Exception");
InstallFunc(isolate, exception_proto, "getArg", WebAssemblyExceptionGetArg,
2);
InstallFunc(isolate, exception_proto, "is", WebAssemblyExceptionIs, 1);
context->set_wasm_exception_constructor(*exception_constructor);
// Setup Suspender.
if (enabled_features.has_stack_switching()) {
@ -3151,55 +3149,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
// static
void WasmJs::InstallConditionalFeatures(Isolate* isolate,
Handle<Context> context) {
// Exception handling may have been enabled by an origin trial. If so, make
// sure that the {WebAssembly.Tag} constructor is set up.
auto enabled_features = i::wasm::WasmFeatures::FromContext(isolate, context);
if (enabled_features.has_eh()) {
Handle<JSGlobalObject> global = handle(context->global_object(), isolate);
MaybeHandle<Object> maybe_webassembly =
JSObject::GetProperty(isolate, global, "WebAssembly");
Handle<Object> webassembly_obj;
if (!maybe_webassembly.ToHandle(&webassembly_obj) ||
!webassembly_obj->IsJSObject()) {
// There is no {WebAssembly} object, or it's not what we expect.
// Just return without adding the {Tag} constructor.
return;
}
Handle<JSObject> webassembly = Handle<JSObject>::cast(webassembly_obj);
// Setup Tag.
Handle<String> tag_name = v8_str(isolate, "Tag");
// The {WebAssembly} object may already have been modified. The following
// code is designed to:
// - check for existing {Tag} properties on the object itself, and avoid
// overwriting them or adding duplicate properties
// - disregard any setters or read-only properties on the prototype chain
// - only make objects accessible to user code after all internal setup
// has been completed.
if (JSObject::HasOwnProperty(isolate, webassembly, tag_name)
.FromMaybe(true)) {
// Existing property, or exception.
return;
}
bool has_prototype = true;
Handle<JSFunction> tag_constructor =
CreateFunc(isolate, tag_name, WebAssemblyTag, has_prototype,
SideEffectType::kHasNoSideEffect);
tag_constructor->shared().set_length(1);
context->set_wasm_tag_constructor(*tag_constructor);
Handle<JSObject> tag_proto =
SetupConstructor(isolate, tag_constructor, i::WASM_TAG_OBJECT_TYPE,
WasmTagObject::kHeaderSize, "WebAssembly.Tag");
if (enabled_features.has_type_reflection()) {
InstallFunc(isolate, tag_proto, "type", WebAssemblyTagType, 0);
}
LookupIterator it(isolate, webassembly, tag_name, LookupIterator::OWN);
Maybe<bool> result = JSObject::DefineOwnPropertyIgnoreAttributes(
&it, tag_constructor, DONT_ENUM, Just(kDontThrow));
// This could still fail if the object was non-extensible, but now we
// return anyway so there's no need to even check.
USE(result);
}
// This space left blank for future origin trials.
}
#undef ASSIGN
#undef EXTRACT_THIS

View File

@ -435,7 +435,6 @@ TEST(Liftoff_breakpoint_simple) {
}
TEST(Liftoff_debug_side_table_catch_all) {
EXPERIMENTAL_FLAG_SCOPE(eh);
LiftoffCompileEnvironment env;
TestSignatures sigs;
int ex = env.builder()->AddException(sigs.v_v());
@ -462,7 +461,6 @@ TEST(Liftoff_debug_side_table_catch_all) {
}
TEST(Regress1199526) {
EXPERIMENTAL_FLAG_SCOPE(eh);
LiftoffCompileEnvironment env;
ValueType exception_type = ValueType::Ref(HeapType::kAny);
auto debug_side_table = env.GenerateDebugSideTable(

View File

@ -15,7 +15,6 @@ namespace test_run_wasm_exceptions {
WASM_EXEC_TEST(TryCatchThrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -40,7 +39,6 @@ WASM_EXEC_TEST(TryCatchThrow) {
WASM_EXEC_TEST(TryCatchThrowWithValue) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_i());
constexpr uint32_t kResult0 = 23;
@ -66,7 +64,6 @@ WASM_EXEC_TEST(TryCatchThrowWithValue) {
WASM_EXEC_TEST(TryMultiCatchThrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except1 = r.builder().AddException(sigs.v_v());
byte except2 = r.builder().AddException(sigs.v_v());
@ -98,7 +95,6 @@ WASM_EXEC_TEST(TryMultiCatchThrow) {
WASM_EXEC_TEST(TryCatchAllThrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -122,7 +118,6 @@ WASM_EXEC_TEST(TryCatchAllThrow) {
WASM_EXEC_TEST(TryCatchCatchAllThrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except1 = r.builder().AddException(sigs.v_v());
byte except2 = r.builder().AddException(sigs.v_v());
@ -154,7 +149,6 @@ WASM_EXEC_TEST(TryCatchCatchAllThrow) {
WASM_EXEC_TEST(TryImplicitRethrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except1 = r.builder().AddException(sigs.v_v());
byte except2 = r.builder().AddException(sigs.v_v());
@ -185,7 +179,6 @@ WASM_EXEC_TEST(TryImplicitRethrow) {
WASM_EXEC_TEST(TryDelegate) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -214,7 +207,6 @@ WASM_EXEC_TEST(TryDelegate) {
WASM_EXEC_TEST(TestCatchlessTry) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_i());
BUILD(r,
@ -231,7 +223,6 @@ WASM_EXEC_TEST(TestCatchlessTry) {
WASM_EXEC_TEST(TryCatchRethrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except1 = r.builder().AddException(sigs.v_v());
byte except2 = r.builder().AddException(sigs.v_v());
@ -266,7 +257,6 @@ WASM_EXEC_TEST(TryCatchRethrow) {
WASM_EXEC_TEST(TryDelegateToCaller) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -297,7 +287,6 @@ WASM_EXEC_TEST(TryDelegateToCaller) {
WASM_EXEC_TEST(TryCatchCallDirect) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -330,7 +319,6 @@ WASM_EXEC_TEST(TryCatchCallDirect) {
WASM_EXEC_TEST(TryCatchAllCallDirect) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -363,7 +351,6 @@ WASM_EXEC_TEST(TryCatchAllCallDirect) {
WASM_EXEC_TEST(TryCatchCallIndirect) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -403,7 +390,6 @@ WASM_EXEC_TEST(TryCatchCallIndirect) {
WASM_EXEC_TEST(TryCatchAllCallIndirect) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23;
@ -443,7 +429,6 @@ WASM_EXEC_TEST(TryCatchAllCallIndirect) {
WASM_COMPILED_EXEC_TEST(TryCatchCallExternal) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
HandleScope scope(CcTest::InitIsolateOnce());
const char* source = "(function() { throw 'ball'; })";
Handle<JSFunction> js_function =
@ -473,7 +458,6 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallExternal) {
WASM_COMPILED_EXEC_TEST(TryCatchAllCallExternal) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
HandleScope scope(CcTest::InitIsolateOnce());
const char* source = "(function() { throw 'ball'; })";
Handle<JSFunction> js_function =
@ -506,7 +490,6 @@ namespace {
void TestTrapNotCaught(byte* code, size_t code_size,
TestExecutionTier execution_tier) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(execution_tier, nullptr, "main",
kRuntimeExceptionSupport);
r.builder().AddMemory(kWasmPageSize);
@ -596,7 +579,6 @@ class IsolateScope {
UNINITIALIZED_WASM_EXEC_TEST(TestStackOverflowNotCaught) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
// v8_flags.stack_size must be set before isolate initialization.
FlagScope<int32_t> stack_size(&v8_flags.stack_size, 8);
@ -632,7 +614,6 @@ UNINITIALIZED_WASM_EXEC_TEST(TestStackOverflowNotCaught) {
TEST(Regress1180457) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
constexpr uint32_t kResult0 = 23;
constexpr uint32_t kUnreachable = 42;
@ -647,7 +628,6 @@ TEST(Regress1180457) {
TEST(Regress1187896) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
byte try_sig = r.builder().AddSignature(sigs.v_i());
constexpr uint32_t kResult = 23;
@ -658,7 +638,6 @@ TEST(Regress1187896) {
TEST(Regress1190291) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
byte try_sig = r.builder().AddSignature(sigs.v_i());
BUILD(r, kExprUnreachable, kExprTry, try_sig, kExprCatchAll, kExprEnd,
@ -668,7 +647,6 @@ TEST(Regress1190291) {
TEST(Regress1186795) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
byte except = r.builder().AddException(sigs.v_i());
BUILD(r,
@ -686,7 +664,6 @@ TEST(Regress1186795) {
TEST(Regress1197408) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(
TestExecutionTier::kInterpreter);
byte sig_id = r.builder().AddSignature(sigs.i_iii());
@ -698,7 +675,6 @@ TEST(Regress1197408) {
TEST(Regress1212396) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<int32_t> r(TestExecutionTier::kInterpreter);
byte except = r.builder().AddException(sigs.v_v());
BUILD(r, kExprTry, kVoidCode, kExprTry, kVoidCode, kExprI32Const, 0,
@ -709,7 +685,6 @@ TEST(Regress1212396) {
TEST(Regress1219746) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<int32_t> r(TestExecutionTier::kInterpreter);
BUILD(r, kExprTry, kVoidCode, kExprI32Const, 0, kExprEnd);
CHECK_EQ(0, r.CallInterpreter());

View File

@ -2612,7 +2612,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
constexpr bool require_valid = true;
EXPERIMENTAL_FLAG_SCOPE(typed_funcref);
EXPERIMENTAL_FLAG_SCOPE(gc);
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmCompileFuzzer().FuzzWasmModule({data, size}, require_valid);
return 0;
}

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();

View File

@ -1,8 +1,6 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js')
let obj = {};
let proxy = new Proxy(obj, {});

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
(function Regress1188975() {

View File

@ -1,6 +0,0 @@
// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(this, "WebAssembly", { get: () => { throw "nope" } });
assertThrowsEquals(() => d8.test.installConditionalFeatures(), 'nope');

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
// Instantiate a throwing module.

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
// Prepare a special error object to throw.

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh --wasm-test-streaming
// Flags: --wasm-test-streaming
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh --allow-natives-syntax
// Flags: --allow-natives-syntax
// Force TurboFan code for serialization.
// Flags: --no-liftoff --no-wasm-lazy-compilation

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
(function TestRegress9832() {

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
(function Regress1192313() {

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestImport() {

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
(function TestExportMultiple() {

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh --allow-natives-syntax
// Flags: --allow-natives-syntax
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
// Helper function to return a new exported exception with the {kSig_v_v} type

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh --allow-natives-syntax
// Flags: --allow-natives-syntax
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
// Helper function to return a new exported exception with the {kSig_v_v} type

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh --allow-natives-syntax
// Flags: --allow-natives-syntax
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh --experimental-wasm-type-reflection
// Flags: --experimental-wasm-type-reflection
load("test/mjsunit/wasm/wasm-module-builder.js");

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh --allow-natives-syntax
// Flags: --allow-natives-syntax
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-typed-funcref --experimental-wasm-eh
// Flags: --experimental-wasm-typed-funcref
// Flags: --experimental-wasm-return-call --no-liftoff
// Needed for exceptions-utils.js.
// Flags: --allow-natives-syntax

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh --experimental-wasm-gc
// Flags: --experimental-wasm-gc
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");

View File

@ -156,40 +156,4 @@ TEST_F(ApiWasmTest, WasmStreamingSetCallback) {
Promise::kPending);
}
namespace {
bool wasm_exceptions_enabled_value = false;
bool MockWasmExceptionsEnabledCallback(Local<Context>) {
return wasm_exceptions_enabled_value;
}
} // namespace
TEST_F(ApiWasmTest, TestSetWasmExceptionsEnabledCallback) {
Local<Context> context = Context::New(isolate());
i::Handle<i::Context> i_context = Utils::OpenHandle(*context);
// {Isolate::AreWasmExceptionsEnabled} calls the callback set by the embedder
// if such a callback exists. Otherwise it returns
// {v8_flags.experimental_wasm_eh}. First we test that the flag is returned
// correctly if no callback is set. Then we test that the flag is ignored if
// the callback is set.
i::v8_flags.experimental_wasm_eh = false;
CHECK(!i_isolate()->AreWasmExceptionsEnabled(i_context));
i::v8_flags.experimental_wasm_eh = true;
CHECK(i_isolate()->AreWasmExceptionsEnabled(i_context));
isolate()->SetWasmExceptionsEnabledCallback(
MockWasmExceptionsEnabledCallback);
wasm_exceptions_enabled_value = false;
CHECK(!i_isolate()->AreWasmExceptionsEnabled(i_context));
wasm_exceptions_enabled_value = true;
i::v8_flags.experimental_wasm_eh = false;
CHECK(i_isolate()->AreWasmExceptionsEnabled(i_context));
}
} // namespace v8

View File

@ -2959,7 +2959,6 @@ TEST_F(FunctionBodyDecoderTest, SelectWithType_fail) {
}
TEST_F(FunctionBodyDecoderTest, Throw) {
WASM_FEATURE_SCOPE(eh);
byte ex1 = builder.AddException(sigs.v_v());
byte ex2 = builder.AddException(sigs.v_i());
byte ex3 = builder.AddException(sigs.v_ii());
@ -2972,7 +2971,6 @@ TEST_F(FunctionBodyDecoderTest, Throw) {
}
TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
WASM_FEATURE_SCOPE(eh);
byte ex1 = builder.AddException(sigs.v_v());
byte ex2 = builder.AddException(sigs.v_i());
ExpectValidates(sigs.i_i(), {WASM_LOCAL_GET(0), kExprThrow, ex1, WASM_NOP});
@ -2988,7 +2986,6 @@ TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
#define WASM_TRY_OP kExprTry, kVoidCode
TEST_F(FunctionBodyDecoderTest, TryCatch) {
WASM_FEATURE_SCOPE(eh);
byte ex = builder.AddException(sigs.v_v());
ExpectValidates(sigs.v_v(), {WASM_TRY_OP, kExprCatch, ex, kExprEnd});
ExpectValidates(sigs.v_v(),
@ -3005,7 +3002,6 @@ TEST_F(FunctionBodyDecoderTest, TryCatch) {
}
TEST_F(FunctionBodyDecoderTest, Rethrow) {
WASM_FEATURE_SCOPE(eh);
ExpectValidates(sigs.v_v(),
{WASM_TRY_OP, kExprCatchAll, kExprRethrow, 0, kExprEnd});
ExpectFailure(sigs.v_v(),
@ -3018,7 +3014,6 @@ TEST_F(FunctionBodyDecoderTest, Rethrow) {
}
TEST_F(FunctionBodyDecoderTest, TryDelegate) {
WASM_FEATURE_SCOPE(eh);
byte ex = builder.AddException(sigs.v_v());
ExpectValidates(sigs.v_v(), {WASM_TRY_OP,
@ -3677,7 +3672,6 @@ TEST_F(FunctionBodyDecoderTest, DefaultableLocal) {
TEST_F(FunctionBodyDecoderTest, NonDefaultableLocals) {
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(eh);
WASM_FEATURE_SCOPE(gc);
byte struct_type_index = builder.AddStruct({F(kWasmI32, true)});
ValueType rep = ref(struct_type_index);
@ -3755,7 +3749,6 @@ TEST_F(FunctionBodyDecoderTest, NonDefaultableLocals) {
}
TEST_F(FunctionBodyDecoderTest, RefEq) {
WASM_FEATURE_SCOPE(eh);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(gc);
@ -3798,7 +3791,6 @@ TEST_F(FunctionBodyDecoderTest, RefEq) {
}
TEST_F(FunctionBodyDecoderTest, RefAsNonNull) {
WASM_FEATURE_SCOPE(eh);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(gc);
@ -3837,7 +3829,6 @@ TEST_F(FunctionBodyDecoderTest, RefAsNonNull) {
}
TEST_F(FunctionBodyDecoderTest, RefNull) {
WASM_FEATURE_SCOPE(eh);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(gc);
@ -3858,7 +3849,6 @@ TEST_F(FunctionBodyDecoderTest, RefNull) {
}
TEST_F(FunctionBodyDecoderTest, RefIsNull) {
WASM_FEATURE_SCOPE(eh);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(gc);

View File

@ -78,12 +78,6 @@ namespace module_decoder_unittest {
'i', 'n', 't'), \
__VA_ARGS__)
#define FAIL_IF_NO_EXPERIMENTAL_EH(data) \
do { \
ModuleResult result = DecodeModule((data), (data) + sizeof((data))); \
EXPECT_FALSE(result.ok()); \
} while (false)
#define X1(...) __VA_ARGS__
#define X2(...) __VA_ARGS__, __VA_ARGS__
#define X3(...) __VA_ARGS__, __VA_ARGS__, __VA_ARGS__
@ -1082,9 +1076,6 @@ TEST_F(WasmModuleVerifyTest, InvalidSupertypeInRecGroup) {
TEST_F(WasmModuleVerifyTest, ZeroExceptions) {
static const byte data[] = {SECTION(Tag, ENTRY_COUNT(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(0u, result.value()->tags.size());
@ -1095,9 +1086,6 @@ TEST_F(WasmModuleVerifyTest, OneI32Exception) {
SECTION(Type, ENTRY_COUNT(1), SIG_ENTRY_v_x(kI32Code)), // sig#0 (i32)
SECTION(Tag, ENTRY_COUNT(1),
EXCEPTION_ENTRY(SIG_INDEX(0)))}; // except[0] (sig#0)
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(1u, result.value()->tags.size());
@ -1115,9 +1103,6 @@ TEST_F(WasmModuleVerifyTest, TwoExceptions) {
SECTION(Tag, ENTRY_COUNT(2),
EXCEPTION_ENTRY(SIG_INDEX(1)), // except[0] (sig#1)
EXCEPTION_ENTRY(SIG_INDEX(0)))}; // except[1] (sig#0)
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(2u, result.value()->tags.size());
@ -1135,10 +1120,7 @@ TEST_F(WasmModuleVerifyTest, Exception_invalid_sig_index) {
SECTION(Tag, ENTRY_COUNT(1),
EXCEPTION_ENTRY(
SIG_INDEX(23)))}; // except[0] (sig#23 [out-of-bounds])
FAIL_IF_NO_EXPERIMENTAL_EH(data);
// Should fail decoding exception section.
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "signature index 23 out of bounds");
}
@ -1149,10 +1131,7 @@ TEST_F(WasmModuleVerifyTest, Exception_invalid_sig_return) {
SECTION(Tag, ENTRY_COUNT(1),
EXCEPTION_ENTRY(
SIG_INDEX(0)))}; // except[0] (sig#0 [invalid-return-type])
FAIL_IF_NO_EXPERIMENTAL_EH(data);
// Should fail decoding exception section.
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "tag signature 0 has non-void return");
}
@ -1162,10 +1141,7 @@ TEST_F(WasmModuleVerifyTest, Exception_invalid_attribute) {
SECTION(Type, ENTRY_COUNT(1), SIG_ENTRY_i_i),
SECTION(Tag, ENTRY_COUNT(1), 23,
SIG_INDEX(0))}; // except[0] (sig#0) [invalid-attribute]
FAIL_IF_NO_EXPERIMENTAL_EH(data);
// Should fail decoding exception section.
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "exception attribute 23 not supported");
}
@ -1174,9 +1150,6 @@ TEST_F(WasmModuleVerifyTest, TagSectionCorrectPlacement) {
static const byte data[] = {SECTION(Memory, ENTRY_COUNT(0)),
SECTION(Tag, ENTRY_COUNT(0)),
SECTION(Global, ENTRY_COUNT(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
}
@ -1184,9 +1157,6 @@ TEST_F(WasmModuleVerifyTest, TagSectionCorrectPlacement) {
TEST_F(WasmModuleVerifyTest, TagSectionAfterGlobal) {
static const byte data[] = {SECTION(Global, ENTRY_COUNT(0)),
SECTION(Tag, ENTRY_COUNT(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result,
"The Tag section must appear before the Global section");
@ -1195,9 +1165,6 @@ TEST_F(WasmModuleVerifyTest, TagSectionAfterGlobal) {
TEST_F(WasmModuleVerifyTest, TagSectionBeforeMemory) {
static const byte data[] = {SECTION(Tag, ENTRY_COUNT(0)),
SECTION(Memory, ENTRY_COUNT(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "unexpected section <Memory>");
}
@ -1207,9 +1174,6 @@ TEST_F(WasmModuleVerifyTest, TagSectionAfterTableBeforeMemory) {
static const byte data[] = {SECTION(Table, ENTRY_COUNT(0)),
SECTION(Tag, ENTRY_COUNT(0)),
SECTION(Memory, ENTRY_COUNT(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "unexpected section <Memory>");
}
@ -1223,9 +1187,6 @@ TEST_F(WasmModuleVerifyTest, TagImport) {
ADD_COUNT('e', 'x'), // tag name
kExternalTag, // import kind
EXCEPTION_ENTRY(SIG_INDEX(0)))}; // except[0] (sig#0)
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(1u, result.value()->tags.size());
@ -1241,9 +1202,6 @@ TEST_F(WasmModuleVerifyTest, ExceptionExport) {
NO_NAME, // --
kExternalTag, // --
EXCEPTION_INDEX(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(1u, result.value()->tags.size());
@ -3459,7 +3417,6 @@ TEST_F(WasmModuleVerifyTest, Memory64DataSegment) {
#undef EMPTY_NAMES_SECTION
#undef SECTION_SRC_MAP
#undef SECTION_COMPILATION_HINTS
#undef FAIL_IF_NO_EXPERIMENTAL_EH
#undef X1
#undef X2
#undef X3