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

Unified Diff: src/harmony-typedarray.js

Issue 1166623004: Implement %TypedArray%.prototype.{toString,toLocaleString,join} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix toString 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') | src/prologue.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 88048b44c9e854cb5d57856b8abf86a4a3694a97..69512ca4b58c1d4b4512db68ea94defef4bcb83e 100644
--- a/src/harmony-typedarray.js
+++ b/src/harmony-typedarray.js
@@ -32,6 +32,7 @@ TYPED_ARRAYS(DECLARE_GLOBALS)
DECLARE_GLOBALS(Array)
var ArrayFrom;
+var ArrayToString;
var InnerArrayCopyWithin;
var InnerArrayEvery;
var InnerArrayFill;
@@ -40,15 +41,18 @@ var InnerArrayFind;
var InnerArrayFindIndex;
var InnerArrayForEach;
var InnerArrayIndexOf;
+var InnerArrayJoin;
var InnerArrayLastIndexOf;
var InnerArrayMap;
var InnerArrayReverse;
var InnerArraySome;
var InnerArraySort;
+var InnerArrayToLocaleString;
var IsNaN;
utils.Import(function(from) {
ArrayFrom = from.ArrayFrom;
+ ArrayToString = from.ArrayToString;
InnerArrayCopyWithin = from.InnerArrayCopyWithin;
InnerArrayEvery = from.InnerArrayEvery;
InnerArrayFill = from.InnerArrayFill;
@@ -57,11 +61,13 @@ utils.Import(function(from) {
InnerArrayFindIndex = from.InnerArrayFindIndex;
InnerArrayForEach = from.InnerArrayForEach;
InnerArrayIndexOf = from.InnerArrayIndexOf;
+ InnerArrayJoin = from.InnerArrayJoin;
InnerArrayLastIndexOf = from.InnerArrayLastIndexOf;
InnerArrayMap = from.InnerArrayMap;
InnerArrayReverse = from.InnerArrayReverse;
InnerArraySome = from.InnerArraySome;
InnerArraySort = from.InnerArraySort;
+ InnerArrayToLocaleString = from.InnerArrayToLocaleString;
IsNaN = from.IsNaN;
});
@@ -250,6 +256,30 @@ function TypedArraySome(f, receiver) {
%FunctionSetLength(TypedArraySome, 1);
+// ES6 section 22.2.3.27
+function TypedArrayToLocaleString() {
+ if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
+
+ var length = %_TypedArrayGetLength(this);
+
+ return InnerArrayToLocaleString(this, length);
+}
+
+// ES6 section 22.2.3.28
+function TypedArrayToString() {
+ return %_CallFunction(this, ArrayToString);
+}
+
+// ES6 section 22.2.3.14
+function TypedArrayJoin(separator) {
+ if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
+
+ var length = %_TypedArrayGetLength(this);
+
+ return InnerArrayJoin(separator, this, length);
+}
+
+
// ES6 draft 08-24-14, section 22.2.2.2
function TypedArrayOf() {
var length = %_ArgumentsLength();
@@ -286,12 +316,15 @@ macro EXTEND_TYPED_ARRAY(NAME)
"find", TypedArrayFind,
"findIndex", TypedArrayFindIndex,
"indexOf", TypedArrayIndexOf,
+ "join", TypedArrayJoin,
"lastIndexOf", TypedArrayLastIndexOf,
"forEach", TypedArrayForEach,
"map", TypedArrayMap,
"reverse", TypedArrayReverse,
"some", TypedArraySome,
- "sort", TypedArraySort
+ "sort", TypedArraySort,
+ "toString", TypedArrayToString,
+ "toLocaleString", TypedArrayToLocaleString
]);
endmacro
« no previous file with comments | « src/array.js ('k') | src/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698