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

Unified Diff: src/array.js

Issue 8347034: Fix handling of non-object receivers for array builtins. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-100702.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index e1d7c2064e53a47be8b3d113d38858a20fdc522f..74868e746ba07cd61d0c33cd2061f2111c6e21b5 100644
--- a/src/array.js
+++ b/src/array.js
@@ -1013,6 +1013,8 @@ function ArrayFilter(f, receiver) {
}
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
+ } else if (!IS_SPEC_OBJECT(receiver)) {
+ receiver = ToObject(receiver);
}
var result = [];
@@ -1045,6 +1047,8 @@ function ArrayForEach(f, receiver) {
}
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
+ } else if (!IS_SPEC_OBJECT(receiver)) {
+ receiver = ToObject(receiver);
}
for (var i = 0; i < length; i++) {
@@ -1074,6 +1078,8 @@ function ArraySome(f, receiver) {
}
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
+ } else if (!IS_SPEC_OBJECT(receiver)) {
+ receiver = ToObject(receiver);
}
for (var i = 0; i < length; i++) {
@@ -1102,6 +1108,8 @@ function ArrayEvery(f, receiver) {
}
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
+ } else if (!IS_SPEC_OBJECT(receiver)) {
+ receiver = ToObject(receiver);
}
for (var i = 0; i < length; i++) {
@@ -1129,6 +1137,8 @@ function ArrayMap(f, receiver) {
}
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
+ } else if (!IS_SPEC_OBJECT(receiver)) {
+ receiver = ToObject(receiver);
}
var result = new $Array();
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-100702.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698