Unverified Commit d8b1e81c authored by Jackson Gardner's avatar Jackson Gardner Committed by GitHub

Add `--experimental-wasm-type-reflection` and support newer emscripten builds. (#133084)

This makes two changes to prepare for incoming changes to skwasm in the web engine:
* We will (at least for now) be depending on the `WebAssembly.Function` constructor in `skwasm`, which is hidden behind the `--experimental-wasm-type-reflection` flag. We need to pass that when running skwasm benchmarks.
* We are going to be upgrading the skwasm build to a newer version of emscripten, which exposes the wasm exports via the `wasmExports` property instead of the `asm` property. Make sure to support either, if passed.
parent 8ba40bb1
...@@ -87,6 +87,10 @@ class Chrome { ...@@ -87,6 +87,10 @@ class Chrome {
print('Launching Chrome...'); print('Launching Chrome...');
} }
final String jsFlags = options.enableWasmGC ? <String>[
'--experimental-wasm-gc',
'--experimental-wasm-type-reflection',
].join(' ') : '';
final bool withDebugging = options.debugPort != null; final bool withDebugging = options.debugPort != null;
final List<String> args = <String>[ final List<String> args = <String>[
if (options.userDataDirectory != null) if (options.userDataDirectory != null)
...@@ -108,8 +112,7 @@ class Chrome { ...@@ -108,8 +112,7 @@ class Chrome {
'--no-default-browser-check', '--no-default-browser-check',
'--disable-default-apps', '--disable-default-apps',
'--disable-translate', '--disable-translate',
if (options.enableWasmGC) if (jsFlags.isNotEmpty) '--js-flags=$jsFlags',
'--js-flags=--experimental-wasm-gc',
]; ];
final io.Process chromeProcess = await _spawnChromiumProcess( final io.Process chromeProcess = await _spawnChromiumProcess(
......
...@@ -46,7 +46,7 @@ String generateImports(bool isSkwasm) { ...@@ -46,7 +46,7 @@ String generateImports(bool isSkwasm) {
const skwasmInstance = await skwasm(); const skwasmInstance = await skwasm();
window._flutter_skwasmInstance = skwasmInstance; window._flutter_skwasmInstance = skwasmInstance;
resolve({ resolve({
'skwasm': skwasmInstance.asm, 'skwasm': skwasmInstance.asm ?? skwasmInstance.wasmExports,
'ffi': { 'ffi': {
'memory': skwasmInstance.wasmMemory, 'memory': skwasmInstance.wasmMemory,
} }
......
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