Commit e2b7092f authored by Matthias Liedtke's avatar Matthias Liedtke Committed by V8 LUCI CQ

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

This is an unmodified reland of commit 67106ff4
The issue causing the revert should be addressed by commit 8598d770

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: I3e6a0a33bed4dbc7dd7c311465b25de4f8184894
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3912763Reviewed-by: 's avatarManos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83382}
parent 53c13108
......@@ -1101,7 +1101,7 @@ FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG)
DEFINE_IMPLICATION(experimental_wasm_gc, experimental_wasm_typed_funcref)
DEFINE_BOOL(wasm_gc_js_interop, false, "experimental WasmGC-JS interop")
DEFINE_BOOL(wasm_gc_js_interop, true, "experimental WasmGC-JS interop")
DEFINE_BOOL(wasm_staging, false, "enable staged wasm features")
......
......@@ -22,18 +22,15 @@ let instance = (() => {
})();
let obj = instance.exports.createStruct(123);
// The struct is wrapped in the special wrapper.
// It doesn't have any observable properties.
assertTrue(obj instanceof Object);
// The struct is opaque and doesn't have any observable properties.
assertFalse(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;
obj = passObj(obj);
assertTrue(obj instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj));
assertEquals("{}", JSON.stringify(obj));
let obj2 = passObj(obj);
assertFalse(obj2 instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj2));
assertSame(obj, obj2);
// A JavaScript object can be passed as externref.
// It will not be wrapped.
obj = passObj({"hello": "world"});
assertEquals({"hello": "world"}, obj);
let jsObject = {"hello": "world"};
assertSame(jsObject, passObj(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