[cleanup] Remove API for the WebAssembly Threads origin trial
The origin trial for WebAssembly Threads is over for quite some time, WebAssembly Threads are enabled by default. The API can therefore be removed now. Bug: v8:11384 Change-Id: I3dd65ff63c1ed31d39a76e5aea08b950ef420f54 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2690598 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#72766}
This commit is contained in:
parent
4573d12ed9
commit
f5cd26c8bf
@ -7743,9 +7743,6 @@ using ApiImplementationCallback = void (*)(const FunctionCallbackInfo<Value>&);
|
||||
// --- Callback for WebAssembly.compileStreaming ---
|
||||
using WasmStreamingCallback = void (*)(const FunctionCallbackInfo<Value>&);
|
||||
|
||||
// --- Callback for checking if WebAssembly threads are enabled ---
|
||||
using WasmThreadsEnabledCallback = bool (*)(Local<Context> context);
|
||||
|
||||
// --- Callback for loading source map file for Wasm profiling support
|
||||
using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
|
||||
const char* name);
|
||||
@ -9652,8 +9649,6 @@ class V8_EXPORT Isolate {
|
||||
|
||||
void SetWasmStreamingCallback(WasmStreamingCallback callback);
|
||||
|
||||
void SetWasmThreadsEnabledCallback(WasmThreadsEnabledCallback callback);
|
||||
|
||||
void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback);
|
||||
|
||||
void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback);
|
||||
|
@ -9026,9 +9026,6 @@ CALLBACK_SETTER(WasmInstanceCallback, ExtensionCallback, wasm_instance_callback)
|
||||
CALLBACK_SETTER(WasmStreamingCallback, WasmStreamingCallback,
|
||||
wasm_streaming_callback)
|
||||
|
||||
CALLBACK_SETTER(WasmThreadsEnabledCallback, WasmThreadsEnabledCallback,
|
||||
wasm_threads_enabled_callback)
|
||||
|
||||
CALLBACK_SETTER(WasmLoadSourceMapCallback, WasmLoadSourceMapCallback,
|
||||
wasm_load_source_map_callback)
|
||||
|
||||
|
@ -2529,14 +2529,6 @@ void Isolate::SetAbortOnUncaughtExceptionCallback(
|
||||
abort_on_uncaught_exception_callback_ = callback;
|
||||
}
|
||||
|
||||
bool Isolate::AreWasmThreadsEnabled(Handle<Context> context) {
|
||||
if (wasm_threads_enabled_callback()) {
|
||||
v8::Local<v8::Context> api_context = v8::Utils::ToLocal(context);
|
||||
return wasm_threads_enabled_callback()(api_context);
|
||||
}
|
||||
return FLAG_experimental_wasm_threads;
|
||||
}
|
||||
|
||||
bool Isolate::IsWasmSimdEnabled(Handle<Context> context) {
|
||||
if (wasm_simd_enabled_callback()) {
|
||||
v8::Local<v8::Context> api_context = v8::Utils::ToLocal(context);
|
||||
|
@ -430,7 +430,6 @@ using DebugObjectCache = std::vector<Handle<HeapObject>>;
|
||||
V(ExtensionCallback, wasm_module_callback, &NoExtension) \
|
||||
V(ExtensionCallback, wasm_instance_callback, &NoExtension) \
|
||||
V(WasmStreamingCallback, wasm_streaming_callback, nullptr) \
|
||||
V(WasmThreadsEnabledCallback, wasm_threads_enabled_callback, nullptr) \
|
||||
V(WasmLoadSourceMapCallback, wasm_load_source_map_callback, nullptr) \
|
||||
V(WasmSimdEnabledCallback, wasm_simd_enabled_callback, nullptr) \
|
||||
V(WasmExceptionsEnabledCallback, wasm_exceptions_enabled_callback, nullptr) \
|
||||
@ -671,7 +670,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
|
||||
inline void set_pending_exception(Object exception_obj);
|
||||
inline void clear_pending_exception();
|
||||
|
||||
bool AreWasmThreadsEnabled(Handle<Context> context);
|
||||
bool IsWasmSimdEnabled(Handle<Context> context);
|
||||
bool AreWasmExceptionsEnabled(Handle<Context> context);
|
||||
|
||||
|
@ -1263,22 +1263,6 @@ RUNTIME_FUNCTION(Runtime_GetWasmExceptionValues) {
|
||||
return *isolate->factory()->NewJSArrayWithElements(values);
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool EnableWasmThreads(v8::Local<v8::Context> context) { return true; }
|
||||
bool DisableWasmThreads(v8::Local<v8::Context> context) { return false; }
|
||||
} // namespace
|
||||
|
||||
// This runtime function enables WebAssembly threads through an embedder
|
||||
// callback and thereby bypasses the value in FLAG_experimental_wasm_threads.
|
||||
RUNTIME_FUNCTION(Runtime_SetWasmThreadsEnabled) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(flag, 0);
|
||||
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
||||
v8_isolate->SetWasmThreadsEnabledCallback(flag ? EnableWasmThreads
|
||||
: DisableWasmThreads);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_RegexpHasBytecode) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
|
@ -543,7 +543,6 @@ namespace internal {
|
||||
F(SetIteratorProtector, 0, 1) \
|
||||
F(SetWasmCompileControls, 2, 1) \
|
||||
F(SetWasmInstantiateControls, 0, 1) \
|
||||
F(SetWasmThreadsEnabled, 1, 1) \
|
||||
F(SimulateNewspaceFull, 0, 1) \
|
||||
F(ScheduleGCInStackCheck, 0, 1) \
|
||||
F(StringIteratorProtector, 0, 1) \
|
||||
|
@ -24,9 +24,6 @@ WasmFeatures WasmFeatures::FromFlags() {
|
||||
// static
|
||||
WasmFeatures WasmFeatures::FromIsolate(Isolate* isolate) {
|
||||
WasmFeatures features = WasmFeatures::FromFlags();
|
||||
if (isolate->AreWasmThreadsEnabled(handle(isolate->context(), isolate))) {
|
||||
features.Add(kFeature_threads);
|
||||
}
|
||||
if (isolate->IsWasmSimdEnabled(handle(isolate->context(), isolate))) {
|
||||
features.Add(kFeature_simd);
|
||||
}
|
||||
|
@ -129,14 +129,9 @@ TEST(WasmStreamingAbortWithoutReject) {
|
||||
|
||||
namespace {
|
||||
|
||||
bool wasm_threads_enabled_value = false;
|
||||
bool wasm_simd_enabled_value = false;
|
||||
bool wasm_exceptions_enabled_value = false;
|
||||
|
||||
bool MockWasmThreadsEnabledCallback(v8::Local<v8::Context>) {
|
||||
return wasm_threads_enabled_value;
|
||||
}
|
||||
|
||||
bool MockWasmSimdEnabledCallback(v8::Local<v8::Context>) {
|
||||
return wasm_simd_enabled_value;
|
||||
}
|
||||
@ -147,35 +142,6 @@ bool MockWasmExceptionsEnabledCallback(v8::Local<v8::Context>) {
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(TestSetWasmThreadsEnabledCallback) {
|
||||
LocalContext env;
|
||||
v8::Isolate* isolate = env->GetIsolate();
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
i::Handle<i::Context> i_context = v8::Utils::OpenHandle(*context);
|
||||
|
||||
// {Isolate::AreWasmThreadsEnabled} calls the callback set by the embedder if
|
||||
// such a callback exists. Otherwise it returns
|
||||
// {FLAG_experimental_wasm_threads}. 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::FLAG_experimental_wasm_threads = false;
|
||||
CHECK(!i_isolate->AreWasmThreadsEnabled(i_context));
|
||||
|
||||
i::FLAG_experimental_wasm_threads = true;
|
||||
CHECK(i_isolate->AreWasmThreadsEnabled(i_context));
|
||||
|
||||
isolate->SetWasmThreadsEnabledCallback(MockWasmThreadsEnabledCallback);
|
||||
wasm_threads_enabled_value = false;
|
||||
CHECK(!i_isolate->AreWasmThreadsEnabled(i_context));
|
||||
|
||||
wasm_threads_enabled_value = true;
|
||||
i::FLAG_experimental_wasm_threads = false;
|
||||
CHECK(i_isolate->AreWasmThreadsEnabled(i_context));
|
||||
}
|
||||
|
||||
TEST(TestSetWasmSimdEnabledCallback) {
|
||||
LocalContext env;
|
||||
v8::Isolate* isolate = env->GetIsolate();
|
||||
|
@ -850,7 +850,6 @@
|
||||
'wasm/atomics': [SKIP],
|
||||
'wasm/atomics-non-shared': [SKIP],
|
||||
'wasm/grow-shared-memory': [SKIP],
|
||||
'wasm/origin-trial-flags': [SKIP],
|
||||
'wasm/shared-memory': [SKIP],
|
||||
|
||||
# https://github.com/v8-riscv/v8/issues/418
|
||||
|
@ -1,34 +0,0 @@
|
||||
// Copyright 2017 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: --noexperimental-wasm-threads --allow-natives-syntax
|
||||
|
||||
load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
function instantiateModuleWithThreads() {
|
||||
// Build a WebAssembly module which uses threads-features.
|
||||
const builder = new WasmModuleBuilder();
|
||||
const shared = true;
|
||||
builder.addMemory(2, 10, false, shared);
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
kExprLocalGet, 0, kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd, 2,
|
||||
0
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
return builder.instantiate();
|
||||
}
|
||||
|
||||
// Disable WebAssembly threads initially.
|
||||
%SetWasmThreadsEnabled(false);
|
||||
assertThrows(instantiateModuleWithThreads, WebAssembly.CompileError);
|
||||
|
||||
// Enable WebAssembly threads.
|
||||
%SetWasmThreadsEnabled(true);
|
||||
assertInstanceof(instantiateModuleWithThreads(), WebAssembly.Instance);
|
||||
|
||||
// Disable WebAssembly threads.
|
||||
%SetWasmThreadsEnabled(false);
|
||||
assertThrows(instantiateModuleWithThreads, WebAssembly.CompileError);
|
Loading…
Reference in New Issue
Block a user