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

Issue 8688007: Statically check for assignments to const in harmony mode. (Closed)

Created:
9 years, 1 month ago by Steven
Modified:
9 years ago
Reviewers:
fschneider
CC:
v8-dev
Visibility:
Public.

Description

Statically check for assignments to const in harmony mode. The ES.next draft rev 4 in section 11.13 reads: It is a Syntax Error if the AssignmentExpression is contained in extended code and the LeftHandSideExpression is an Identifier that does not statically resolve to a declarative environment record binding or if the resolved binding is an immutable binding. This CL adds corresponding static checks for the immutable binding case. TEST=mjsunit/harmony/block-const-assign Committed: http://code.google.com/p/v8/source/detail?r=10156

Patch Set 1 #

Total comments: 6

Patch Set 2 : Addressed first round of comments. #

Total comments: 6

Patch Set 3 : Addressed second round of comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -6 lines) Patch
M src/ast.h View 1 2 chunks +8 lines, -0 lines 0 comments Download
M src/ast.cc View 1 2 chunks +2 lines, -0 lines 0 comments Download
M src/compiler.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/messages.js View 1 2 chunks +2 lines, -0 lines 0 comments Download
M src/parser.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M src/parser.cc View 1 2 7 chunks +34 lines, -1 line 0 comments Download
M src/preparser.cc View 1 4 chunks +26 lines, -3 lines 0 comments Download
M src/scopes.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/scopes.cc View 1 2 3 chunks +42 lines, -1 line 0 comments Download
A test/mjsunit/harmony/block-const-assign.js View 1 chunk +131 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Steven
PTAL.
9 years, 1 month ago (2011-11-24 16:26:11 UTC) #1
fschneider
http://codereview.chromium.org/8688007/diff/1/src/ast.h File src/ast.h (right): http://codereview.chromium.org/8688007/diff/1/src/ast.h#newcode1157 src/ast.h:1157: bool IsUsedAsLValue() { Maybe rename to just IsLValue? http://codereview.chromium.org/8688007/diff/1/src/ast.h#newcode1167 ...
9 years ago (2011-11-30 16:11:46 UTC) #2
Steven
http://codereview.chromium.org/8688007/diff/1/src/ast.h File src/ast.h (right): http://codereview.chromium.org/8688007/diff/1/src/ast.h#newcode1157 src/ast.h:1157: bool IsUsedAsLValue() { On 2011/11/30 16:11:46, fschneider wrote: > ...
9 years ago (2011-12-05 11:56:57 UTC) #3
fschneider
LGTM with comments below. http://codereview.chromium.org/8688007/diff/6013/src/ast.h File src/ast.h (right): http://codereview.chromium.org/8688007/diff/6013/src/ast.h#newcode1179 src/ast.h:1179: bool is_lvalue_; Please make sure ...
9 years ago (2011-12-05 13:30:04 UTC) #4
Steven
9 years ago (2011-12-05 14:41:09 UTC) #5
http://codereview.chromium.org/8688007/diff/6013/src/ast.h
File src/ast.h (right):

http://codereview.chromium.org/8688007/diff/6013/src/ast.h#newcode1179
src/ast.h:1179: bool is_lvalue_;
Still 28 bytes on arm, ia32 and 40 bytes on x64.

On 2011/12/05 13:30:05, fschneider wrote:
> Please make sure the instance size (sizeof) for VariableProxy is unchanged on
> all platforms. I think it should be fine since each bool should not occupy
more
> than 1 bytes. But otherwise we should pack the booleans into one a one-word
> bitfield.

http://codereview.chromium.org/8688007/diff/6013/src/parser.cc
File src/parser.cc (right):

http://codereview.chromium.org/8688007/diff/6013/src/parser.cc#newcode4322
src/parser.cc:4322: VariableProxy* lhs = expression != NULL
On 2011/12/05 13:30:05, fschneider wrote:
> Maybe rename to
> 
> VariableProxy* proxy = ...

Done.

http://codereview.chromium.org/8688007/diff/6013/src/scopes.cc
File src/scopes.cc (right):

http://codereview.chromium.org/8688007/diff/6013/src/scopes.cc#newcode591
src/scopes.cc:591: return proxy;
On 2011/12/05 13:30:05, fschneider wrote:
> This would fit on the line above for a single-line if-statement.

Done.

Powered by Google App Engine
This is Rietveld 408576698