Definitively Not( James )


In Javascript, functions always have variadic arguments. This leads to some performance hits because there always has to be an adapter when using a JIT compilation. The adapter required creating a new frame in-between the caller and callee frames. Creating a frame is super costly.

On the v8 development website a new blog entry was posted which details how this process works and what they’ve done to dramatically improve function calls by optimizing this javascript feature.

How’d they solve it? They work through the arguments array backwards so they don’t really need to know how many arguments are in the stack, but they can assume that there’s at least the enough arguments to satisfy the parameter count - even if the arguments are undefined. This allows for cutting up the formal parameters and the extra variadic arguments to pass them to the callee frame in a way that doesn’t require extra lookups or an extra frame that will calculate it all.

No more overhead! Super fast!