Commit f4ee78f8 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

Revert "[wasm-gc] JS interop: Do not wrap structs/arrays by default"

This reverts commit 67106ff4.

Reason for revert: Test failure bisected locally to this (failure link: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux%20-%20gc%20stress/40535/overview). Not clear why but reverting to keep the tree green.

Original change's description:
> [wasm-gc] JS interop: Do not wrap structs/arrays by default
>
> Bug: v8:7748
> Change-Id: I441fd294bc0f31c0396217bc55c27159abacdbd1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905725
> Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
> Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
> Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
> Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#83338}

Bug: v8:7748
Change-Id: Ifb5e980dedf8e9824d05171c431ad383af180e50
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3904416
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83341}
parent 36d0b30a
......@@ -1095,7 +1095,7 @@ FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG)
DEFINE_IMPLICATION(experimental_wasm_gc, experimental_wasm_typed_funcref)
DEFINE_BOOL(wasm_gc_js_interop, true, "experimental WasmGC-JS interop")
DEFINE_BOOL(wasm_gc_js_interop, false, "experimental WasmGC-JS interop")
DEFINE_BOOL(wasm_staging, false, "enable staged wasm features")
......
......@@ -22,15 +22,18 @@ let instance = (() => {
})();
let obj = instance.exports.createStruct(123);
// The struct is opaque and doesn't have any observable properties.
assertFalse(obj instanceof Object);
// The struct is wrapped in the special wrapper.
// It doesn't have any observable properties.
assertTrue(obj instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj));
assertEquals("{}", JSON.stringify(obj));
// It can be passed as externref without any observable change.
let passObj = instance.exports.passObj;
let obj2 = passObj(obj);
assertFalse(obj2 instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj2));
assertSame(obj, obj2);
obj = passObj(obj);
assertTrue(obj instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj));
assertEquals("{}", JSON.stringify(obj));
// A JavaScript object can be passed as externref.
let jsObject = {"hello": "world"};
assertSame(jsObject, passObj(jsObject));
// It will not be wrapped.
obj = passObj({"hello": "world"});
assertEquals({"hello": "world"}, obj);
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