Is your JIT compiled javascript function running too slow?
No worries, just wait and the javascript engine will recompile it and then replace the function with a faster version!
But that’s not fast enough either?
Webkit will compile another version using more optimizations, using code from LLVM.
Is the function still executing some long running loop?
No problem! The javascript engine will copy all of the current state and build a new compiled function that starts at the beginning of that loop, then replace the old slower function with the new one, while it is still running!
It gets flipped over at the beginning of the next run through the loop.
(see the Hot-Loop Transfer section of the original article)
Just from the description, this sounds stupendously complicated. But the performance improvements are apparently quite considerable.
I’m truly impressed by the effort that goes in and the work that’s been done on this.
🙂
Read the original post for the full details:
https://www.webkit.org/blog/3362/introducing-the-webkit-ftl-jit/