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

Issue 7039036: Fix calls of strict mode function with an implicit receiver. (Closed)

Created:
9 years, 7 months ago by Mads Ager (chromium)
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Fix calls of strict mode function with an implicit receiver. Only IA32 version for now. I'll start porting. Strict mode functions are to get 'undefined' as the receiver when called with an implicit receiver. Modes are bad! It forces us to have checks on all function calls. This change attempts to limit the cost by passing information about whether or not a call is with an implicit or explicit receiver in ecx as part of the calling convention. The cost is setting ecx on all calls and checking ecx on entry to strict mode functions. Implicit/explicit receiver state has to be maintained by ICs. Various stubs have to not clobber ecx or save and restore it. CallFunction stub needs to check if the receiver is implicit when it doesn't know from the context. Committed: http://code.google.com/p/v8/source/detail?r=8040

Patch Set 1 #

Patch Set 2 : Shorter encoding for setting flag. #

Patch Set 3 : Fix aliased eval issue. #

Patch Set 4 : Fix presubmit #

Total comments: 23

Patch Set 5 : Address comments. Get rid of value check. #

Total comments: 2

Patch Set 6 : Port to x64 and arm. #

Total comments: 5

Patch Set 7 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1122 lines, -429 lines) Patch
M src/arm/builtins-arm.cc View 1 2 3 4 5 6 6 chunks +14 lines, -0 lines 0 comments Download
M src/arm/code-stubs-arm.cc View 1 2 3 4 5 6 2 chunks +27 lines, -23 lines 0 comments Download
M src/arm/full-codegen-arm.cc View 1 2 3 4 5 6 8 chunks +28 lines, -11 lines 0 comments Download
M src/arm/ic-arm.cc View 1 2 3 4 5 8 chunks +30 lines, -12 lines 0 comments Download
M src/arm/lithium-arm.cc View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M src/arm/lithium-codegen-arm.h View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 5 6 8 chunks +30 lines, -9 lines 0 comments Download
M src/arm/macro-assembler-arm.h View 1 2 3 4 5 6 2 chunks +13 lines, -4 lines 0 comments Download
M src/arm/macro-assembler-arm.cc View 1 2 3 4 5 6 6 chunks +32 lines, -7 lines 0 comments Download
M src/arm/stub-cache-arm.cc View 1 2 3 4 5 6 5 chunks +24 lines, -12 lines 0 comments Download
M src/ast.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M src/ast.cc View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
M src/code-stubs.h View 1 2 3 4 5 6 1 chunk +3 lines, -2 lines 0 comments Download
M src/compiler.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/debug.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M src/frames.cc View 1 2 3 2 chunks +21 lines, -15 lines 0 comments Download
M src/full-codegen.h View 1 chunk +1 line, -1 line 0 comments Download
M src/hydrogen.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M src/hydrogen.cc View 1 2 3 4 7 chunks +26 lines, -10 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 2 chunks +8 lines, -2 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 1 2 3 4 5 6 9 chunks +41 lines, -22 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 2 3 4 5 6 2 chunks +26 lines, -23 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 3 4 5 6 8 chunks +28 lines, -12 lines 0 comments Download
M src/ia32/ic-ia32.cc View 1 2 3 4 9 chunks +29 lines, -12 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 5 6 7 chunks +32 lines, -10 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M src/ia32/macro-assembler-ia32.h View 1 2 3 4 5 6 2 chunks +13 lines, -4 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 2 3 4 5 6 7 chunks +35 lines, -7 lines 0 comments Download
M src/ia32/stub-cache-ia32.cc View 1 2 3 4 5 chunks +22 lines, -10 lines 0 comments Download
M src/ic.h View 1 2 3 4 5 6 4 chunks +17 lines, -5 lines 0 comments Download
M src/ic.cc View 1 2 3 4 5 6 10 chunks +21 lines, -9 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 1 chunk +3 lines, -4 lines 0 comments Download
M src/runtime.cc View 1 2 3 4 5 6 8 chunks +20 lines, -19 lines 0 comments Download
M src/stub-cache.h View 1 2 3 4 5 6 4 chunks +45 lines, -27 lines 0 comments Download
M src/stub-cache.cc View 1 2 3 4 23 chunks +87 lines, -39 lines 0 comments Download
M src/type-info.h View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M src/type-info.cc View 1 2 3 4 5 6 2 chunks +9 lines, -9 lines 0 comments Download
M src/utils.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/v8globals.h View 1 2 3 4 2 chunks +11 lines, -1 line 0 comments Download
M src/x64/builtins-x64.cc View 1 2 3 4 5 6 9 chunks +33 lines, -17 lines 0 comments Download
M src/x64/code-stubs-x64.cc View 1 2 3 4 5 6 2 chunks +26 lines, -22 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 3 4 5 6 8 chunks +28 lines, -11 lines 0 comments Download
M src/x64/ic-x64.cc View 1 2 3 4 5 9 chunks +30 lines, -12 lines 0 comments Download
M src/x64/lithium-codegen-x64.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 5 6 8 chunks +32 lines, -10 lines 0 comments Download
M src/x64/lithium-x64.cc View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M src/x64/macro-assembler-x64.h View 1 2 3 4 5 6 2 chunks +14 lines, -5 lines 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 2 3 4 5 6 8 chunks +33 lines, -7 lines 0 comments Download
M src/x64/stub-cache-x64.cc View 1 2 3 4 5 5 chunks +24 lines, -11 lines 0 comments Download
A test/mjsunit/strict-mode-implicit-receiver.js View 1 2 3 4 1 chunk +176 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Mads Ager (chromium)
9 years, 7 months ago (2011-05-18 10:44:34 UTC) #1
Kevin Millikin (Chromium)
This is pretty hairy stuff. It's not obvious whether the CallFunction stub flags are mutually ...
9 years, 7 months ago (2011-05-18 15:57:23 UTC) #2
Mads Ager (chromium)
Could you have another look Kevin. Resolving the value check in CallFunctionStub was easy. It ...
9 years, 7 months ago (2011-05-23 16:31:34 UTC) #3
Mads Ager (chromium)
http://codereview.chromium.org/7039036/diff/8001/src/ia32/code-stubs-ia32.cc File src/ia32/code-stubs-ia32.cc (right): http://codereview.chromium.org/7039036/diff/8001/src/ia32/code-stubs-ia32.cc#newcode3953 src/ia32/code-stubs-ia32.cc:3953: // If the receiver might be a value (string, ...
9 years, 7 months ago (2011-05-24 07:14:14 UTC) #4
Kevin Millikin (Chromium)
This looks good enough to port to the other platforms. http://codereview.chromium.org/7039036/diff/5001/src/ia32/builtins-ia32.cc File src/ia32/builtins-ia32.cc (right): http://codereview.chromium.org/7039036/diff/5001/src/ia32/builtins-ia32.cc#newcode1495 ...
9 years, 7 months ago (2011-05-24 08:25:26 UTC) #5
Mads Ager (chromium)
Ported to other platforms. Whew. http://codereview.chromium.org/7039036/diff/13002/src/arm/full-codegen-arm.cc File src/arm/full-codegen-arm.cc (right): http://codereview.chromium.org/7039036/diff/13002/src/arm/full-codegen-arm.cc#newcode3668 src/arm/full-codegen-arm.cc:3668: RelocInfo::Mode mode = RelocInfo::CODE_TARGET; ...
9 years, 7 months ago (2011-05-24 13:04:14 UTC) #6
Kevin Millikin (Chromium)
OK, LGTM. http://codereview.chromium.org/7039036/diff/13002/src/arm/full-codegen-arm.cc File src/arm/full-codegen-arm.cc (right): http://codereview.chromium.org/7039036/diff/13002/src/arm/full-codegen-arm.cc#newcode138 src/arm/full-codegen-arm.cc:138: // object). ecx is zero for method ...
9 years, 7 months ago (2011-05-24 13:21:36 UTC) #7
Mads Ager (chromium)
9 years, 7 months ago (2011-05-24 13:57:53 UTC) #8
http://codereview.chromium.org/7039036/diff/13002/src/arm/full-codegen-arm.cc
File src/arm/full-codegen-arm.cc (right):

http://codereview.chromium.org/7039036/diff/13002/src/arm/full-codegen-arm.cc...
src/arm/full-codegen-arm.cc:138: // object). ecx is zero for method calls and
non-zero for function
On 2011/05/24 13:21:36, Kevin Millikin wrote:
> ecx ==> r5.

Done.

http://codereview.chromium.org/7039036/diff/13002/src/arm/lithium-codegen-arm.cc
File src/arm/lithium-codegen-arm.cc (right):

http://codereview.chromium.org/7039036/diff/13002/src/arm/lithium-codegen-arm...
src/arm/lithium-codegen-arm.cc:150: // object). ecx is zero for method calls and
non-zero for function
On 2011/05/24 13:21:36, Kevin Millikin wrote:
> ecx ==> r5.

Done.

Powered by Google App Engine
This is Rietveld 408576698