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

Issue 6087011: Draft of ES5 fix to Function.prototype.call and apply (Closed)

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

Description

ES5 fix to Function.prototype.call and Function.prototype.apply to - not wrap values - not pass global object if thisArg is undefined or null This is the first step to fixing bug: http://code.google.com/p/v8/issues/detail?id=981 BUG= TEST=

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -325 lines) Patch
M src/arm/builtins-arm.cc View 2 chunks +9 lines, -97 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 2 chunks +8 lines, -92 lines 0 comments Download
M src/x64/builtins-x64.cc View 2 chunks +9 lines, -87 lines 0 comments Download
M test/mjsunit/apply.js View 1 chunk +7 lines, -7 lines 0 comments Download
M test/mjsunit/arguments-apply.js View 1 chunk +3 lines, -4 lines 0 comments Download
M test/mjsunit/call.js View 1 chunk +7 lines, -7 lines 0 comments Download
M test/mjsunit/compiler/regress-arguments.js View 1 chunk +2 lines, -2 lines 0 comments Download
M test/mjsunit/regress/regress-485.js View 2 chunks +13 lines, -14 lines 0 comments Download
M test/mjsunit/value-wrapper.js View 1 chunk +15 lines, -15 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Martin Maly
This is a draft of first phase of the fix to bug http://code.google.com/p/v8/issues/detail?id=981 where first ...
9 years, 11 months ago (2011-01-05 23:39:09 UTC) #1
Martin Maly
9 years, 11 months ago (2011-01-06 00:20:55 UTC) #2
It is probably worth mentioning the relevant paragraphs in the ES spec.

15.3.4.3 (Function.prototype.apply)
15.3.4.4 (Function.prototype.call)

have changed between ES3 and ES5.

In ES3:
If thisArg is null or undefined, the called function is passed the global object
as the this value.
Otherwise, the called function is passed ToObject(thisArg) as the this value.

In ES5 the algorithm changed to not apply ToObject nor to substitute global
object for null or undefined. The note from the ES5 spec (15.3.4.3 and
15.3.4.4):

NOTE The thisArg value is passed without modification as the this value. This is
a change from Edition 3, where a undefined or null thisArg is replaced with the
global object and ToObject is applied to all other values and that result is
passed as the this value.

Powered by Google App Engine
This is Rietveld 408576698