Martin Kustermann d7ce346fba [web] Avoid using 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
2024-03-18 23:04:13 +01:00
Languages
Dart 75%
C++ 16.5%
Objective-C++ 2.9%
Java 2.8%
Objective-C 0.7%
Other 1.9%