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

Issue 9415010: Make built-ins strict mode conforming, and support a --use-strict flag. (Closed)

Created:
8 years, 10 months ago by rossberg
Modified:
8 years, 10 months ago
Reviewers:
Yang
CC:
v8-dev
Visibility:
Public.

Description

Make built-ins strict mode conforming, and support a --use-strict flag. * Turned all uses of 'const' into 'var'. * Turned all uses of local 'function' into 'var'. * Added a couple of missing toplevel 'var' declarations. One consequence is that the properties on the builtin object are no longer non-writable, and I had to adapt one test. Is that a problem? Unfortunately, we cannot actually switch the library scripts to strict mode by default, because that makes observable things like poisoned .caller properties for library functions. Also removed dead flag code in Compiler::Compile. R=yangguo@chromium.org BUG= TEST= Committed: https://code.google.com/p/v8/source/detail?r=10758

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed Yang's comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+154 lines, -156 lines) Patch
M include/v8.h View 1 chunk +1 line, -1 line 0 comments Download
M src/apinatives.js View 1 chunk +2 lines, -2 lines 0 comments Download
M src/array.js View 9 chunks +13 lines, -13 lines 0 comments Download
M src/collection.js View 1 chunk +4 lines, -3 lines 0 comments Download
M src/compiler.cc View 2 chunks +1 line, -7 lines 0 comments Download
M src/d8.js View 7 chunks +13 lines, -11 lines 0 comments Download
M src/date.js View 1 chunk +2 lines, -3 lines 0 comments Download
M src/debug-debugger.js View 1 chunk +3 lines, -3 lines 0 comments Download
M src/flag-definitions.h View 1 chunk +3 lines, -1 line 0 comments Download
M src/math.js View 1 chunk +4 lines, -4 lines 0 comments Download
M src/messages.js View 8 chunks +14 lines, -13 lines 0 comments Download
M src/mirror-debugger.js View 1 5 chunks +42 lines, -42 lines 0 comments Download
M src/proxy.js View 1 chunk +2 lines, -0 lines 0 comments Download
M src/regexp.js View 4 chunks +8 lines, -8 lines 0 comments Download
M src/runtime.js View 1 chunk +10 lines, -10 lines 0 comments Download
M src/string.js View 1 chunk +2 lines, -2 lines 0 comments Download
M src/uri.js View 7 chunks +7 lines, -7 lines 0 comments Download
M src/v8natives.js View 1 chunk +9 lines, -9 lines 0 comments Download
M test/cctest/test-debug.cc View 7 chunks +13 lines, -13 lines 0 comments Download
M test/mjsunit/builtins.js View 2 chunks +1 line, -4 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
rossberg
8 years, 10 months ago (2012-02-16 17:30:52 UTC) #1
Yang
LGTM with comments. https://chromiumcodereview.appspot.com/9415010/diff/1/src/collection.js File src/collection.js (right): https://chromiumcodereview.appspot.com/9415010/diff/1/src/collection.js#newcode28 src/collection.js:28: "use strict"; Some of the .js ...
8 years, 10 months ago (2012-02-17 08:22:55 UTC) #2
rossberg
8 years, 10 months ago (2012-02-17 09:20:17 UTC) #3
I'll wait a bit longer with landing this, in case anybody has concerns regarding
making the builtin object mutable.

http://codereview.chromium.org/9415010/diff/1/src/collection.js
File src/collection.js (right):

http://codereview.chromium.org/9415010/diff/1/src/collection.js#newcode28
src/collection.js:28: "use strict";
On 2012/02/17 08:22:55, Yang wrote:
> Some of the .js files have "use strict", some don't. Intentional?

Yes. I spent the better part of my evening trying to get in "use strict"
everywhere, but lots of things went wrong: some tests failed that traverse the
.caller chain through higher-order library functions in array and string; the
debugger started executing all tests in strict mode (and thus failing), for
reasons that I didn't understand at all; and worst, with v8natives and runtime,
I even had weird crashes and assertion failures -- apparently, some of the
low-level code and primitive rely on sloppy semantics.

In the end, I just gave up and decided to keep everything sloppy by default,
except for new Harmony libs, and auxiliaries like message.js.

Long-term goal should be to get rid of it, but I leave that for future work.

http://codereview.chromium.org/9415010/diff/1/src/mirror-debugger.js
File src/mirror-debugger.js (right):

http://codereview.chromium.org/9415010/diff/1/src/mirror-debugger.js#newcode27
src/mirror-debugger.js:27: 
On 2012/02/17 08:22:55, Yang wrote:
> Why new empty line?

Because I had a "use strict" in here at some point that I reverted imperfectly.
;)

Done.

Powered by Google App Engine
This is Rietveld 408576698