On Sep 21, 2010, at 10:05 AM, Holger Freyther wrote:
Hi all,
I might be completely wrong, my understanding of our JIT or JIT in general might be flawed as well. I have been reading some papers on SELF93s type based optimizations and related papers and started to wonder.
From my understanding our JIT is generating code on the method level (a whole method), did you ever consider inlining small functions? E.g. where the number of bytecode is < 2 * the size of an activation record?
is that already done? was it tried? does it make sense?
It does make sense to inline hot functions. However, because of the highly dynamic nature of JavaScript, it is challenging to do this with full correctness. In particular, you need to either prove that the call will always be to the same function, or test to verify that it is the same. And you have to be prepared to recompile if your assumption fails. We actually do some level of "still the same function" testing in the fast path for calls. It is possible to apply similar techniques to inlining, but more challenging and with a greater penalty for missing. Regards, Maciej