Skip to content

Commit

Permalink
Add --experimental-wasm-type-reflection and support newer emscripte…
Browse files Browse the repository at this point in the history
…n 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.
  • Loading branch information
eyebrowsoffire authored Aug 23, 2023
1 parent 8ba40bb commit d8b1e81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions dev/devicelab/lib/framework/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class 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 List<String> args = <String>[
if (options.userDataDirectory != null)
Expand All @@ -108,8 +112,7 @@ class Chrome {
'--no-default-browser-check',
'--disable-default-apps',
'--disable-translate',
if (options.enableWasmGC)
'--js-flags=--experimental-wasm-gc',
if (jsFlags.isNotEmpty) '--js-flags=$jsFlags',
];

final io.Process chromeProcess = await _spawnChromiumProcess(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ String generateImports(bool isSkwasm) {
const skwasmInstance = await skwasm();
window._flutter_skwasmInstance = skwasmInstance;
resolve({
'skwasm': skwasmInstance.asm,
'skwasm': skwasmInstance.asm ?? skwasmInstance.wasmExports,
'ffi': {
'memory': skwasmInstance.wasmMemory,
}
Expand Down

0 comments on commit d8b1e81

Please sign in to comment.