Open sigmundch opened 6 years ago
@rakudrama @mraleph is this something we can do at the kernel level and share with VM AOT?
E.g., private helper class for hashtable may always be invariant wrt hashtable itself and doesn't need further covariant checks.
dart2js needs to implement a mechanism for having multiple entry points that differ on the checks tested. Once we have the mechanism we can drive it from any analysis. I would favor an analysis that has library scope and is annotated in the Kernel IR so that it is available for all back-ends, including DDC.
Kernel/VM is farthest ahead here, having tried annotating Kernel with a dispatchCategory, and then removing that and doing some whole-program analysis. It would be great to be able to use it and not reinvent the wheel.
One of many dart2 optimizations in dart2js: specialize methods so that we can remove parameter checks when we know they are not needed from a specific call-site.