Closed
Bug 346749
Opened 19 years ago
Closed 16 years ago
let declarations at function level should turn into var declarations
Categories
(Core :: JavaScript Engine, defect, P4)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla1.9beta3
People
(Reporter: Waldo, Assigned: mrbkap)
References
()
Details
(Keywords: perf, testcase)
Attachments
(1 file)
1.66 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•19 years ago
|
||
Assignee: general → mrbkap
Priority: -- → P3
Target Milestone: --- → mozilla1.8.1
Assignee | ||
Updated•18 years ago
|
Summary: |var x=5;let x=7; print(this.x)| prints 7, not 5 → let declarations at top level are turned into var declarations
Comment 3•17 years ago
|
||
We might want to fix this for js1.8. Blake, do you have any time? Security via wrappers only takes precedence.
/be
Comment 4•17 years ago
|
||
Blake, I'll take this off your list if you are willing to give it up.
/be
Assignee | ||
Comment 5•17 years ago
|
||
Sure, take it. I'm still in XOW-land.
Comment 6•17 years ago
|
||
Adding perf keyword based on the second paragraph of bug 410894 comment 2.
Keywords: perf
Comment 7•17 years ago
|
||
I mean bug 410894 comment 31.
Comment 8•17 years ago
|
||
There are enough closures formed at top level, however, that a quick fix here could easily de-optimize compared to the current translation of let to var at top level. More work analyzing outer name usage in closures to minimize reflection of compile-time lexical bindings into runtime Block object properties is needed. Not sure this will make 1.9 but we should think about it.
/be
Comment 10•17 years ago
|
||
Adding this to the 1.9.1 triage queue by marking this wanted1.9.1?.
Flags: wanted1.9.1?
Priority: P3 → P4
Updated•17 years ago
|
Flags: wanted1.9.1? → wanted1.9.1+
Comment 11•17 years ago
|
||
I thought I updated this bug. At the newton ES4 working group meeting, we agreed to avoid a block implicitly scoping the body of a function or top-level program, which allows let x to shadow var x. This means let == var at top level.
So this bug should morph to request that SpiderMonkey no longer make a function body blocks.
/be
Assignee | ||
Updated•16 years ago
|
Summary: let declarations at top level are turned into var declarations → let declarations at function level should turn into var declarations
Assignee | ||
Comment 12•16 years ago
|
||
Attachment #331885 -
Flags: review?(brendan)
Comment 13•16 years ago
|
||
Comment on attachment 331885 [details] [diff] [review]
Fix
Looks good -- need tests?
/be
Attachment #331885 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 14•16 years ago
|
||
Pushed as http://hg.mozilla.org/mozilla-central/index.cgi/rev/24546515566f
As a note: we're now optimizing global variable access more aggressively in SpiderMonkey and var and let are both optimized where possible in function bodies, so this shouldn't be any sort of perf hit.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Flags: in-testsuite?
Flags: in-litmus-
Comment 15•16 years ago
|
||
mrbkap, how do i test this? current 1.9.1 and 7/31 trunk both agree with attachment 261359 [details]. I'm not sure what the changed/correct behavior is.
Assignee | ||
Comment 16•16 years ago
|
||
Bob, the easiest testcase should be:
function(){let k} == "function ( ) { var k }"
since that's the only behavior change from the patch here.
Comment 17•16 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/e0eece29c686
/cvsroot/mozilla/js/tests/js1_8/decompilation/regress-346749.js,v <-- regress-346749.js
initial revision: 1.1
Flags: in-testsuite? → in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•