Commit c41fb39a authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] Threads imply structured cloning

In the existing implementation, the structured cloning flag is only set
at the startup of the renderer process. In other words, if structured
cloning or wasm threads are turned on when the renderer process starts
up, then structured cloning is enabled. However, with the origin trial
for wasm threads it's possible that wasm threads get turned on only
later when the webpages loads. With this CL we now always also check
the wasm threads flag in addition to checking the structured cloning
flag.

R=mstarzinger@chromium.org

Bug: v8:8304
Change-Id: I49da6bd76a4cc38abc01fbe0c9707c6b17a8de3f
Reviewed-on: https://chromium-review.googlesource.com/c/1280444Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56629}
parent 26b47aaf
......@@ -517,12 +517,14 @@ Maybe<bool> ValueSerializer::WriteJSReceiver(Handle<JSReceiver> receiver) {
case JS_TYPED_ARRAY_TYPE:
case JS_DATA_VIEW_TYPE:
return WriteJSArrayBufferView(JSArrayBufferView::cast(*receiver));
case WASM_MODULE_TYPE:
if (!FLAG_wasm_disable_structured_cloning) {
case WASM_MODULE_TYPE: {
auto enabled_features = wasm::WasmFeaturesFromIsolate(isolate_);
if (!FLAG_wasm_disable_structured_cloning || enabled_features.threads) {
// Only write WebAssembly modules if not disabled by a flag.
return WriteWasmModule(Handle<WasmModuleObject>::cast(receiver));
}
break;
}
case WASM_MEMORY_TYPE: {
auto enabled_features = wasm::WasmFeaturesFromIsolate(isolate_);
if (enabled_features.threads) {
......@@ -1742,7 +1744,9 @@ MaybeHandle<JSArrayBufferView> ValueDeserializer::ReadJSArrayBufferView(
}
MaybeHandle<JSObject> ValueDeserializer::ReadWasmModuleTransfer() {
if (FLAG_wasm_disable_structured_cloning || expect_inline_wasm()) {
auto enabled_features = wasm::WasmFeaturesFromIsolate(isolate_);
if ((FLAG_wasm_disable_structured_cloning && !enabled_features.threads) ||
expect_inline_wasm()) {
return MaybeHandle<JSObject>();
}
......@@ -1764,7 +1768,9 @@ MaybeHandle<JSObject> ValueDeserializer::ReadWasmModuleTransfer() {
}
MaybeHandle<JSObject> ValueDeserializer::ReadWasmModule() {
if (FLAG_wasm_disable_structured_cloning || !expect_inline_wasm()) {
auto enabled_features = wasm::WasmFeaturesFromIsolate(isolate_);
if ((FLAG_wasm_disable_structured_cloning && !enabled_features.threads) ||
!expect_inline_wasm()) {
return MaybeHandle<JSObject>();
}
......
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