Closed Bug 475854 Opened 15 years ago Closed 12 years ago

if(false)'d function unnecessarily makes parent HEAVYWEIGHT

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: testcase)

js> print(dis(function(x) { if (false) { function y () {} } }));
flags: LAMBDA HEAVYWEIGHT INTERPRETED
main:
00000:  stop

Doesn't need to be HEAVYWEIGHT, because function y is gone.
Here's a case that I don't understand at all:

js> dis(function() { if (false) __proto__; })
flags: LAMBDA HEAVYWEIGHT INTERPRETED
main:
00000:  stop
__proto__ is an undeclared access, so heavyweight.  Same bug, I suspect.
There's something weird going on in comment 1.  It only happens for the names "__proto__" and "__parent__".
See bug 36625. We mark the function heavyweight when we see the unqualified __proto__ or __parent__ and can't re-optimize easily.
This is heavyweight because of the non-body-level function statement which dynamically adds 'y' to the scope.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.