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

Issue 6524006: Strict mode function entry (Function.prototype.call/apply) (Closed)

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

Description

Strict mode function entry. Function.call/Function.apply skip transformation of the thisArg when calling strict mode function. BUG= TEST=es5conform, test/mjsunit/strict-mode.js

Patch Set 1 #

Total comments: 6

Patch Set 2 : Code review feedback. #

Total comments: 1

Patch Set 3 : Fix presubmit. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+120 lines, -51 lines) Patch
M src/arm/builtins-arm.cc View 2 chunks +18 lines, -0 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 1 2 chunks +15 lines, -0 lines 0 comments Download
M src/objects.h View 1 2 2 chunks +29 lines, -1 line 0 comments Download
M src/x64/builtins-x64.cc View 1 2 chunks +15 lines, -0 lines 0 comments Download
M test/es5conform/es5conform.status View 2 chunks +1 line, -50 lines 0 comments Download
M test/mjsunit/strict-mode.js View 1 chunk +42 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Martin Maly
In strict mode, "this" is passed unchanged through calls to Function.prototype.call and Function.prototype.apply. There will ...
9 years, 10 months ago (2011-02-15 05:14:00 UTC) #1
Mads Ager (chromium)
LGTM http://codereview.chromium.org/6524006/diff/1/src/objects.h File src/objects.h (right): http://codereview.chromium.org/6524006/diff/1/src/objects.h#newcode4390 src/objects.h:4390: public: I would rather make Builtins a friend ...
9 years, 10 months ago (2011-02-15 08:09:31 UTC) #2
Lasse Reichstein
LGTM. This will also allow us to close issue http://code.google.com/p/v8/issues/detail?id=981 http://codereview.chromium.org/6524006/diff/1/src/ia32/builtins-ia32.cc File src/ia32/builtins-ia32.cc (right): http://codereview.chromium.org/6524006/diff/1/src/ia32/builtins-ia32.cc#newcode752 ...
9 years, 10 months ago (2011-02-15 08:46:55 UTC) #3
Mads Ager (chromium)
http://codereview.chromium.org/6524006/diff/1/src/ia32/builtins-ia32.cc File src/ia32/builtins-ia32.cc (right): http://codereview.chromium.org/6524006/diff/1/src/ia32/builtins-ia32.cc#newcode752 src/ia32/builtins-ia32.cc:752: kSmiTagSize))); On 2011/02/15 08:46:55, Lasse Reichstein wrote: > You ...
9 years, 10 months ago (2011-02-15 08:50:12 UTC) #4
Martin Maly
9 years, 10 months ago (2011-02-15 19:18:43 UTC) #5
Made the changes. I like the byte operations so I went with that, the math to
calculate which byte and which bit within it is in object.h, close to where the
smi packing for 64 bit is explained (it also accounts for smi tag). The codegen
looks much cleaner.

Sorry about the presubmit.

Martin

http://codereview.chromium.org/6524006/diff/1/src/ia32/builtins-ia32.cc
File src/ia32/builtins-ia32.cc (right):

http://codereview.chromium.org/6524006/diff/1/src/ia32/builtins-ia32.cc#newco...
src/ia32/builtins-ia32.cc:752: kSmiTagSize)));
On 2011/02/15 08:50:12, Mads Ager wrote:
> On 2011/02/15 08:46:55, Lasse Reichstein wrote:
> > You can test directly against memory, without loading into ecx first, i.e.,
> >  test(FieldOperand(ecx, SharedFunctionInfo::kCompilerHintsOffset),
> > Immediate(...));
> > 
> > You might also want to use a byte-test
> >  ASSERT_EQ(8, SharedFunctionInfo::kStrictModeFunction);
> >  test_b(FieldOperand(ecx, ... + 1), Immediate((1 << (...)) >> 8);
> > It would allow an 8-bit immediate instead of a 32-bit one.
> > (Ditto for X64, with the appropriate differences for encoding).
> 
> If you do use the byte version, please introduce some named constants to use
in
> the immediate to make it readable. :-)

Done.

http://codereview.chromium.org/6524006/diff/1/src/objects.h
File src/objects.h (right):

http://codereview.chromium.org/6524006/diff/1/src/objects.h#newcode4390
src/objects.h:4390: public:
On 2011/02/15 08:09:31, Mads Ager wrote:
> I would rather make Builtins a friend or make them all public. 

Done.

http://codereview.chromium.org/6524006/diff/4001/src/objects.h#newcode4391
src/objects.h:4391: // Used from builtins-<arch>.cc
Generate_Function(Call/Apply).
Turns out similar trick for byte-wide operations is used for kConstructionCount.
I followed that for endian-ness and while I was at it, included the smi shifting
here, in the proximity of the comment that explains the 64 bit packing.
The codegen looks quite clean this way.

Powered by Google App Engine
This is Rietveld 408576698