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

Issue 6691003: Strict mode poision pills. (Closed)

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

Description

Strict mode poision pills. - function.caller - function.arguments BUG= TEST=test/mjsunit/strict-mode.js

Patch Set 1 #

Total comments: 10

Patch Set 2 : CR Feedback. #

Patch Set 3 : Kraken fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+297 lines, -28 lines) Patch
M src/arm/codegen-arm.cc View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M src/arm/full-codegen-arm.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/bootstrapper.cc View 1 2 5 chunks +147 lines, -6 lines 0 comments Download
M src/builtins.h View 1 chunk +4 lines, -1 line 0 comments Download
M src/builtins.cc View 1 chunk +18 lines, -0 lines 0 comments Download
M src/contexts.h View 2 chunks +7 lines, -0 lines 0 comments Download
M src/factory.h View 2 chunks +4 lines, -0 lines 0 comments Download
M src/factory.cc View 2 chunks +24 lines, -1 line 0 comments Download
M src/handles.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/handles.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M src/ia32/codegen-ia32.cc View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/messages.js View 1 chunk +2 lines, -0 lines 0 comments Download
M src/objects.cc View 1 1 chunk +12 lines, -3 lines 0 comments Download
M src/runtime.cc View 1 2 1 chunk +8 lines, -5 lines 0 comments Download
M src/x64/codegen-x64.cc View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M test/mjsunit/strict-mode.js View 1 1 chunk +44 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Martin Maly
This change implements strict more poison pill functions for Function.arguments and Function.caller for strict mode ...
9 years, 9 months ago (2011-03-14 05:00:15 UTC) #1
Lasse Reichstein
LGTM http://codereview.chromium.org/6691003/diff/1/src/arm/codegen-arm.cc File src/arm/codegen-arm.cc (right): http://codereview.chromium.org/6691003/diff/1/src/arm/codegen-arm.cc#newcode3118 src/arm/codegen-arm.cc:3118: !function_info->strict_mode()) { // Strict mode functions use slow ...
9 years, 9 months ago (2011-03-14 12:20:14 UTC) #2
Martin Maly
9 years, 9 months ago (2011-03-14 16:39:26 UTC) #3
Thanks, Lasse. Made all changes. The fast path work is captured as an issue
1249.
The test you recommended - to check for prototype of the poison pill - revealed
bug (no prototype on the poison pill function) which was trivial to fix - set
the map of the poison pill function to the map with prototype. Since it was only
1 line change I am going proceeding to landing.

Thank you!
Martin

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

http://codereview.chromium.org/6691003/diff/1/src/arm/codegen-arm.cc#newcode3118
src/arm/codegen-arm.cc:3118: !function_info->strict_mode()) {  // Strict mode
functions use slow path.
On 2011/03/14 12:20:15, Lasse Reichstein wrote:
> We'll need a fast path for strict mode functions too, eventually.

Yep. Opening an issue on this.
http://code.google.com/p/v8/issues/detail?id=1249

http://codereview.chromium.org/6691003/diff/1/src/objects.cc
File src/objects.cc (right):

http://codereview.chromium.org/6691003/diff/1/src/objects.cc#newcode5549
src/objects.cc:5549: map() ==
context()->global_context()->function_map_strict()) ||
On 2011/03/14 12:20:15, Lasse Reichstein wrote:
> Try splitting it into two asserts:
>  ASSERT(!shared()->strict_mode() || map == ....->function_map_strict());
>  ASSERT(shared()->strict_mode() || map == ....->function_map());
> It's easier to see which one fails, if it does.
> 
> (Why isn't logical implication an operator :)
>  

Done.

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

http://codereview.chromium.org/6691003/diff/1/test/mjsunit/strict-mode.js#new...
test/mjsunit/strict-mode.js:991: 
On 2011/03/14 12:20:15, Lasse Reichstein wrote:
> How about an inherited strictness:
>   var athird = (function() { "use strict"; return function(){};})();
> or do we consider it well tested that this generates a strict function?

Done.

http://codereview.chromium.org/6691003/diff/1/test/mjsunit/strict-mode.js#new...
test/mjsunit/strict-mode.js:996: assertThrows(pill, TypeError);
On 2011/03/14 12:20:15, Lasse Reichstein wrote:
> Should you check whether it has a .prototype property?

Good suggestion. Turns out there was a bug here. After I create the JSFunction
for poison pill I need to set its map to the strict map with prototype. Made
that 1 line change.

http://codereview.chromium.org/6691003/diff/1/test/mjsunit/strict-mode.js#new...
test/mjsunit/strict-mode.js:1004: assertEquals(false, descriptor.configurable);
On 2011/03/14 12:20:15, Lasse Reichstein wrote:
> I think we have an assertFalse function.

Done.

Powered by Google App Engine
This is Rietveld 408576698