dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.06k stars 1.56k forks source link

implement entry point specialization in dart2js #34003

Open sigmundch opened 6 years ago

sigmundch commented 6 years ago

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.

vsmenon commented 5 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.

rakudrama commented 5 years ago

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.