 Chromium Code Reviews
 Chromium Code Reviews Issue 1166623004:
  Implement %TypedArray%.prototype.{toString,toLocaleString,join}  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1166623004:
  Implement %TypedArray%.prototype.{toString,toLocaleString,join}  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/harmony-typedarray.js | 
| diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js | 
| index 88048b44c9e854cb5d57856b8abf86a4a3694a97..00e216c8d672ec8adf18f1acedab34c1cc5af8f2 100644 | 
| --- a/src/harmony-typedarray.js | 
| +++ b/src/harmony-typedarray.js | 
| @@ -40,12 +40,15 @@ var InnerArrayFind; | 
| var InnerArrayFindIndex; | 
| var InnerArrayForEach; | 
| var InnerArrayIndexOf; | 
| +var InnerArrayJoin; | 
| var InnerArrayLastIndexOf; | 
| var InnerArrayMap; | 
| var InnerArrayReverse; | 
| var InnerArraySome; | 
| var InnerArraySort; | 
| +var InnerArrayToLocaleString; | 
| var IsNaN; | 
| +var ObjectToString; | 
| utils.Import(function(from) { | 
| ArrayFrom = from.ArrayFrom; | 
| @@ -57,12 +60,15 @@ 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; | 
| + ObjectToString = from.ObjectToString; | 
| }); | 
| // ------------------------------------------------------------------- | 
| @@ -250,6 +256,38 @@ 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() { | 
| 
adamk
2015/06/02 17:18:20
According to the spec this function doesn't exist:
 | 
| + if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 
| + | 
| + var func = this.join; | 
| + if (!IS_SPEC_FUNCTION(func)) { | 
| + return %_CallFunction(this, ObjectToString); | 
| + } | 
| + return %_CallFunction(this, func); | 
| +} | 
| + | 
| + | 
| +// 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 +324,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 |