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

Unified Diff: src/harmony-typedarray.js

Issue 1143833002: Revert of Implement %TypedArray%.prototype.{map,filter,some,reduce,reduceRight} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/array.js ('k') | test/mjsunit/harmony/typedarray-iteration.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-typedarray.js
diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js
index b1115f4fb4c953ff5ec24d0b15f94e1e538a645a..90679e0c1fe1afffb6b6b7115e93719e02d7b0c1 100644
--- a/src/harmony-typedarray.js
+++ b/src/harmony-typedarray.js
@@ -30,28 +30,6 @@
// -------------------------------------------------------------------
-function ConstructTypedArray(constructor, array) {
- // TODO(littledan): This is an approximation of the spec, which requires
- // that only real TypedArray classes should be accepted (22.2.2.1.1)
- if (!IS_SPEC_OBJECT(constructor) || IS_UNDEFINED(constructor.prototype) ||
- !%HasOwnProperty(constructor.prototype, "BYTES_PER_ELEMENT")) {
- throw MakeTypeError(kNotTypedArray);
- }
-
- // TODO(littledan): The spec requires that, rather than directly calling
- // the constructor, a TypedArray is created with the proper proto and
- // underlying size and element size, and elements are put in one by one.
- // By contrast, this would allow subclasses to make a radically different
- // constructor with different semantics.
- return new constructor(array);
-}
-
-function ConstructTypedArrayLike(typedArray, arrayContents) {
- // TODO(littledan): The spec requires that we actuallly use
- // typedArray.constructor[Symbol.species] (bug v8:4093)
- return new typedArray.constructor(arrayContents);
-}
-
function TypedArrayCopyWithin(target, start, end) {
if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
@@ -83,7 +61,7 @@
%FunctionSetLength(TypedArrayForEach, 1);
// ES6 draft 04-05-14 section 22.2.3.8
-function TypedArrayFill(value, start, end) {
+function TypedArrayFill(value, start , end) {
if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
var length = %_TypedArrayGetLength(this);
@@ -91,16 +69,6 @@
return $innerArrayFill(value, start, end, this, length);
}
%FunctionSetLength(TypedArrayFill, 1);
-
-// ES6 draft 07-15-13, section 22.2.3.9
-function TypedArrayFilter(predicate, thisArg) {
- if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
-
- var length = %_TypedArrayGetLength(this);
- var array = $innerArrayFilter(predicate, thisArg, this, length);
- return ConstructTypedArrayLike(this, array);
-}
-%FunctionSetLength(TypedArrayFilter, 1);
// ES6 draft 07-15-13, section 22.2.3.10
function TypedArrayFind(predicate, thisArg) {
@@ -121,52 +89,6 @@
return $innerArrayFindIndex(predicate, thisArg, this, length);
}
%FunctionSetLength(TypedArrayFindIndex, 1);
-
-
-// ES6 draft 07-15-13, section 22.2.3.18
-function TypedArrayMap(predicate, thisArg) {
- if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
-
- // TODO(littledan): Preallocate rather than making an intermediate
- // array, for better performance.
- var length = %_TypedArrayGetLength(this);
- var array = $innerArrayMap(predicate, thisArg, this, length);
- return ConstructTypedArrayLike(this, array);
-}
-%FunctionSetLength(TypedArrayMap, 1);
-
-
-// ES6 draft 07-15-13, section 22.2.3.19
-function TypedArrayReduce(callback, current) {
- if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
-
- var length = %_TypedArrayGetLength(this);
- return $innerArrayReduce(callback, current, this, length,
- %_ArgumentsLength());
-}
-%FunctionSetLength(TypedArrayReduce, 1);
-
-
-// ES6 draft 07-15-13, section 22.2.3.19
-function TypedArrayReduceRight(callback, current) {
- if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
-
- var length = %_TypedArrayGetLength(this);
- return $innerArrayReduceRight(callback, current, this, length,
- %_ArgumentsLength());
-}
-%FunctionSetLength(TypedArrayReduceRight, 1);
-
-
-// ES6 draft 05-05-15, section 22.2.3.24
-function TypedArraySome(f, receiver) {
- if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
-
- var length = %_TypedArrayGetLength(this);
-
- return $innerArraySome(f, receiver, this, length);
-}
-%FunctionSetLength(TypedArraySome, 1);
// ES6 draft 08-24-14, section 22.2.2.2
@@ -215,15 +137,10 @@
$installFunctions(GlobalNAME.prototype, DONT_ENUM, [
"copyWithin", TypedArrayCopyWithin,
"every", TypedArrayEvery,
- "fill", TypedArrayFill,
- "filter", TypedArrayFilter,
+ "forEach", TypedArrayForEach,
"find", TypedArrayFind,
"findIndex", TypedArrayFindIndex,
- "forEach", TypedArrayForEach,
- "map", TypedArrayMap,
- "reduce", TypedArrayReduce,
- "reduceRight", TypedArrayReduceRight,
- "some", TypedArraySome
+ "fill", TypedArrayFill
]);
endmacro
« no previous file with comments | « src/array.js ('k') | test/mjsunit/harmony/typedarray-iteration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698