Compile dart2wasm modules using the JS runtime exported compileStreaming (flutter/engine#51488)

With [1] dart2wasm started using the new Wasm built-in string import
`wasm:js-string`.

With [2] dart2wasm started exporting `compile` and `compileStreaming`
from the generated JS runtime to compile dart2wasm-generated modules
with the `wasm:js-string` built-in, polyfilling it when not available.

Update Wasm compilation code in Flutter to use `compileStreaming` from
the JS runtime, enabling fast `jwasm:js-string` module when available.

[1]: 44c2e17600
[2]: 4cd6096da4
This commit is contained in:
Ömer Sinan Ağacan
2024-08-28 20:00:51 +02:00
committed by GitHub
parent d8dcc18756
commit 8da579925c

View File

@@ -152,11 +152,11 @@ export class FlutterEntrypointLoader {
let jsSupportRuntimeUri = resolveUrlWithSegments(entrypointBaseUrl, jsSupportRuntimePath);
if (this._ttPolicy != null) {
jsSupportRuntimeUri = this._ttPolicy.createScriptURL(jsSupportRuntimeUri);
}
const dartModulePromise = WebAssembly.compileStreaming(fetch(moduleUri));
}
const jsSupportRuntime = await import(jsSupportRuntimeUri);
const dartModulePromise = jsSupportRuntime.compileStreaming(fetch(moduleUri));
let imports;
if (build.renderer === "skwasm") {
imports = (async () => {