sdk
sdk copied to clipboard
Consider supporting min browser versions as options to dart2wasm
The wasm instruction set is constantly evolving as new proposals and features are added to the spec.
We could implement usage of newer instructions as individual flags but it's difficult for developers to associate those flags with specific browser versions. If we enable them by default, we break user's browser support. If we don't enable them by default, most people won't use them and therefore won't benefit from them.
Some of these new instructions can improve dart2wasm's emitted code in significant ways (e.g. better code size or simpler lowering).
Given different users have different thresholds for the minimum browser version they would like to support with WASM, it may be beneficial to allow users to specify minimum browser versions to the compiler at build time. The compiler would then only emit instructions supported by those min versions.
It would still be the user's responsibility to fallback to JS on browsers older than the specified versions. But it would be easier for them to know what versions to check for in their fallback logic.
cc @mkustermann