Revision: 9709
Author:   [email protected]
Date:     Wed Oct 19 06:56:18 2011
Log:      Fix handling Function.apply for non-array arguments.

[email protected]
TEST=mjsunit/apply,test262

Review URL: http://codereview.chromium.org/8342034
http://code.google.com/p/v8/source/detail?r=9709

Modified:
 /branches/bleeding_edge/src/runtime.js
 /branches/bleeding_edge/test/mjsunit/apply.js
 /branches/bleeding_edge/test/test262/test262.status

=======================================
--- /branches/bleeding_edge/src/runtime.js      Mon Oct 17 05:44:16 2011
+++ /branches/bleeding_edge/src/runtime.js      Wed Oct 19 06:56:18 2011
@@ -469,7 +469,7 @@
   }

   // 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', []);
   }

=======================================
--- /branches/bleeding_edge/test/mjsunit/apply.js       Fri Apr 15 04:35:36 2011
+++ /branches/bleeding_edge/test/mjsunit/apply.js       Wed Oct 19 06:56:18 2011
@@ -190,3 +190,10 @@
     "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");
=======================================
--- /branches/bleeding_edge/test/test262/test262.status Wed Oct 19 06:44:29 2011 +++ /branches/bleeding_edge/test/test262/test262.status Wed Oct 19 06:56:18 2011
@@ -448,15 +448,6 @@
# '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

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to