Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Issue 1308123007: [es6] conditionally ignore TDZ semantics for formals (Closed)

Created:
5 years, 3 months ago by caitp (gmail)
Modified:
5 years, 2 months ago
Reviewers:
wingo, adamk, rossberg
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[es6] conditionally ignore TDZ semantics for formals If HasParameterExpressions is false, a new lexical environment is not meant to be created for formals without expressions, because they cannot possibly leak information. Implementing this change allows formal binding patterns and rest parameters to be desugared using `VAR` bindings which do not require hole-checking, and is significantly more performant for common cases. BUG=v8:2160, v8:811 LOG=N R=adamk, rossberg, wingo

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+135 lines, -33 lines) Patch
M src/expression-classifier.h View 2 chunks +21 lines, -1 line 0 comments Download
M src/parser.cc View 13 chunks +69 lines, -25 lines 0 comments Download
M src/pattern-rewriter.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M src/preparser.h View 8 chunks +19 lines, -1 line 0 comments Download
M src/preparser.cc View 2 chunks +3 lines, -1 line 0 comments Download
M src/scopes.h View 3 chunks +13 lines, -0 lines 0 comments Download
M src/scopes.cc View 1 chunk +1 line, -0 lines 0 comments Download
M test/mjsunit/harmony/destructuring.js View 1 chunk +4 lines, -2 lines 2 comments Download

Messages

Total messages: 11 (1 generated)
caitp (gmail)
PTAL --- The CL description doesn't cover everything happening here: - Desugaring of rest parameters ...
5 years, 3 months ago (2015-09-05 16:10:14 UTC) #2
caitp (gmail)
From the benchmarks at https://crrev.com/1317113007/ With patch: ``` >>> Running suite: JSTests/RestParameters >>> Stdout (#1): ...
5 years, 3 months ago (2015-09-05 16:14:32 UTC) #3
caitp (gmail)
On 2015/09/05 16:14:32, caitp wrote: > From the benchmarks at https://crrev.com/1317113007/ > > With patch: ...
5 years, 3 months ago (2015-09-05 16:16:13 UTC) #4
adamk
I haven't looked at the patch yet (just back from vacation), but I don't think ...
5 years, 3 months ago (2015-09-08 20:23:54 UTC) #5
caitp (gmail)
On 2015/09/08 20:23:54, adamk wrote: > I haven't looked at the patch yet (just back ...
5 years, 3 months ago (2015-09-08 20:41:36 UTC) #6
caitp (gmail)
On 2015/09/08 20:41:36, caitp wrote: > On 2015/09/08 20:23:54, adamk wrote: > > I haven't ...
5 years, 3 months ago (2015-09-08 20:46:41 UTC) #7
adamk
On 2015/09/08 20:46:41, caitp wrote: > On 2015/09/08 20:41:36, caitp wrote: > > On 2015/09/08 ...
5 years, 3 months ago (2015-09-08 21:00:36 UTC) #8
adamk
Another high-level comment below. Performance aside, we should try to get the behavior correct. https://codereview.chromium.org/1308123007/diff/1/test/mjsunit/harmony/destructuring.js ...
5 years, 3 months ago (2015-09-09 00:07:02 UTC) #9
caitp (gmail)
Thanks for the look. It's not clear this can land soon, but i can keep ...
5 years, 3 months ago (2015-09-09 00:24:48 UTC) #10
adamk
5 years, 3 months ago (2015-09-09 00:32:04 UTC) #11
On 2015/09/09 00:24:48, caitp wrote:
> Thanks for the look. It's not clear this can land soon, but i can keep working
> on it
> 
>
https://codereview.chromium.org/1308123007/diff/1/test/mjsunit/harmony/destru...
> File test/mjsunit/harmony/destructuring.js (right):
> 
>
https://codereview.chromium.org/1308123007/diff/1/test/mjsunit/harmony/destru...
> test/mjsunit/harmony/destructuring.js:959: assertDoesNotThrow("function f({x})
{
> var x; }; f({});");
> On 2015/09/09 00:07:02, adamk wrote:
> > So this is no longer an error, but yet
> > 
> > function f({x = undefined}) { var x; }
> > 
> > is an error.
> > 
> > Seems like there's a deeper problem here. I need to tech up my spec-reading
to
> > fully grok IteratorBindingInitialization, but it seems like the
> let-binding-ness
> > shouldn't have anything to do with the ContainsExpression bit.
> 
> That's a known issue. I have two plans to fix it. But, there's a cost: one
> requires the implementation of the spec change from July 29th re: directives
in
> functions with non-simple parameters, and the other requires a change to the
ast
> node to track the declaration kind of a variable declaration. So i thought I'd
> keep that as a TODO for now. What do you think? The AST change is just so the
> redeclaration error can be avoided for lexical parameters.

Is the known issue catalogued somewhere (with the proper behavior spelled out)?
I realize I'm a bit late to the destructuring party, but it's worrying to me
that there are so many bugs in plain sight. Mostly in the sense that it's
unclear at any point what's done and what's still-to-be-done.

Powered by Google App Engine
This is Rietveld 408576698