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

Unified Diff: src/harmony-array.js

Issue 1116003005: Remove GetDefaultReceiver, pass in undefined to sloppy-mode functions instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make sure it does TO_OBJECT Created 5 years, 8 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 | « src/collection.js ('k') | src/harmony-typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-array.js
diff --git a/src/harmony-array.js b/src/harmony-array.js
index b24caff9a9f3cd1129d264cf3f7581ad40a39056..a8b4d2c45ec80c785900f0e99203dd176fbaf4da 100644
--- a/src/harmony-array.js
+++ b/src/harmony-array.js
@@ -83,9 +83,9 @@ function ArrayFind(predicate /* thisArg */) { // length == 1
}
var needs_wrapper = false;
- if (IS_NULL_OR_UNDEFINED(thisArg)) {
- thisArg = %GetDefaultReceiver(predicate) || thisArg;
- } else {
+ if (IS_NULL(thisArg)) {
+ if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED;
+ } else if (!IS_UNDEFINED(thisArg)) {
needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg);
}
@@ -120,9 +120,9 @@ function ArrayFindIndex(predicate /* thisArg */) { // length == 1
}
var needs_wrapper = false;
- if (IS_NULL_OR_UNDEFINED(thisArg)) {
- thisArg = %GetDefaultReceiver(predicate) || thisArg;
- } else {
+ if (IS_NULL(thisArg)) {
+ if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED;
+ } else if (!IS_UNDEFINED(thisArg)) {
needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg);
}
@@ -190,10 +190,12 @@ function ArrayFrom(arrayLike, mapfn, receiver) {
if (mapping) {
if (!IS_SPEC_FUNCTION(mapfn)) {
throw MakeTypeError(kCalledNonCallable, mapfn);
- } else if (IS_NULL_OR_UNDEFINED(receiver)) {
- receiver = %GetDefaultReceiver(mapfn) || receiver;
- } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(mapfn)) {
- receiver = ToObject(receiver);
+ } else if (%IsSloppyModeFunction(mapfn)) {
+ if (IS_NULL(receiver)) {
+ receiver = UNDEFINED;
+ } else if (!IS_UNDEFINED(receiver)) {
+ receiver = TO_OBJECT_INLINE(receiver);
+ }
}
}
« no previous file with comments | « src/collection.js ('k') | src/harmony-typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698