Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Arguments object myths and truth #57

mraleph opened this Issue · 3 comments

2 participants


The arguments object is always created with the only two exceptions being the cases where it > is declared as a name inside of a function or one of its formal parameters. It does not matter
whether it is used or not.

This is incorrect at least for V8. Arguments object is not created if it is not used and even if it is used in some cases V8 can avoid creating arguments object.

In the above code, foo can no longer be a subject to inlining since it needs to know about both itself and its caller.

This logic is also incorrect. Inlining can take care of the fact that foo accesses it's caller.

Speaking of V8:

  • Accessing arguments.callee currently in function makes function non-optimizable.
  • But accessing it does not disable inling of functions above it. Consider the following example:

    function baz() {
    if (arguments.callee.caller != foo || arguments.callee.caller.caller != bar)
    throw new Error("something fishy is going on");

    function foo() { return baz(); }
    function bar() { return foo(); }

    for (var i = 0; i < 1000000; i++) bar();

    Here V8's optimizing backend will be able to inline foo into bar despite the fact that baz accesses the fact that foo is called from bar.


Why this is marked with "additional details"?

Claiming that "It does not matter whether it is used or not." is pure mis-information.


I think I'll look at removing a lot of the micro-perf text. People shouldn't be worrying too much about this, especially as loads of it depends on ephemeral interpreter implementations!

Having seen your LXJS talk I don't want to engender your wrath (unless your blood pressure is too low ;) )


@timruffles that would be great. feel free to reach out to me directly if you need any clarifications.

[strangely github did not notify me about your comment, I discovered this update by pure accident :-/]

@timruffles timruffles closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.