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

Unified Diff: src/harmony-array.js

Issue 1325573004: [runtime] Replace many buggy uses of %_CallFunction with %_Call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address feedback. Created 5 years, 3 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/full-codegen/x64/full-codegen-x64.cc ('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 779b67a80356bc4286a49f7f408183fac7d41f65..705adcd06a30339082d8138c0d3bb302904276d5 100644
--- a/src/harmony-array.js
+++ b/src/harmony-array.js
@@ -95,17 +95,9 @@ function InnerArrayFind(predicate, thisArg, array, length) {
throw MakeTypeError(kCalledNonCallable, predicate);
}
- var needs_wrapper = false;
- if (IS_NULL(thisArg)) {
- if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED;
- } else if (!IS_UNDEFINED(thisArg)) {
- needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg);
- }
-
for (var i = 0; i < length; i++) {
var element = array[i];
- var newThisArg = needs_wrapper ? TO_OBJECT(thisArg) : thisArg;
- if (%_CallFunction(newThisArg, element, i, array, predicate)) {
+ if (%_Call(predicate, thisArg, element, i, array)) {
return element;
}
}
@@ -128,17 +120,9 @@ function InnerArrayFindIndex(predicate, thisArg, array, length) {
throw MakeTypeError(kCalledNonCallable, predicate);
}
- var needs_wrapper = false;
- if (IS_NULL(thisArg)) {
- if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED;
- } else if (!IS_UNDEFINED(thisArg)) {
- needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg);
- }
-
for (var i = 0; i < length; i++) {
var element = array[i];
- var newThisArg = needs_wrapper ? TO_OBJECT(thisArg) : thisArg;
- if (%_CallFunction(newThisArg, element, i, array, predicate)) {
+ if (%_Call(predicate, thisArg, element, i, array)) {
return i;
}
}
@@ -212,12 +196,6 @@ function ArrayFrom(arrayLike, mapfn, receiver) {
if (mapping) {
if (!IS_CALLABLE(mapfn)) {
throw MakeTypeError(kCalledNonCallable, mapfn);
- } else if (%IsSloppyModeFunction(mapfn)) {
- if (IS_NULL(receiver)) {
- receiver = UNDEFINED;
- } else if (!IS_UNDEFINED(receiver)) {
- receiver = TO_OBJECT(receiver);
- }
}
}
@@ -247,7 +225,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) {
nextValue = next.value;
if (mapping) {
- mappedValue = %_CallFunction(receiver, nextValue, k, mapfn);
+ mappedValue = %_Call(mapfn, receiver, nextValue, k);
} else {
mappedValue = nextValue;
}
@@ -261,7 +239,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) {
for (k = 0; k < len; ++k) {
nextValue = items[k];
if (mapping) {
- mappedValue = %_CallFunction(receiver, nextValue, k, mapfn);
+ mappedValue = %_Call(mapfn, receiver, nextValue, k);
} else {
mappedValue = nextValue;
}
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/harmony-typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698