Reviewers: Jakob,

Description:
Fix handling of this in Array.prototype.concat method.

[email protected]
BUG=v8:2080
TEST=test262/15.4.4.4-5-c-i-1


Please review this at https://chromiumcodereview.appspot.com/10095006/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/array.js
  M test/test262/test262.status


Index: src/array.js
diff --git a/src/array.js b/src/array.js
index daa75d5753c1bdb0c1659ae5436978501adc7291..4295ba5794e1933b4a9be5fe45c31ceb53578ccf 100644
--- a/src/array.js
+++ b/src/array.js
@@ -465,15 +465,19 @@ function ArrayPush() {
 }


+// Returns an array containing the array elements of the object followed
+// by the array elements of each argument in order. See ECMA-262,
+// section 15.4.4.7.
 function ArrayConcat(arg1) {  // length == 1
   if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
     throw MakeTypeError("called_on_null_or_undefined",
                         ["Array.prototype.concat"]);
   }

+  var array = ToObject(this);
   var arg_count = %_ArgumentsLength();
   var arrays = new InternalArray(1 + arg_count);
-  arrays[0] = this;
+  arrays[0] = array;
   for (var i = 0; i < arg_count; i++) {
     arrays[i + 1] = %_Arguments(i);
   }
Index: test/test262/test262.status
diff --git a/test/test262/test262.status b/test/test262/test262.status
index 0a4b2ca1a480668a03c2dfe52907552b8eedec99..d405d211d106f25332b127979dd608aaab256296 100644
--- a/test/test262/test262.status
+++ b/test/test262/test262.status
@@ -35,7 +35,6 @@ S15.12.2_A1: FAIL

 # Not yet analyzed.
 15.10.4.1-5: FAIL
-15.4.4.4-5-c-i-1: FAIL

 # V8 Bug: http://code.google.com/p/v8/issues/detail?id=691
 11.2.3-3_3: FAIL


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

Reply via email to