Fix handling Function.apply for non-array arguments.

R=rossberg@chromium.org
TEST=mjsunit/apply,test262

Review URL: http://codereview.chromium.org/8342034

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9709 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2011-10-19 13:56:18 +00:00
parent 663bc0fb78
commit 67c9a03922
3 changed files with 8 additions and 10 deletions

View File

@ -469,7 +469,7 @@ function APPLY_PREPARE(args) {
}
// Make sure the arguments list has the right type.
if (args != null && !IS_ARRAY(args) && !IS_ARGUMENTS(args)) {
if (args != null && !IS_SPEC_OBJECT(args)) {
throw %MakeTypeError('apply_wrong_args', []);
}

View File

@ -190,3 +190,10 @@ assertEquals("morseper",
"moreseper-prime");
delete(Array.prototype["1"]);
// Check correct handling of non-array argument lists.
assertSame(this, f0.apply(this, {}), "non-array-1");
assertSame(this, f0.apply(this, { length:1 }), "non-array-2");
assertEquals(void 0, f1.apply(this, { length:1 }), "non-array-3");
assertEquals(void 0, f1.apply(this, { 0:"foo" }), "non-array-4");
assertEquals("foo", f1.apply(this, { length:1, 0:"foo" }), "non-array-5");

View File

@ -448,15 +448,6 @@ S15.4.4.3_A2_T1: FAIL_OK
# 'P' which is defined as non-configurable (10.6 [[DefineOwnProperty]] step
# 4)
15.2.3.7-6-a-285: FAIL
# Bug? Strict Mode - 'this' value is a string which cannot be converted to
# wrapper objects when the function is called with an array of arguments
15.3.4.3-1-s: FAIL
# Bug? Strict Mode - 'this' value is a number which cannot be converted to
# wrapper objects when the function is called with an array of arguments
15.3.4.3-2-s: FAIL
# Bug? Strict Mode - 'this' value is a boolean which cannot be converted to
# wrapper objects when the function is called with an array of arguments
15.3.4.3-3-s: FAIL
# Bug? Array.prototype.indexOf - decreasing length of array does not delete
# non-configurable properties
15.4.4.14-9-a-19: FAIL