Reviewers: Mads Ager,

Description:
Undo change from .call to %_CallFunction.

The latter doesn't handle promotion of null/undefined to global object as
receiver for non-strict functions.

Please review this at http://codereview.chromium.org/6615013/

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

Affected files:
  M src/array.js


Index: src/array.js
diff --git a/src/array.js b/src/array.js
index e8767b2ac660b26c8329a124a9822c98ff83cd6e..97ce10dd85e0870e0f644cb7fef4dc475ceb5732 100644
--- a/src/array.js
+++ b/src/array.js
@@ -925,7 +925,7 @@ function ArrayFilter(f, receiver) {
   for (var i = 0; i < length; i++) {
     var current = this[i];
     if (!IS_UNDEFINED(current) || i in this) {
-      if (%_CallFunction(receiver, current, i, this, f)) {
+      if (f.call(receiver, current, i, this)) {
         result[result_length++] = current;
       }
     }
@@ -944,7 +944,7 @@ function ArrayForEach(f, receiver) {
   for (var i = 0; i < length; i++) {
     var current = this[i];
     if (!IS_UNDEFINED(current) || i in this) {
-      %_CallFunction(receiver, current, i, this, f);
+      f.call(receiver, current, i, this);
     }
   }
 }
@@ -962,7 +962,7 @@ function ArraySome(f, receiver) {
   for (var i = 0; i < length; i++) {
     var current = this[i];
     if (!IS_UNDEFINED(current) || i in this) {
-      if (%_CallFunction(receiver, current, i, this, f)) return true;
+      if (f.call(receiver, current, i, this)) return true;
     }
   }
   return false;
@@ -979,7 +979,7 @@ function ArrayEvery(f, receiver) {
   for (var i = 0; i < length; i++) {
     var current = this[i];
     if (!IS_UNDEFINED(current) || i in this) {
-      if (!%_CallFunction(receiver, current, i, this, f)) return false;
+      if (!f.call(receiver, current, i, this)) return false;
     }
   }
   return true;
@@ -997,7 +997,7 @@ function ArrayMap(f, receiver) {
   for (var i = 0; i < length; i++) {
     var current = this[i];
     if (!IS_UNDEFINED(current) || i in this) {
-      accumulator[i] = %_CallFunction(receiver, current, i, this, f);
+      accumulator[i] = f.call(receiver, current, i, this);
     }
   }
   %MoveArrayContents(accumulator, result);


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

Reply via email to