Re: [w3ctag/design-reviews] WebAssembly Response API / Web Embedding (#167)

> We note, Chrome limits synchronous compile to specific sizes; we'd like to see this included in the standard (for interop).

I'm not sure this is necessary if we have `new WebAssembly.Module` imply pure JIT compilation.  Because of wasm's binary format's design, the synchronous cost of `new WebAssembly.Module(hugeBuffer)` should be practically the same as `new ArrayBuffer(hugeBuffer)`.  The latter of course is synchronous and has no size limits, so I don't think the former needs to either.

> I think insofar that makes sense that's covered, but @lukewagner can maybe elaborate.

Today, wasm can import and synchronously call, and be synchronously called by, JS functions.  These JS functions can of course be the JS functions defined by WebIDL so this can be a direct path from wasm into DOM and other Web APIs w/o thunking through JS.  The only limitation is in the expressiveness of wasm's import signatures: wasm only has `i32`/`i64`/`f32`/`f64`.  So we can call `performance.now` just fine today, but calling the `nodeType` getter is a problem :)  At the [wasm CG meeting last week](https://github.com/WebAssembly/meetings/blob/master/2017/CG-07.md) we discussed how to add sufficient types to call Web APIs both through [GC integration](https://github.com/WebAssembly/meetings/blob/master/2017/CG-07.md#gc--managed-data) and a shorter-term [JS binding section](https://github.com/WebAssembly/meetings/blob/master/2017/CG-07.md#host-bindings).  So this would cover calling Web platform functions and holding references to Web platform objects (both WebIDL and JS).

Additionally, the GC integration feature would allow wasm to directly load and store from [JS Typed Objects](https://github.com/tschneidereit/typed-objects-explainer/) allowing very high-performance interop with these sorts of objects.  There are not *yet* any plans to add direct support for untyped JS objects, but in the meantime JS objects could be accessed indirectly by calling imported functions, as mentioned above.

Hope that helps!  I'm happy to discuss more with anyone on this topic.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/167#issuecomment-318392016

Received on Thursday, 27 July 2017 15:12:14 UTC