mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
js_util.{jsify,dartify}() in dart2wasm for converting to JS wrappers (flutter/engine#51375)
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
[web] Avoid using
js_util.{jsify,dartify}() in dart2wasm for converting to JS wrappers (flutter/engine#51375)
Description
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
androidapp-frameworkcross-platformdartdart-platformdesktopflutterflutter-packagefuchsiaioslinux-desktopmacosmaterial-designmobilemobile-developmentskiawebweb-frameworkwindows
2.5 GiB
Languages
Dart
75%
C++
16.5%
Objective-C++
2.9%
Java
2.8%
Objective-C
0.7%
Other
1.9%