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

Unified Diff: src/harmony-typedarray.js

Issue 1136663005: Implement %TypedArray%.{fill,find,findIndex} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moving declarations 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/harmony-array.js ('k') | test/mjsunit/harmony/typedarray-fill.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 c33e08b93ce3bcee4aa04429e407024fb4c04b07..3c4c4a40fedd69f97bc46813fd624edcf3f93f7b 100644
--- a/src/harmony-typedarray.js
+++ b/src/harmony-typedarray.js
@@ -59,6 +59,37 @@ function TypedArrayForEach(f, receiver) {
}
%FunctionSetLength(TypedArrayForEach, 1);
+// ES6 draft 04-05-14 section 22.2.3.8
+function TypedArrayFill(value, start , end) {
+ if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
+
+ var length = %_TypedArrayGetLength(this);
+
+ return $innerArrayFill(value, start, end, this, length);
+}
+%FunctionSetLength(TypedArrayFill, 1);
+
+// ES6 draft 07-15-13, section 22.2.3.10
+function TypedArrayFind(predicate, thisArg) {
+ if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
+
+ var length = %_TypedArrayGetLength(this);
+
+ return $innerArrayFind(predicate, thisArg, this, length);
+}
+%FunctionSetLength(TypedArrayFind, 1);
+
+// ES6 draft 07-15-13, section 22.2.3.11
+function TypedArrayFindIndex(predicate, thisArg) {
+ if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
+
+ var length = %_TypedArrayGetLength(this);
+
+ return $innerArrayFindIndex(predicate, thisArg, this, length);
+}
+%FunctionSetLength(TypedArrayFindIndex, 1);
+
+
// ES6 draft 08-24-14, section 22.2.2.2
function TypedArrayOf() {
var length = %_ArgumentsLength();
@@ -79,7 +110,10 @@ macro EXTEND_TYPED_ARRAY(NAME)
$installFunctions(GlobalNAME.prototype, DONT_ENUM, [
"copyWithin", TypedArrayCopyWithin,
"every", TypedArrayEvery,
- "forEach", TypedArrayForEach
+ "forEach", TypedArrayForEach,
+ "find", TypedArrayFind,
+ "findIndex", TypedArrayFindIndex,
+ "fill", TypedArrayFill
]);
endmacro
« no previous file with comments | « src/harmony-array.js ('k') | test/mjsunit/harmony/typedarray-fill.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698