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

Unified Diff: src/array.js

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase again. 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/arm64/lithium-codegen-arm64.cc ('k') | src/bootstrapper.cc » ('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 84c76620326f2973b270efd634594bc8e60e5df2..b413a0cff30f056aec87ef6a9962ef84aa8cad1a 100644
--- a/src/array.js
+++ b/src/array.js
@@ -387,7 +387,7 @@ function ArrayToString() {
array = TO_OBJECT(this);
func = array.join;
}
- if (!IS_SPEC_FUNCTION(func)) {
+ if (!IS_CALLABLE(func)) {
return %_CallFunction(array, ObjectToString);
}
return %_CallFunction(array, func);
@@ -904,7 +904,7 @@ function InnerArraySort(length, comparefn) {
// In-place QuickSort algorithm.
// For short (length <= 22) arrays, insertion sort is used for efficiency.
- if (!IS_SPEC_FUNCTION(comparefn)) {
+ if (!IS_CALLABLE(comparefn)) {
comparefn = function (x, y) {
if (x === y) return 0;
if (%_IsSmi(x) && %_IsSmi(y)) {
@@ -1196,7 +1196,7 @@ function ArraySort(comparefn) {
// preserving the semantics, since the calls to the receiver function can add
// or delete elements from the array.
function InnerArrayFilter(f, receiver, array, length) {
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
+ if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f);
var needs_wrapper = false;
if (IS_NULL(receiver)) {
if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
@@ -1236,7 +1236,7 @@ function ArrayFilter(f, receiver) {
}
function InnerArrayForEach(f, receiver, array, length) {
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
+ if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f);
var needs_wrapper = false;
if (IS_NULL(receiver)) {
if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
@@ -1269,7 +1269,7 @@ function ArrayForEach(f, receiver) {
function InnerArraySome(f, receiver, array, length) {
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
+ if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f);
var needs_wrapper = false;
if (IS_NULL(receiver)) {
if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
@@ -1306,7 +1306,7 @@ function ArraySome(f, receiver) {
function InnerArrayEvery(f, receiver, array, length) {
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
+ if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f);
var needs_wrapper = false;
if (IS_NULL(receiver)) {
if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
@@ -1340,7 +1340,7 @@ function ArrayEvery(f, receiver) {
function InnerArrayMap(f, receiver, array, length) {
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
+ if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f);
var needs_wrapper = false;
if (IS_NULL(receiver)) {
if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
@@ -1504,7 +1504,7 @@ function ArrayLastIndexOf(element, index) {
function InnerArrayReduce(callback, current, array, length, argumentsLength) {
- if (!IS_SPEC_FUNCTION(callback)) {
+ if (!IS_CALLABLE(callback)) {
throw MakeTypeError(kCalledNonCallable, callback);
}
@@ -1547,7 +1547,7 @@ function ArrayReduce(callback, current) {
function InnerArrayReduceRight(callback, current, array, length,
argumentsLength) {
- if (!IS_SPEC_FUNCTION(callback)) {
+ if (!IS_CALLABLE(callback)) {
throw MakeTypeError(kCalledNonCallable, callback);
}
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698