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) ...@@ -1101,7 +1101,7 @@ FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG)
DEFINE_IMPLICATION(experimental_wasm_gc, experimental_wasm_typed_funcref) 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") DEFINE_BOOL(wasm_staging, false, "enable staged wasm features")
......
...@@ -22,18 +22,15 @@ let instance = (() => { ...@@ -22,18 +22,15 @@ let instance = (() => {
})(); })();
let obj = instance.exports.createStruct(123); let obj = instance.exports.createStruct(123);
// The struct is wrapped in the special wrapper. // The struct is opaque and doesn't have any observable properties.
// It doesn't have any observable properties. assertFalse(obj instanceof Object);
assertTrue(obj instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj)); assertEquals([], Object.getOwnPropertyNames(obj));
assertEquals("{}", JSON.stringify(obj));
// It can be passed as externref without any observable change. // It can be passed as externref without any observable change.
let passObj = instance.exports.passObj; let passObj = instance.exports.passObj;
obj = passObj(obj); let obj2 = passObj(obj);
assertTrue(obj instanceof Object); assertFalse(obj2 instanceof Object);
assertEquals([], Object.getOwnPropertyNames(obj)); assertEquals([], Object.getOwnPropertyNames(obj2));
assertEquals("{}", JSON.stringify(obj)); assertSame(obj, obj2);
// A JavaScript object can be passed as externref. // A JavaScript object can be passed as externref.
// It will not be wrapped. let jsObject = {"hello": "world"};
obj = passObj({"hello": "world"}); assertSame(jsObject, passObj(jsObject));
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