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

Issue 1906793002: Synchronize scopes between parser/preparser (Closed)

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

Synchronize scopes between parser/preparser This patch introduces new scopes in the preparser, just like they are introduced by the parser, in the following places: - blocks - try statement - switch statement - scoped statements, in several places - for statement - eager function bodies R=rossberg@chromium.org BUG= LOG=N Committed: https://crrev.com/fa43f4c99bae8dc57d1cc33dd7b7d914650ecd8c Cr-Commit-Position: refs/heads/master@{#35708}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -42 lines) Patch
M src/parsing/preparser.h View 1 chunk +8 lines, -2 lines 0 comments Download
M src/parsing/preparser.cc View 9 chunks +68 lines, -40 lines 0 comments Download

Messages

Total messages: 14 (3 generated)
nickie
4 years, 8 months ago (2016-04-21 12:49:58 UTC) #1
nickie
This came up because of a CL related to typed mode. https://codereview.chromium.org/1871923003/
4 years, 8 months ago (2016-04-21 12:53:06 UTC) #2
nickie
There are a few more calls to NewScope in parser.cc that have no counterparts in ...
4 years, 8 months ago (2016-04-21 12:57:52 UTC) #3
rossberg
LGTM
4 years, 8 months ago (2016-04-21 13:04:00 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1906793002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1906793002/1
4 years, 8 months ago (2016-04-21 13:15:32 UTC) #6
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 8 months ago (2016-04-21 13:41:12 UTC) #7
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/fa43f4c99bae8dc57d1cc33dd7b7d914650ecd8c Cr-Commit-Position: refs/heads/master@{#35708}
4 years, 8 months ago (2016-04-22 19:14:53 UTC) #9
adamk
Can you explain a bit more of what the purpose of this change is? What ...
4 years, 8 months ago (2016-04-23 00:09:24 UTC) #11
nickie
On 2016/04/23 00:09:24, adamk wrote: > Can you explain a bit more of what the ...
4 years, 8 months ago (2016-04-25 08:03:20 UTC) #12
rossberg
What Niko said. Plus, I would generally argue that any such discrepancy between parser and ...
4 years, 8 months ago (2016-04-25 08:17:21 UTC) #13
adamk
4 years, 8 months ago (2016-04-25 17:53:03 UTC) #14
Message was sent while issue was closed.
On 2016/04/25 08:03:20, nickie wrote:
> On 2016/04/23 00:09:24, adamk wrote:
> > Can you explain a bit more of what the purpose of this change is? What
effect
> > does adding these scopes have? The lack of test changes makes this rather
> > mysterious.
> 
> This is something that started from typed mode.  There, for some reason, I had
> to know if a declaration was at a top-level scope.  After some
experimentation,
> it seemed that the only way to do this was by introducing an extra parameter
to
> the relevant ParseXX functions.  You can take a look at the code and comments
> here:  https://codereview.chromium.org/1871923003/
> 
> Andreas asked why it wasn't possible to just use scope information for this. 
It
> turned out that the reason was some inconsistency between the scopes
introduced
> by the parser and those introduced by the preparser (possibly complicated by
the
> fact that empty scopes are optimized away).  More precisely, the preparser did
> not introduce a scope for blocks and, therefore, declarations found inside a
> block may be mistaken (by the preparser) for top-level ones.  Andreas
suggested
> that this was an issue to be fixed in the main branch too, hence this patch.
> 
> As far as I see, adding these scopes should not have any effect now, in the
main
> branch.  In fact, there could be some performance penalty.  Also, I cannot
think
> of appropriate test cases, as there seemed to be no symptoms --- the preparser
> seems not to care if there are scopes there or not.  On the other hand, it may
> prevent bugs caused by what I described above.

Given the performance penalty, and the lack of behavioral difference, it just
seems like the only observable effects of this change (that is, the behavior of
the engine in the wild) will be negative. With the team trying to reduce startup
time this quarter, I'm not sure it makes sense to take a hit here without any
gain other than increased code symmetry.

Powered by Google App Engine
This is Rietveld 408576698