| This is an interesting "optimization". It's not really an optimization in and
of itself, but it opens the door to other optimizations. The basic idea is
that you look for calls to instance methods that are not actually
polymorphic. In other words, the target method is (effectively) final, not
overriden anywhere in the compilation. We rewrite the single instance method
as a static method that contains the implementation plus an instance method
that delegates to the static method. Then we update any call sites to call
the static method instead. This opens the door to further optimizations,
reduces use of the long "this" keyword in the resulting JavaScript, and in
most cases the polymorphic version can be pruned later.
TODO(later): make this work on JSNI methods!
|