| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 270 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 271 | 271 |
| 272 var length = %_TypedArrayGetLength(this); | 272 var length = %_TypedArrayGetLength(this); |
| 273 | 273 |
| 274 return InnerArrayToLocaleString(this, length); | 274 return InnerArrayToLocaleString(this, length); |
| 275 } | 275 } |
| 276 | 276 |
| 277 | 277 |
| 278 // ES6 section 22.2.3.28 | 278 // ES6 section 22.2.3.28 |
| 279 function TypedArrayToString() { | 279 function TypedArrayToString() { |
| 280 return %_CallFunction(this, ArrayToString); | 280 return %_Call(ArrayToString, this); |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 // ES6 section 22.2.3.14 | 284 // ES6 section 22.2.3.14 |
| 285 function TypedArrayJoin(separator) { | 285 function TypedArrayJoin(separator) { |
| 286 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 286 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 287 | 287 |
| 288 var length = %_TypedArrayGetLength(this); | 288 var length = %_TypedArrayGetLength(this); |
| 289 | 289 |
| 290 return InnerArrayJoin(separator, this, length); | 290 return InnerArrayJoin(separator, this, length); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 for (var i = 0; i < length; i++) { | 365 for (var i = 0; i < length; i++) { |
| 366 array[i] = %_Arguments(i); | 366 array[i] = %_Arguments(i); |
| 367 } | 367 } |
| 368 return array; | 368 return array; |
| 369 } | 369 } |
| 370 | 370 |
| 371 | 371 |
| 372 function TypedArrayFrom(source, mapfn, thisArg) { | 372 function TypedArrayFrom(source, mapfn, thisArg) { |
| 373 // TODO(littledan): Investigate if there is a receiver which could be | 373 // TODO(littledan): Investigate if there is a receiver which could be |
| 374 // faster to accumulate on than Array, e.g., a TypedVector. | 374 // faster to accumulate on than Array, e.g., a TypedVector. |
| 375 var array = %_CallFunction(GlobalArray, source, mapfn, thisArg, ArrayFrom); | 375 var array = %_Call(ArrayFrom, GlobalArray, source, mapfn, thisArg); |
| 376 return ConstructTypedArray(this, array); | 376 return ConstructTypedArray(this, array); |
| 377 } | 377 } |
| 378 %FunctionSetLength(TypedArrayFrom, 1); | 378 %FunctionSetLength(TypedArrayFrom, 1); |
| 379 | 379 |
| 380 // TODO(littledan): Fix the TypedArray proto chain (bug v8:4085). | 380 // TODO(littledan): Fix the TypedArray proto chain (bug v8:4085). |
| 381 macro EXTEND_TYPED_ARRAY(NAME) | 381 macro EXTEND_TYPED_ARRAY(NAME) |
| 382 // Set up non-enumerable functions on the object. | 382 // Set up non-enumerable functions on the object. |
| 383 utils.InstallFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ | 383 utils.InstallFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ |
| 384 "from", TypedArrayFrom, | 384 "from", TypedArrayFrom, |
| 385 "of", TypedArrayOf | 385 "of", TypedArrayOf |
| (...skipping 19 matching lines...) Expand all Loading... |
| 405 "some", TypedArraySome, | 405 "some", TypedArraySome, |
| 406 "sort", TypedArraySort, | 406 "sort", TypedArraySort, |
| 407 "toString", TypedArrayToString, | 407 "toString", TypedArrayToString, |
| 408 "toLocaleString", TypedArrayToLocaleString | 408 "toLocaleString", TypedArrayToLocaleString |
| 409 ]); | 409 ]); |
| 410 endmacro | 410 endmacro |
| 411 | 411 |
| 412 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 412 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
| 413 | 413 |
| 414 }) | 414 }) |
| OLD | NEW |