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

Issue 1567603005: Set up rewriting triggers (Closed)

Created:
4 years, 11 months ago by nickie
Modified:
4 years, 11 months ago
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

Set up rewriting triggers This patch implements eager expression rewriting when parsing. It will be used for desugaring spreads but may have other uses in the future. We call Traits::RewriteExpression as soon as we realise that something parsed as an expression is actually used as an expression (and not as a pattern). This patch adds a dummy implementation for this function, doing no rewriting at all, and adds the trigers in the right places of the parser. R=rossberg@chromium.org BUG= Committed: https://crrev.com/2b90397d670a2dcbd280aca4c93181dd0480a36a Cr-Commit-Position: refs/heads/master@{#33300}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Rebase #

Patch Set 3 : Merge RewriteExpression and ValidateExpression #

Total comments: 19

Patch Set 4 : Clean up and rename to RewriteNonPattern #

Patch Set 5 : Add some more forgotten triggers #

Patch Set 6 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -41 lines) Patch
M src/parsing/parser.h View 1 2 3 4 5 2 chunks +19 lines, -0 lines 0 comments Download
M src/parsing/parser.cc View 1 2 3 4 5 8 chunks +61 lines, -7 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 4 5 34 chunks +49 lines, -34 lines 0 comments Download
M src/parsing/preparser.h View 1 2 3 4 5 2 chunks +34 lines, -0 lines 0 comments Download

Messages

Total messages: 37 (10 generated)
nickie
4 years, 11 months ago (2016-01-07 14:40:42 UTC) #1
rossberg
https://codereview.chromium.org/1567603005/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/1/src/parsing/parser-base.h#newcode1598 src/parsing/parser-base.h:1598: expression = Traits::RewriteExpression(expression); Do we actually need to do ...
4 years, 11 months ago (2016-01-08 12:22:27 UTC) #2
nickie
https://codereview.chromium.org/1567603005/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/1/src/parsing/parser-base.h#newcode1598 src/parsing/parser-base.h:1598: expression = Traits::RewriteExpression(expression); On 2016/01/08 12:22:27, rossberg wrote: > ...
4 years, 11 months ago (2016-01-08 13:46:58 UTC) #3
rossberg
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1040 src/parsing/parser-base.h:1040: #if 0 // TODO(nikolaos): is this needed? Yes, this ...
4 years, 11 months ago (2016-01-12 13:47:52 UTC) #6
caitp (gmail)
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1359 src/parsing/parser-base.h:1359: #if 0 // TODO(nikolaos): is this needed? On 2016/01/12 ...
4 years, 11 months ago (2016-01-12 13:50:39 UTC) #8
caitp (gmail)
On 2016/01/12 13:50:39, caitp wrote: > https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h > File src/parsing/parser-base.h (right): > > https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1359 > ...
4 years, 11 months ago (2016-01-12 13:54:33 UTC) #9
caitp (gmail)
On 2016/01/12 13:54:33, caitp wrote: > On 2016/01/12 13:50:39, caitp wrote: > > > https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h ...
4 years, 11 months ago (2016-01-12 14:05:22 UTC) #10
nickie
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1040 src/parsing/parser-base.h:1040: #if 0 // TODO(nikolaos): is this needed? On 2016/01/12 ...
4 years, 11 months ago (2016-01-12 14:12:32 UTC) #11
caitp (gmail)
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode2056 src/parsing/parser-base.h:2056: #if 0 // TODO(nikolaos): is this needed? On 2016/01/12 ...
4 years, 11 months ago (2016-01-12 14:25:55 UTC) #12
caitp (gmail)
On 2016/01/12 14:25:55, caitp wrote: > https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h > File src/parsing/parser-base.h (right): > > https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode2056 > ...
4 years, 11 months ago (2016-01-12 14:48:35 UTC) #13
nickie
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1040 src/parsing/parser-base.h:1040: #if 0 // TODO(nikolaos): is this needed? On 2016/01/12 ...
4 years, 11 months ago (2016-01-12 15:16:09 UTC) #14
nickie
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1359 src/parsing/parser-base.h:1359: #if 0 // TODO(nikolaos): is this needed? On 2016/01/12 ...
4 years, 11 months ago (2016-01-13 10:26:06 UTC) #15
rossberg
LGTM, although I still feel somewhat uncomfortable about the slightly fuzzy rewriting points for parenthesised ...
4 years, 11 months ago (2016-01-14 13:28:40 UTC) #16
nickie
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1040 src/parsing/parser-base.h:1040: #if 0 // TODO(nikolaos): is this needed? On 2016/01/14 ...
4 years, 11 months ago (2016-01-14 14:47:14 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1567603005/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1567603005/120001
4 years, 11 months ago (2016-01-14 14:57:53 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux64_avx2_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel/builds/8723) v8_linux64_rel_ng on tryserver.v8 (JOB_FAILED, ...
4 years, 11 months ago (2016-01-14 14:58:46 UTC) #22
caitp (gmail)
https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/1567603005/diff/80001/src/parsing/parser-base.h#newcode1359 src/parsing/parser-base.h:1359: #if 0 // TODO(nikolaos): is this needed? On 2016/01/14 ...
4 years, 11 months ago (2016-01-14 15:06:26 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1567603005/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1567603005/140001
4 years, 11 months ago (2016-01-14 15:26:51 UTC) #26
commit-bot: I haz the power
Committed patchset #6 (id:140001)
4 years, 11 months ago (2016-01-14 15:46:53 UTC) #27
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/2b90397d670a2dcbd280aca4c93181dd0480a36a Cr-Commit-Position: refs/heads/master@{#33300}
4 years, 11 months ago (2016-01-14 15:47:16 UTC) #29
adamk
Just noticed this patch as I was reviewing something else. This seems like a pretty ...
4 years, 11 months ago (2016-01-19 22:33:39 UTC) #31
adamk
On 2016/01/19 22:33:39, adamk wrote: > Just noticed this patch as I was reviewing something ...
4 years, 11 months ago (2016-01-19 23:18:53 UTC) #32
nickie
On 2016/01/19 23:18:53, adamk wrote: > On 2016/01/19 22:33:39, adamk wrote: > > Just noticed ...
4 years, 11 months ago (2016-01-20 08:36:17 UTC) #33
adamk
On 2016/01/20 08:36:17, nickie wrote: > On 2016/01/19 23:18:53, adamk wrote: > > On 2016/01/19 ...
4 years, 11 months ago (2016-01-20 19:12:27 UTC) #34
nickie
On 2016/01/20 19:12:27, adamk wrote: > When I mentioned the "programming model" one thing I ...
4 years, 11 months ago (2016-01-21 08:53:29 UTC) #35
rossberg
@adamk, there isn't more of a design doc for this than for any other implementation ...
4 years, 11 months ago (2016-01-21 12:05:27 UTC) #36
adamk
4 years, 11 months ago (2016-01-21 18:59:40 UTC) #37
Message was sent while issue was closed.
On 2016/01/21 12:05:27, rossberg wrote:
> @adamk, there isn't more of a design doc for this than for any other
> implementation change we ever made to the system. :)

Sure, but this touched 10s of callsites throughout the parser, and presumably
affects future desugaring plans (say, of ObjectLiterals). And to be fair I
would've been happier if, say, ExpressionClassifier had an accompanying doc
too...I just think this is an area we could improve.

> But I agree that it would be good to add documentation in the form of suitable
> code comments somewhere that e.g. state the ambiguous intersection subgrammar,
> and note that both RewritePattern and RewriteNonPattern get executed at the
> point where they are disambiguated. Also, that these rewriters only traverses
> the intersection grammar, so nothing is traversed twice.
> 
> The advantage of this approach is that the rewrites are in sync with validates
> (and Niko already discovered several validation bugs that way). I don't have
> strong feelings about adapting the preparser, though it would feel a bit weird
> if it explicitly called something called Rewrite when it doesn't even have an
> AST.

Well, the ParserBase parts already call "rewrite" on PreParserExpressions, so
I'm not sure it's much weirder. I think there's a danger in leaving calls to
ValidateExpression() sitting around that someone might accidentally call that
instead of RewriteNonPattern and silently fail to handle the appropriate
rewriting, causing bad behavior or crashes downstream.

Powered by Google App Engine
This is Rietveld 408576698