mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The `js_util.jsify()` related code shows up in CPU profile of wonderous. => Any `SkwasmObjectWrapper` object invokes this logic in the constructor and dispose method. This PR * makes `DomFinalizationRegistryExtension` accept `JSAny` types instead of Dart types and internally converting => Callsites can call more precise `<>.toJS*` extension methods => Will avoids extra type checks on the objects when we can call `Object.toJSBox` directly * makes us use a `toJSWrapper` / `fromJSWrapper` which will not delegate to a recursive `jsify()` but simply externalize the wasm gc object => We cannot use `Object.toJSBox` due to it being slower to create JS boxes as it semantically does something different atm (see issue below) => Instead use conditional import of `dart:_wasm` which provides the necessary primitives => Similar for going from JS to Dart. * Avoid converting from Dart object to `JSAny` more than needed (we did the operation twice for each registration and once for unregistration) Issue https://github.com/dart-lang/sdk/issues/55183