-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-dart2wasmIssues for the dart2wasm compiler.Issues for the dart2wasm compiler.area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
Description
The function detectJsStringBuiltins in
| function detectJsStringBuiltins() { |
return !WebAssembly.validate(...) (note the !).
To verify, you can copy-paste that function into the DevTools console of any recent-ish Chrome build: it should return true. E.g.:
> let bytes = [
0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0,
0, 2, 23, 1, 14, 119, 97, 115, 109, 58, 106, 115, 45,
115, 116, 114, 105, 110, 103, 4, 99, 97, 115, 116, 0, 0
];
< undefined
> WebAssembly.validate(new Uint8Array(bytes))
< true
> WebAssembly.validate(new Uint8Array(bytes), {builtins: ["js-string"]})
< false
Looking at how the result of that feature detection is used in compileStreaming and compile a couple of lines further down in the same file, detectJsStringBuiltins() could also be dropped entirely: it never hurts to request {builtins: ['js-string']} in compile/compileStreaming, if the feature isn't present then that parameter will just silently be ignored.
(I noticed this when looking at https://github.com/mkustermann/wasm_gc_benchmarks/blob/main/micro-benchmarks-out/non_devirtualized_typed_data_access.dart2wasm.mjs.)
mnordine
Metadata
Metadata
Assignees
Labels
area-dart2wasmIssues for the dart2wasm compiler.Issues for the dart2wasm compiler.area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.