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

Issue 2673403003: [parsing] Fix maybe-assigned for loop variables. (Closed)

Created:
3 years, 10 months ago by neis
Modified:
3 years, 10 months ago
Reviewers:
adamk, marja
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[parsing] Fix maybe-assigned for loop variables. Due to hoisting, the value of a 'var'-declared variable may actually change even if the code contains only the "initial" assignment, namely when that assignment occurs inside a loop. For example: let i = 10; do { var x = i } while (i--): As a simple and very conservative approximation of this, we explicitly mark as maybe-assigned any non-lexical variable whose "declaration" does not syntactically occur in the function scope. (In the example above, it occurs in a block scope.) BUG=v8:5636 Review-Url: https://codereview.chromium.org/2673403003 Cr-Commit-Position: refs/heads/master@{#42989} Committed: https://chromium.googlesource.com/v8/v8/+/a33fcd663b28b8846e12b97c30d6e7d837767f86

Patch Set 1 #

Patch Set 2 : Typo. #

Total comments: 1

Patch Set 3 : Address feedback. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+648 lines, -199 lines) Patch
M src/ast/scopes.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 chunks +26 lines, -2 lines 0 comments Download
M src/parsing/pattern-rewriter.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M src/parsing/preparser.cc View 1 2 1 chunk +8 lines, -2 lines 0 comments Download
M test/cctest/parsing/test-preparser.cc View 1 2 2 chunks +199 lines, -192 lines 0 comments Download
M test/cctest/scope-test-helper.h View 1 2 2 chunks +8 lines, -3 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 2 1 chunk +359 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-5636-1.js View 1 chunk +22 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-5636-2.js View 1 chunk +23 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (13 generated)
neis
PTAL. I currently had to disable two tests in test-parsing/PreParserScopeAnalysis. In these tests, the parser ...
3 years, 10 months ago (2017-02-06 16:03:15 UTC) #4
adamk
lgtm
3 years, 10 months ago (2017-02-06 20:07:55 UTC) #7
marja
https://codereview.chromium.org/2673403003/diff/20001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2673403003/diff/20001/src/parsing/parser-base.h#newcode1358 src/parsing/parser-base.h:1358: // as maybe-assigned any non-lexical variable whose "declaration" does ...
3 years, 10 months ago (2017-02-06 21:08:44 UTC) #8
marja
lgtm % MarkLoopVariableAsAssigned is a slightly confusing name since it's not only about loop variables ...
3 years, 10 months ago (2017-02-07 09:43:18 UTC) #9
neis
On 2017/02/07 09:43:18, marja wrote: > lgtm % > > MarkLoopVariableAsAssigned is a slightly confusing ...
3 years, 10 months ago (2017-02-07 11:15:13 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2673403003/40001
3 years, 10 months ago (2017-02-07 11:43:52 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/v8/v8/+/a33fcd663b28b8846e12b97c30d6e7d837767f86
3 years, 10 months ago (2017-02-07 11:45:15 UTC) #20
Michael Hablich
3 years, 10 months ago (2017-02-07 19:32:56 UTC) #21
Message was sent while issue was closed.
A revert of this CL (patchset #3 id:40001) has been created in
https://codereview.chromium.org/2679263002/ by hablich@chromium.org.

The reason for reverting is: Speculative revert because of
https://codereview.chromium.org/2679163002/..

Powered by Google App Engine
This is Rietveld 408576698