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

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: ia32, arm and arm64 ports. Misc cleanups. Created 5 years, 4 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
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index af3dbd701ebac2f756dde8ff379af2c5efc9370c..5c74b7f8198ab8fcd9d548fd05260e6d251fc9e5 100644
--- a/src/array.js
+++ b/src/array.js
@@ -386,7 +386,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);
@@ -903,7 +903,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)) {
@@ -1195,7 +1195,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;
@@ -1235,7 +1235,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;
@@ -1268,7 +1268,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;
@@ -1305,7 +1305,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;
@@ -1339,7 +1339,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;
@@ -1503,7 +1503,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);
}
@@ -1546,7 +1546,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') | src/execution.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698