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

Issue 6625048: Strict mode arguments do not share binding with formal parameters. (Closed)

Created:
9 years, 9 months ago by Martin Maly
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Strict mode arguments do not share binding with formal parameters. Move strict mode flag from TemporaryScope to Scope so that it can be accessed from variable binding code. Arguments do not alias in strict mode (ia32, x64 and arm, codegen and full codegen). Hydrogen tolerates null arguments_shadow(). In codegen-<arch> arguments object is allocated eagerly to capture values before they get modified. BUG= TEST=test/mjsunit/strict-mode.js

Patch Set 1 #

Total comments: 9

Patch Set 2 : CR Feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -68 lines) Patch
M src/arm/codegen-arm.cc View 1 3 chunks +10 lines, -4 lines 0 comments Download
M src/arm/full-codegen-arm.cc View 1 1 chunk +7 lines, -4 lines 0 comments Download
M src/ast.h View 3 chunks +2 lines, -4 lines 0 comments Download
M src/ast-inl.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 1 chunk +5 lines, -2 lines 0 comments Download
M src/ia32/codegen-ia32.cc View 3 chunks +12 lines, -4 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 1 chunk +6 lines, -3 lines 0 comments Download
M src/parser.cc View 23 chunks +22 lines, -34 lines 0 comments Download
M src/scopes.h View 4 chunks +8 lines, -0 lines 0 comments Download
M src/scopes.cc View 2 chunks +12 lines, -0 lines 0 comments Download
M src/x64/codegen-x64.cc View 1 3 chunks +10 lines, -4 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 1 chunk +7 lines, -4 lines 0 comments Download
M test/es5conform/es5conform.status View 1 chunk +0 lines, -5 lines 0 comments Download
M test/mjsunit/strict-mode.js View 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Martin Maly
http://codereview.chromium.org/6625048/diff/1/src/ast.h File src/ast.h (right): http://codereview.chromium.org/6625048/diff/1/src/ast.h#newcode1689 src/ast.h:1689: contains_loops_(contains_loops), Strict mode is now needed in scopes.cc so ...
9 years, 9 months ago (2011-03-06 22:40:37 UTC) #1
Lasse Reichstein
You should coordinate with Kevin, who is planning to rewrite our arguments implementation. Since strict ...
9 years, 9 months ago (2011-03-07 07:54:07 UTC) #2
Kevin Millikin (Chromium)
LGTM. http://codereview.chromium.org/6625048/diff/1/src/arm/codegen-arm.cc File src/arm/codegen-arm.cc (right): http://codereview.chromium.org/6625048/diff/1/src/arm/codegen-arm.cc#newcode620 src/arm/codegen-arm.cc:620: ASSERT(shadow != NULL && shadow->AsSlot() != NULL || ...
9 years, 9 months ago (2011-03-07 11:46:48 UTC) #3
Martin Maly
9 years, 9 months ago (2011-03-07 19:09:40 UTC) #4
Thanks, Kevin!

http://codereview.chromium.org/6625048/diff/1/src/arm/codegen-arm.cc
File src/arm/codegen-arm.cc (right):

http://codereview.chromium.org/6625048/diff/1/src/arm/codegen-arm.cc#newcode620
src/arm/codegen-arm.cc:620: ASSERT(shadow != NULL && shadow->AsSlot() != NULL ||
On 2011/03/07 11:46:48, Kevin Millikin wrote:
> Parens around the && please.

Done.

http://codereview.chromium.org/6625048/diff/1/src/arm/full-codegen-arm.cc
File src/arm/full-codegen-arm.cc (right):

http://codereview.chromium.org/6625048/diff/1/src/arm/full-codegen-arm.cc#new...
src/arm/full-codegen-arm.cc:217: if (arguments_shadow != NULL) {
On 2011/03/07 11:46:48, Kevin Millikin wrote:
> A bit simpler (also on the other platforms):
> 
> if (arguments_shadow != NULL) {
>   // Duplicate the value; move-to-slot operation might clobber registers.
>   __ mov(r3, r0);
>   Move(arguments_shadow->AsSlot(), r3, r1, r2);
> }
> Move(arguments->AsSlot(), r0, r1, r2);

Done.

http://codereview.chromium.org/6625048/diff/1/src/hydrogen.cc
File src/hydrogen.cc (right):

http://codereview.chromium.org/6625048/diff/1/src/hydrogen.cc#newcode2238
src/hydrogen.cc:2238: scope->arguments_shadow() != NULL &&
On 2011/03/07 11:46:48, Kevin Millikin wrote:
> Parens around the && please.

Done.

http://codereview.chromium.org/6625048/diff/1/src/parser.cc
File src/parser.cc (right):

http://codereview.chromium.org/6625048/diff/1/src/parser.cc#newcode656
src/parser.cc:656: TemporaryScope temp_scope(&this->temp_scope_);
On 2011/03/07 11:46:48, Kevin Millikin wrote:
> Hmmm.  TemporaryScope seems like a bad name---it's not really a "scope" at
all. 
> It seems like a bundle of function-specific bits (literals and a loop flag). 
We
> already have a stack-allocated "LexicalScope" everywhere we have a
> TemporaryScope, so we should probably just combine them.
> 
> Maybe roll it into the next change you make to the parser.


Putting it on my list of opportunistic changes to make.

Powered by Google App Engine
This is Rietveld 408576698