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

Issue 1723313002: [parser] Enforce module-specific identifier restriction (Closed)

Created:
4 years, 10 months ago by mike3
Modified:
4 years, 7 months ago
Reviewers:
nickie, adamk
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[parser] Enforce module-specific identifier restriction Restrict the use of the `await` token as an identifier when parsing source text as module code. From http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words: > 11.6.2.2 Future Reserved Words > > The following tokens are reserved for used as keywords in future > language extensions. > > Syntax > > FutureReservedWord :: > enum > await > > await is only treated as a FutureReservedWord when Module is the goal > symbol of the syntactic grammar. BUG=v8:4767 LOG=N R=adamk@chromium.org Committed: https://crrev.com/efe5b72d021f4b099e445bf1118b71df065d6e8c Cr-Commit-Position: refs/heads/master@{#35914}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Second pass #

Total comments: 3

Patch Set 3 : With updated pre-parser #

Patch Set 4 : Remove references to variable that has recently been deleted #

Total comments: 4

Patch Set 5 : Update initialization of Zones in parser tests; re-enable code formatting validation #

Patch Set 6 : Use helper function; fix bug in test logic #

Patch Set 7 : refactored to utilize new improvement in scope management #

Total comments: 12

Patch Set 8 : Incorporate latest review feedback #

Total comments: 2

Patch Set 9 : Add an initializer for `parsing_module_` attribute #

Total comments: 1

Patch Set 10 : Correct scope handling in PreParseProgram #

Patch Set 11 : Resolve conflicts with recent changes in master #

Patch Set 12 : Relax assertion criteria #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+213 lines, -39 lines) Patch
M src/ast/scopes.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M src/parsing/parser.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +6 lines, -4 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 4 5 6 7 8 9 10 11 10 chunks +16 lines, -12 lines 0 comments Download
M src/parsing/preparser.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +27 lines, -6 lines 0 comments Download
M src/parsing/preparser.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -4 lines 0 comments Download
M src/parsing/scanner.cc View 1 2 3 3 chunks +3 lines, -2 lines 0 comments Download
M src/parsing/token.h View 1 2 3 4 chunks +6 lines, -3 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +145 lines, -7 lines 1 comment Download

Messages

Total messages: 58 (9 generated)
mike3
4 years, 10 months ago (2016-02-23 19:15:46 UTC) #1
mike3
https://codereview.chromium.org/1723313002/diff/1/src/parsing/preparser.cc File src/parsing/preparser.cc (left): https://codereview.chromium.org/1723313002/diff/1/src/parsing/preparser.cc#oldcode697 src/parsing/preparser.cc:697: DCHECK(!expr.AsIdentifier().IsFutureReserved()); I'm not convinced that removing this check outright ...
4 years, 10 months ago (2016-02-23 19:29:44 UTC) #2
adamk
https://codereview.chromium.org/1723313002/diff/1/src/ast/scopes.h File src/ast/scopes.h (right): https://codereview.chromium.org/1723313002/diff/1/src/ast/scopes.h#newcode356 src/ast/scopes.h:356: bool inside_module() const { return scope_inside_module_; } Scope isn't ...
4 years, 10 months ago (2016-02-23 22:37:16 UTC) #3
mike3
https://codereview.chromium.org/1723313002/diff/1/src/ast/scopes.h File src/ast/scopes.h (right): https://codereview.chromium.org/1723313002/diff/1/src/ast/scopes.h#newcode356 src/ast/scopes.h:356: bool inside_module() const { return scope_inside_module_; } On 2016/02/23 ...
4 years, 10 months ago (2016-02-24 16:20:54 UTC) #4
mike3
Thanks for the review, Adam! I've extended ParserBase with a `parsing_module_` flag. I expect this ...
4 years, 10 months ago (2016-02-24 16:26:25 UTC) #5
adamk
https://codereview.chromium.org/1723313002/diff/20001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1723313002/diff/20001/src/parsing/parser-base.h#newcode938 src/parsing/parser-base.h:938: bool parsing_module_; Please initialize this to false in the ...
4 years, 10 months ago (2016-02-24 19:13:25 UTC) #6
adamk
On 2016/02/24 19:13:25, adamk wrote: > https://codereview.chromium.org/1723313002/diff/20001/src/parsing/parser-base.h > File src/parsing/parser-base.h (right): > > https://codereview.chromium.org/1723313002/diff/20001/src/parsing/parser-base.h#newcode938 > ...
4 years, 10 months ago (2016-02-24 19:37:01 UTC) #7
mike3
I've updated the PreParser to be aware of whether the input is module code or ...
4 years, 9 months ago (2016-03-02 18:06:24 UTC) #8
adamk
Haven't looked at the new code yet, but see responses inline. On 2016/03/02 18:06:24, mike3 ...
4 years, 9 months ago (2016-03-02 18:27:45 UTC) #9
mike3
I just spent some time catching up with this patch, and I *think* the current ...
4 years, 8 months ago (2016-03-31 23:08:39 UTC) #10
adamk
I like the look of the code now, but I'm not sure the tests work. ...
4 years, 8 months ago (2016-04-04 22:33:46 UTC) #11
mike3
Caitlin: could you let us know if I'm correctly modifying TestParserSyncWithFlags? (My interpretation is in ...
4 years, 8 months ago (2016-04-13 20:06:16 UTC) #12
caitp (gmail)
On 2016/04/13 20:06:16, mike3 wrote: > Caitlin: could you let us know if I'm correctly ...
4 years, 8 months ago (2016-04-13 20:35:37 UTC) #13
mike3
On 2016/04/13 20:35:37, caitp wrote: > On 2016/04/13 20:06:16, mike3 wrote: > > Caitlin: could ...
4 years, 8 months ago (2016-04-13 20:50:17 UTC) #14
caitp (gmail)
On 2016/04/13 20:50:17, mike3 wrote: > On 2016/04/13 20:35:37, caitp wrote: > > On 2016/04/13 ...
4 years, 8 months ago (2016-04-13 20:54:42 UTC) #15
mike3
This latest patch incorporates Caitlin's suggestion to consistently use the RunModuleParserSyncTest for all the new ...
4 years, 8 months ago (2016-04-14 16:40:19 UTC) #16
adamk
On 2016/04/14 16:40:19, mike3 wrote: > This latest patch incorporates Caitlin's suggestion to consistently use ...
4 years, 8 months ago (2016-04-20 19:35:32 UTC) #17
mike3
On 2016/04/20 19:35:32, adamk wrote: > Finally getting back to this, sorry for the extensive ...
4 years, 8 months ago (2016-04-21 19:11:03 UTC) #18
mike3
Hi Adam. I've uploaded a new patch that takes advantage of https://codereview.chromium.org/1906923002/
4 years, 8 months ago (2016-04-22 20:41:56 UTC) #19
adamk
Almost there, just some style things. https://codereview.chromium.org/1723313002/diff/120001/src/parsing/parser.cc File src/parsing/parser.cc (right): https://codereview.chromium.org/1723313002/diff/120001/src/parsing/parser.cc#newcode1359 src/parsing/parser.cc:1359: !Token::IsIdentifier(name_tok, STRICT, false, ...
4 years, 8 months ago (2016-04-22 22:03:04 UTC) #20
mike3
Thanks for the feedback, Adam! I've incorporated it all in this latest patch. https://codereview.chromium.org/1723313002/diff/120001/src/parsing/parser.cc File ...
4 years, 8 months ago (2016-04-22 23:05:58 UTC) #21
adamk
Oops, one more missing thing (C++ is silly). https://codereview.chromium.org/1723313002/diff/140001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1723313002/diff/140001/src/parsing/parser-base.h#newcode108 src/parsing/parser-base.h:108: stack_limit_(stack_limit), ...
4 years, 8 months ago (2016-04-22 23:11:00 UTC) #22
mike3
Got it. I've just uploaded a patch with the initializer https://codereview.chromium.org/1723313002/diff/140001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1723313002/diff/140001/src/parsing/parser-base.h#newcode108 ...
4 years, 8 months ago (2016-04-22 23:30:33 UTC) #23
adamk
lgtm
4 years, 8 months ago (2016-04-22 23:32:25 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1723313002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1723313002/160001
4 years, 8 months ago (2016-04-22 23:33:08 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: v8_win_rel_ng on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/6199) v8_win_rel_ng_triggered on tryserver.v8 (JOB_FAILED, ...
4 years, 8 months ago (2016-04-22 23:50:19 UTC) #28
adamk
https://codereview.chromium.org/1723313002/diff/160001/src/parsing/preparser.h File src/parsing/preparser.h (right): https://codereview.chromium.org/1723313002/diff/160001/src/parsing/preparser.h#newcode983 src/parsing/preparser.h:983: Scope* scope = NewScope(scope_, is_module ? MODULE_SCOPE : SCRIPT_SCOPE); ...
4 years, 8 months ago (2016-04-23 00:05:50 UTC) #29
mike3
On 2016/04/23 00:05:50, adamk wrote: > I think you can just remove this ternary operator ...
4 years, 8 months ago (2016-04-25 15:26:13 UTC) #30
adamk
lgtm
4 years, 8 months ago (2016-04-26 18:29:11 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1723313002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1723313002/180001
4 years, 8 months ago (2016-04-26 19:52:59 UTC) #33
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux_arm_rel_ng on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm_rel_ng/builds/759) v8_linux_dbg_ng on tryserver.v8 (JOB_FAILED, ...
4 years, 8 months ago (2016-04-26 19:54:10 UTC) #35
mike3
Looks like there are new conflicts with this patch in master. I'll see what I ...
4 years, 8 months ago (2016-04-26 20:01:36 UTC) #36
mike3
The conflicts are resolved in the latest patch
4 years, 8 months ago (2016-04-26 21:31:42 UTC) #37
adamk
still lgtm, thanks
4 years, 8 months ago (2016-04-26 22:06:57 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1723313002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1723313002/200001
4 years, 8 months ago (2016-04-26 22:31:05 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: v8_win_rel_ng on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/6327) v8_win_rel_ng_triggered on tryserver.v8 (JOB_FAILED, ...
4 years, 8 months ago (2016-04-26 22:48:50 UTC) #42
mike3
The DCHECK failure here (from a statement that I added myself) is due to a ...
4 years, 7 months ago (2016-04-29 17:38:21 UTC) #43
adamk
Relaxed DCHECK looks fine. lgtm (the trigger failure stuff looks unrelated)
4 years, 7 months ago (2016-04-29 17:48:55 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1723313002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1723313002/220001
4 years, 7 months ago (2016-04-29 17:49:09 UTC) #46
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 7 months ago (2016-04-29 18:13:06 UTC) #47
mike3
On 2016/04/29 18:13:06, commit-bot: I haz the power wrote: > Committed patchset #12 (id:220001) This ...
4 years, 7 months ago (2016-04-29 18:32:48 UTC) #48
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/efe5b72d021f4b099e445bf1118b71df065d6e8c Cr-Commit-Position: refs/heads/master@{#35914}
4 years, 7 months ago (2016-05-01 22:04:06 UTC) #50
nickie
https://codereview.chromium.org/1723313002/diff/220001/test/cctest/test-parsing.cc File test/cctest/test-parsing.cc (left): https://codereview.chromium.org/1723313002/diff/220001/test/cctest/test-parsing.cc#oldcode1549 test/cctest/test-parsing.cc:1549: if (test_preparser) { If I understand it right, this ...
4 years, 7 months ago (2016-05-03 17:07:52 UTC) #52
mike3
On 2016/05/03 17:07:52, nickie wrote: > https://codereview.chromium.org/1723313002/diff/220001/test/cctest/test-parsing.cc > File test/cctest/test-parsing.cc (left): > > https://codereview.chromium.org/1723313002/diff/220001/test/cctest/test-parsing.cc#oldcode1549 > ...
4 years, 7 months ago (2016-05-03 17:25:50 UTC) #53
nickie
What I'm saying is that this change practically forbids the use of RunModuleParserSyncTest for any ...
4 years, 7 months ago (2016-05-03 18:32:36 UTC) #54
mike3
Understood. I think the decision there has to come from someone who understands the future ...
4 years, 7 months ago (2016-05-03 23:09:51 UTC) #55
caitp (gmail)
On 2016/05/03 23:09:51, mike3 wrote: > Understood. I think the decision there has to come ...
4 years, 7 months ago (2016-05-03 23:22:39 UTC) #56
mike3
On 2016/05/03 23:22:39, caitp wrote: > For now, lets switch RunModuleParserSyncTest back to not running ...
4 years, 7 months ago (2016-05-03 23:25:38 UTC) #57
nickie
4 years, 7 months ago (2016-05-04 15:06:47 UTC) #58
Message was sent while issue was closed.
Here's what I suggest: https://codereview.chromium.org/1952473003/

Powered by Google App Engine
This is Rietveld 408576698