Index: src/js/array.js |
diff --git a/src/js/array.js b/src/js/array.js |
index ddcc0e3150e89e590e8798971a8af8dc56ef8d5c..188f21c41ef250c5be2ef4fd7df5e0e2febc1e6e 100644 |
--- a/src/js/array.js |
+++ b/src/js/array.js |
@@ -1000,57 +1000,6 @@ function ArraySort(comparefn) { |
return InnerArraySort(array, length, comparefn); |
} |
- |
-// The following functions cannot be made efficient on sparse arrays while |
-// preserving the semantics, since the calls to the receiver function can add |
-// or delete elements from the array. |
-function InnerArrayFilter(f, receiver, array, length, result) { |
- var result_length = 0; |
- for (var i = 0; i < length; i++) { |
- if (i in array) { |
- var element = array[i]; |
- if (%_Call(f, receiver, element, i, array)) { |
- %CreateDataProperty(result, result_length, element); |
- result_length++; |
- } |
- } |
- } |
- return result; |
-} |
- |
- |
- |
-function ArrayFilter(f, receiver) { |
- CHECK_OBJECT_COERCIBLE(this, "Array.prototype.filter"); |
- |
- // Pull out the length so that modifications to the length in the |
- // loop will not affect the looping and side effects are visible. |
- var array = TO_OBJECT(this); |
- var length = TO_LENGTH(array.length); |
- if (!IS_CALLABLE(f)) throw %make_type_error(kCalledNonCallable, f); |
- var result = ArraySpeciesCreate(array, 0); |
- return InnerArrayFilter(f, receiver, array, length, result); |
-} |
- |
-function ArrayMap(f, receiver) { |
- CHECK_OBJECT_COERCIBLE(this, "Array.prototype.map"); |
- |
- // Pull out the length so that modifications to the length in the |
- // loop will not affect the looping and side effects are visible. |
- var array = TO_OBJECT(this); |
- var length = TO_LENGTH(array.length); |
- if (!IS_CALLABLE(f)) throw %make_type_error(kCalledNonCallable, f); |
- var result = ArraySpeciesCreate(array, length); |
- for (var i = 0; i < length; i++) { |
- if (i in array) { |
- var element = array[i]; |
- %CreateDataProperty(result, i, %_Call(f, receiver, element, i, array)); |
- } |
- } |
- return result; |
-} |
- |
- |
function ArrayLastIndexOf(element, index) { |
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.lastIndexOf"); |
@@ -1381,8 +1330,6 @@ utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ |
"slice", getFunction("slice", ArraySlice, 2), |
"splice", getFunction("splice", ArraySplice, 2), |
"sort", getFunction("sort", ArraySort), |
- "filter", getFunction("filter", ArrayFilter, 1), |
- "map", getFunction("map", ArrayMap, 1), |
"indexOf", getFunction("indexOf", null, 1), |
"lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), |
"copyWithin", getFunction("copyWithin", ArrayCopyWithin, 2), |
@@ -1439,7 +1386,6 @@ utils.Export(function(to) { |
to.ArrayPush = ArrayPush; |
to.ArrayToString = ArrayToString; |
to.ArrayValues = IteratorFunctions.values, |
- to.InnerArrayFilter = InnerArrayFilter; |
to.InnerArrayFind = InnerArrayFind; |
to.InnerArrayFindIndex = InnerArrayFindIndex; |
to.InnerArrayJoin = InnerArrayJoin; |