[dart2js] dart2js should do better inlining of @Native
method stubs
#56062
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
dart2js-optimization
P3
A lower priority bug or feature request
web-dart2js
In
-O1
and-O2
code I see calls toNativeByteData
's private methods that look like this:When checks are disabled, the code is better:
We should be able to generate the better code at
-O1
.The problem is that inlining is inhibited if there is any chance of a parameter check.
Of course, there is no chance here since the 'dynamic invocation' is actually a type-safe interface call where only covariant parameters might need to be checked, and the target has not covariant parameters.
The best way forward would be to improve dart2js generally around interface calls when checks are enabled.
For the specific case like this example, of calling private methods of
@Native
classes, where the calls can only be in internal libraries, we can verify by inspection that all calls are from from interface call sites, and we can annotate the target with@pragma('dart2js:parameter:trust')
.Low priority to fix since we are moving away from having many
@Native
classes in favor of more flexible interop.The text was updated successfully, but these errors were encountered: