During parsing, we currently set the parent scope of anonymous functions to the outer function containing the definition. Every time we run past the associated JSOP_ANONFUNOBJ at runtime we have to clone the function object except if its defined in the global scope. Instead, we should always set the parent to the global object during parsing. This would allow to use the function without cloning from within lightweight functions as well (which is a more frequent use-case than from global script code). 13.2.1 and 13.2.13 allow for this merging.
Severity: normal → enhancement
Priority: -- → P5
Target Milestone: --- → mozilla1.9.1
Comment 0 assumes the outer function is lightweight. If it is not (and it won't be if the inner uses any non-local names) then we can't use the global. Is the case helped here really that common? Could be, just asking, and yes: we need to optimize harder to avoid heavyweights. Igor may recall better than I do the garbage entrainment bugs this risks. ES3 added the joined function object language, but ES3.1 takes it out. If any implementation does join in the face of mutation, interoperability is harmed by allowing the joining. But mandating forking due to mutation is onerous and not appropriate for the standard. /be
This still looks relevant as a non-TM bug?
Summary: TM: More aggressively avoid cloning function objects → More aggressively avoid cloning function objects
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.