if(false)'d function unnecessarily makes parent HEAVYWEIGHT

RESOLVED INVALID

Status

()

--
minor
RESOLVED INVALID
10 years ago
7 years ago

People

(Reporter: jruderman, Unassigned)

Tracking

(Blocks: 1 bug, {testcase})

Trunk
x86
macOS
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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.
(Reporter)

Comment 1

10 years ago
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.
(Reporter)

Comment 3

10 years ago
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
Last Resolved: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.