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

Issue 6382006: Strict mode parameter validation. (Closed)

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

Description

Strict mode parameter validation. * Duplicate parameter names * Parameters named "eval" or "arguments" BUG= TEST=test/mjsunit/strict-mode.js

Patch Set 1 #

Total comments: 10

Patch Set 2 : Kevin's feedback #

Total comments: 6

Patch Set 3 : CR Feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -11 lines) Patch
M src/parser.cc View 1 2 2 chunks +25 lines, -2 lines 0 comments Download
M src/scanner-base.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M src/scopes.h View 1 chunk +11 lines, -0 lines 0 comments Download
M test/mjsunit/strict-mode.js View 2 chunks +9 lines, -9 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Martin Maly
9 years, 11 months ago (2011-01-21 00:00:35 UTC) #1
Lasse Reichstein
LGTM. Simple and effective!
9 years, 11 months ago (2011-01-21 11:23:22 UTC) #2
Kevin Millikin (Chromium)
LGTM. Superficial comments below. http://codereview.chromium.org/6382006/diff/1/src/parser.cc File src/parser.cc (right): http://codereview.chromium.org/6382006/diff/1/src/parser.cc#newcode3299 src/parser.cc:3299: Scanner::Location name_loc(RelocInfo::kNoPosition, RelocInfo::kNoPosition); This might ...
9 years, 11 months ago (2011-01-21 11:41:56 UTC) #3
Martin Maly
Thank you, Kevin. I incorporated your feedback. Please take another look. Thanks! Martin http://codereview.chromium.org/6382006/diff/1/src/parser.cc File ...
9 years, 11 months ago (2011-01-21 23:08:39 UTC) #4
Lasse Reichstein
LGTM with comments addressed. http://codereview.chromium.org/6382006/diff/6001/src/parser.cc File src/parser.cc (right): http://codereview.chromium.org/6382006/diff/6001/src/parser.cc#newcode3398 src/parser.cc:3398: if (name_loc.beg_pos != RelocInfo::kNoPosition) { ...
9 years, 11 months ago (2011-01-25 13:03:55 UTC) #5
Martin Maly
9 years, 11 months ago (2011-01-25 17:21:25 UTC) #6
Done on all accounts. The test stays unchanged because the function
CheckStrictMode already checks that the code works outside of strict mode and
triggers SyntaxError in strict mode.

Thank you!
Martin

http://codereview.chromium.org/6382006/diff/6001/src/parser.cc
File src/parser.cc (right):

http://codereview.chromium.org/6382006/diff/6001/src/parser.cc#newcode3398
src/parser.cc:3398: if (name_loc.beg_pos != RelocInfo::kNoPosition) {
On 2011/01/25 13:03:55, Lasse Reichstein wrote:
> Use name_loc.IsValid() here and below.

Done.

http://codereview.chromium.org/6382006/diff/6001/src/scanner-base.h
File src/scanner-base.h (right):

http://codereview.chromium.org/6382006/diff/6001/src/scanner-base.h#newcode276
src/scanner-base.h:276: return beg_pos >= 0 && end_pos >= 0;
On 2011/01/25 13:03:55, Lasse Reichstein wrote:
> How about ... && end_pos >= beg_pos;
> Seems more "valid" to me :)

Done. Using beg_pos >= 0 && end_pos >= beg_pos

because end_pos >= beg_pos >= 0 ===> end_pos >= 0

http://codereview.chromium.org/6382006/diff/6001/test/mjsunit/strict-mode.js
File test/mjsunit/strict-mode.js (right):

http://codereview.chromium.org/6382006/diff/6001/test/mjsunit/strict-mode.js#...
test/mjsunit/strict-mode.js:91: CheckStrictMode("function foo(a, b, c, d, b)
{}", SyntaxError)
On 2011/01/25 13:03:55, Lasse Reichstein wrote:
> How about checking that it's not an error in non-strict mode?

Already implemented. The CheckStrictMode function will compile the snippet
without strict mode and then in several configuration of strict mode.

Powered by Google App Engine
This is Rietveld 408576698