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

Issue 1332873003: Implement sloppy-mode block-defined functions (Annex B 3.3) (Closed)

Created:
5 years, 3 months ago by Dan Ehrenberg
Modified:
5 years, 3 months ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Implement sloppy-mode block-defined functions (Annex B 3.3) ES2015 specifies very particular semantics for functions defined in blocks. In strict mode, it is simply a lexical binding scoped to that block. In sloppy mode, in addition to that lexical binding, there is a var-style binding in the outer scope, which is overwritten with the local binding when the function declaration is evaluated, *as long as* introducing ths var binding would not create a var/let conflict in the outer scope. This patch implements the semantics by introducing a DelegateStatement, which is initially filled in with the EmptyStatement and overwritten with the assignment when the scope is closed out and it can be checked that there is no conflict. This patch is tested with a new mjsunit test, and I tried staging it and running test262, finding that the tests that we have disabled due to lack of Annex B support now pass. R=adamk,rossberg LOG=Y BUG=v8:4285 Committed: https://crrev.com/e5ff10d7673a723b1b62b1ddfca194265aaff84c Cr-Commit-Position: refs/heads/master@{#30842}

Patch Set 1 #

Patch Set 2 : Tests. It works! #

Patch Set 3 : Remove DelegateStatement linked list #

Patch Set 4 : Fixing test which was broken with Annex B #

Patch Set 5 : An extra test and comment fix #

Total comments: 41

Patch Set 6 : Fix comments, except for better testing #

Patch Set 7 : More tests #

Total comments: 4

Patch Set 8 : rest parameter test #

Patch Set 9 : Naming #

Total comments: 2

Patch Set 10 : Improve type clarity #

Unified diffs Side-by-side diffs Delta from patch set Stats (+438 lines, -20 lines) Patch
M src/ast.h View 1 2 3 4 5 6 7 8 3 chunks +47 lines, -17 lines 0 comments Download
M src/ast-expression-visitor.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/ast-literal-reindexer.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/ast-numbering.cc View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -0 lines 0 comments Download
M src/compiler/ast-graph-builder.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/compiler/ast-loop-assignment-analyzer.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/full-codegen/full-codegen.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/parser.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M src/parser.cc View 1 2 3 4 5 6 7 8 9 3 chunks +48 lines, -1 line 0 comments Download
M src/pattern-rewriter.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M src/prettyprinter.cc View 1 2 3 4 5 6 7 8 3 chunks +18 lines, -0 lines 0 comments Download
M src/rewriter.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/scopes.h View 1 2 3 4 5 6 7 8 3 chunks +24 lines, -0 lines 0 comments Download
M src/scopes.cc View 1 2 3 4 5 6 7 8 4 chunks +24 lines, -0 lines 0 comments Download
M src/typing.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M src/typing-asm.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/block-let-semantics-sloppy.js View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
A test/mjsunit/harmony/block-sloppy-function.js View 1 2 3 4 5 6 7 1 chunk +203 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (13 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/20001
5 years, 3 months ago (2015-09-10 19:21:37 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_mac_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel/builds/9641)
5 years, 3 months ago (2015-09-10 19:32:27 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/60001
5 years, 3 months ago (2015-09-10 23:24:15 UTC) #6
Dan Ehrenberg
5 years, 3 months ago (2015-09-10 23:29:14 UTC) #7
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/80001
5 years, 3 months ago (2015-09-11 14:09:42 UTC) #9
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-09-11 14:35:46 UTC) #11
adamk
First round of comments, mostly style nits. The juicy bits are the handling of scopes ...
5 years, 3 months ago (2015-09-11 15:42:57 UTC) #12
Dan Ehrenberg
Haven't figured out tests for this scoping issue, but fixed all the other review comments ...
5 years, 3 months ago (2015-09-17 17:44:10 UTC) #13
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/100001
5 years, 3 months ago (2015-09-17 17:44:31 UTC) #15
Dan Ehrenberg
PTAL https://codereview.chromium.org/1332873003/diff/80001/test/mjsunit/harmony/block-sloppy-function.js File test/mjsunit/harmony/block-sloppy-function.js (right): https://codereview.chromium.org/1332873003/diff/80001/test/mjsunit/harmony/block-sloppy-function.js#newcode7 test/mjsunit/harmony/block-sloppy-function.js:7: // Test Annex B 3.3 semantics for functions ...
5 years, 3 months ago (2015-09-17 18:10:27 UTC) #16
adamk
lgtm % naming https://codereview.chromium.org/1332873003/diff/80001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1332873003/diff/80001/src/parser.cc#newcode4967 src/parser.cc:4967: Declare(declaration, DeclarationDescriptor::NORMAL, true, ok); On 2015/09/17 ...
5 years, 3 months ago (2015-09-17 18:44:36 UTC) #17
Dan Ehrenberg
https://codereview.chromium.org/1332873003/diff/120001/src/ast.h File src/ast.h (right): https://codereview.chromium.org/1332873003/diff/120001/src/ast.h#newcode1276 src/ast.h:1276: class DelegateStatement final : public Statement { On 2015/09/17 ...
5 years, 3 months ago (2015-09-17 19:06:03 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/160001
5 years, 3 months ago (2015-09-17 19:06:27 UTC) #20
adamk
lgtm % a C++11 nit https://codereview.chromium.org/1332873003/diff/160001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1332873003/diff/160001/src/parser.cc#newcode4974 src/parser.cc:4974: for (auto delegate : ...
5 years, 3 months ago (2015-09-17 19:20:06 UTC) #21
adamk
+bmeurer for various compiler OWNERs
5 years, 3 months ago (2015-09-17 19:26:32 UTC) #23
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-09-17 19:31:18 UTC) #25
Dan Ehrenberg
https://codereview.chromium.org/1332873003/diff/160001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1332873003/diff/160001/src/parser.cc#newcode4974 src/parser.cc:4974: for (auto delegate : *delegates) { On 2015/09/17 at ...
5 years, 3 months ago (2015-09-17 19:48:36 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/180001
5 years, 3 months ago (2015-09-18 02:23:31 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: v8_presubmit on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/5912)
5 years, 3 months ago (2015-09-18 02:31:19 UTC) #31
Benedikt Meurer
LGTM on compiler and fullcodegen changes; only briefly checked the rest.
5 years, 3 months ago (2015-09-19 16:51:53 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1332873003/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1332873003/180001
5 years, 3 months ago (2015-09-21 04:05:01 UTC) #34
commit-bot: I haz the power
Committed patchset #10 (id:180001)
5 years, 3 months ago (2015-09-21 04:30:56 UTC) #35
commit-bot: I haz the power
5 years, 3 months ago (2015-09-21 04:31:17 UTC) #36
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/e5ff10d7673a723b1b62b1ddfca194265aaff84c
Cr-Commit-Position: refs/heads/master@{#30842}

Powered by Google App Engine
This is Rietveld 408576698