Closed Bug 617609 Opened 14 years ago Closed 14 years ago

Upvar analysis marks functions as NULL_CLOSURE incorrectly

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: jimb, Assigned: jorendorff)

References

Details

(Whiteboard: [softblocker][fixed-in-tracemonkey])

Attachments

(1 file)

In the following code (from bug 554955): function f(s) { eval(s); return function(a) { var d; let (c = 3) { d = function() { a; }; return b; }; }; } the inner function gets marked as a NULL_CLOSURE. But since it can refer to a binding created by the eval in f, that's not correct. This code happens to work because, for null closures, we simply grab the current frame's scope chain to use as the function's parent, because that's more convenient than walking down to get the global, so the closure does end up enclosing f's call object, and the JSOP_NAME finds the right binding. But it's my understanding that NULL_CLOSURE means that a function doesn't need anything but the global on its scope chain; that's clearly incorrect here.
Summary: Upvar analysis marks functions a NULL_CLOSURE incorrectly → Upvar analysis marks functions as NULL_CLOSURE incorrectly
Blocks: 619750
Nominating because bug 561359 depends on this and that bug is marked as final+ and a softblocker.
blocking2.0: --- → ?
Assignee: general → jorendorff
blocking2.0: ? → betaN+
Whiteboard: softblocker
Attached patch WIP 1Splinter Review
This works, but it deoptimizes a little more than I think we need to. Instead I bet I can make DeoptimizeUsesWithin mark all functions that directly contain deoptimized uses.
Comment on attachment 505509 [details] [diff] [review] WIP 1 Correction. It looks like getting from pnu to its containing function in DeoptimizeUsesWithin is more trouble than it's worth. So let's try v1. The upshot of this is: function f(s) { // HEAVYWEIGHT eval(s); return function(a) { // HEAVYWEIGHT var d; let (c = 3) { d = function() { a; }; // neither heavyweight nor null closure return b; }; }; }
Attachment #505509 - Flags: review?(brendan)
Comment on attachment 505509 [details] [diff] [review] WIP 1 Seems fine. /be
Attachment #505509 - Flags: review?(brendan) → review+
Whiteboard: softblocker → [softblocker][fixed-in-tracemonkey]
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: