Revert "[api] Add a SharedArrayBuffersEnabled callback."

This reverts commit 76b53b66b0.

Reason for revert: Can't be used easily in embedder (Chromium).

Original change's description:
> [api] Add a SharedArrayBuffersEnabled callback.
> 
> - Adds a SharedArrayBuffersEnabled callback and uses it to
>   enable/disable SABs per context. The feature flag is used
>   if no callback is registered.
> 
> Bug: chromium:923807
> Change-Id: I4d3472fcd79b158cb50dc98793aece6dbbb81d93
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2316901
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69057}

TBR=bbudge@chromium.org,adamk@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:923807
Change-Id: I6e3ddfa9cd64ba3106b4a75ea7a5185f873facc9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2326952
Reviewed-by: Bill Budge <bbudge@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69134}
This commit is contained in:
Bill Budge 2020-07-29 17:34:21 +00:00 committed by Commit Bot
parent b09b838bbb
commit 80396fd3e5
5 changed files with 1 additions and 22 deletions

View File

@ -7510,9 +7510,6 @@ typedef Local<String> (*WasmLoadSourceMapCallback)(Isolate* isolate,
// --- Callback for checking if WebAssembly Simd is enabled ---
typedef bool (*WasmSimdEnabledCallback)(Local<Context> context);
// --- Callback for checking if SharedArrayBuffers are enabled ---
typedef bool (*SharedArrayBuffersEnabledCallback)(Local<Context> context);
// --- Garbage Collection Callbacks ---
/**
@ -9392,9 +9389,6 @@ class V8_EXPORT Isolate {
void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback);
void SetSharedArrayBuffersEnabledCallback(
SharedArrayBuffersEnabledCallback callback);
/**
* Check if V8 is dead and therefore unusable. This is the case after
* fatal errors such as out-of-memory situations.

View File

@ -9009,10 +9009,6 @@ CALLBACK_SETTER(WasmLoadSourceMapCallback, WasmLoadSourceMapCallback,
CALLBACK_SETTER(WasmSimdEnabledCallback, WasmSimdEnabledCallback,
wasm_simd_enabled_callback)
CALLBACK_SETTER(SharedArrayBuffersEnabledCallback,
SharedArrayBuffersEnabledCallback,
shared_array_buffers_enabled_callback)
void Isolate::AddNearHeapLimitCallback(v8::NearHeapLimitCallback callback,
void* data) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);

View File

@ -2620,14 +2620,6 @@ bool Isolate::IsWasmSimdEnabled(Handle<Context> context) {
return FLAG_experimental_wasm_simd;
}
bool Isolate::AreSharedArrayBuffersEnabled(Handle<Context> context) {
if (shared_array_buffers_enabled_callback()) {
v8::Local<v8::Context> api_context = v8::Utils::ToLocal(context);
return shared_array_buffers_enabled_callback()(api_context);
}
return FLAG_harmony_sharedarraybuffer;
}
Handle<Context> Isolate::GetIncumbentContext() {
JavaScriptFrameIterator it(this);

View File

@ -414,8 +414,6 @@ using DebugObjectCache = std::vector<Handle<HeapObject>>;
V(WasmThreadsEnabledCallback, wasm_threads_enabled_callback, nullptr) \
V(WasmLoadSourceMapCallback, wasm_load_source_map_callback, nullptr) \
V(WasmSimdEnabledCallback, wasm_simd_enabled_callback, nullptr) \
V(SharedArrayBuffersEnabledCallback, shared_array_buffers_enabled_callback, \
nullptr) \
/* State for Relocatable. */ \
V(Relocatable*, relocatable_top, nullptr) \
V(DebugObjectCache*, string_stream_debug_object_cache, nullptr) \
@ -640,7 +638,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
bool AreWasmThreadsEnabled(Handle<Context> context);
bool IsWasmSimdEnabled(Handle<Context> context);
bool AreSharedArrayBuffersEnabled(Handle<Context> context);
THREAD_LOCAL_TOP_ADDRESS(Object, pending_exception)

View File

@ -4137,7 +4137,7 @@ void Genesis::InitializeGlobal_harmony_atomics_waitasync() {
}
void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
if (!isolate()->AreSharedArrayBuffersEnabled(native_context())) return;
if (!FLAG_harmony_sharedarraybuffer) return;
Handle<JSGlobalObject> global(native_context()->global_object(), isolate());