| 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, exports) { | 5 (function(global, exports) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 endmacro | 22 endmacro |
| 23 | 23 |
| 24 macro DECLARE_GLOBALS(NAME) | 24 macro DECLARE_GLOBALS(NAME) |
| 25 var GlobalNAME = global.NAME; | 25 var GlobalNAME = global.NAME; |
| 26 endmacro | 26 endmacro |
| 27 | 27 |
| 28 TYPED_ARRAYS(DECLARE_GLOBALS) | 28 TYPED_ARRAYS(DECLARE_GLOBALS) |
| 29 | 29 |
| 30 // ------------------------------------------------------------------- | 30 // ------------------------------------------------------------------- |
| 31 | 31 |
| 32 function TypedArrayCopyWithin(target, start, end) { |
| 33 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 34 |
| 35 var length = %_TypedArrayGetLength(this); |
| 36 |
| 37 // TODO(dehrenberg): Replace with a memcpy for better performance |
| 38 return $innerArrayCopyWithin(target, start, end, this, length); |
| 39 } |
| 40 %FunctionSetLength(TypedArrayCopyWithin, 2); |
| 41 |
| 32 // ES6 draft 05-05-15, section 22.2.3.7 | 42 // ES6 draft 05-05-15, section 22.2.3.7 |
| 33 function TypedArrayEvery(f, receiver) { | 43 function TypedArrayEvery(f, receiver) { |
| 34 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 44 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 35 | 45 |
| 36 var length = %_TypedArrayGetLength(this); | 46 var length = %_TypedArrayGetLength(this); |
| 37 | 47 |
| 38 return $innerArrayEvery(f, receiver, this, length); | 48 return $innerArrayEvery(f, receiver, this, length); |
| 39 } | 49 } |
| 40 %FunctionSetLength(TypedArrayEvery, 1); | 50 %FunctionSetLength(TypedArrayEvery, 1); |
| 41 | 51 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 } | 70 } |
| 61 | 71 |
| 62 macro EXTEND_TYPED_ARRAY(NAME) | 72 macro EXTEND_TYPED_ARRAY(NAME) |
| 63 // Set up non-enumerable functions on the object. | 73 // Set up non-enumerable functions on the object. |
| 64 $installFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ | 74 $installFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ |
| 65 "of", TypedArrayOf | 75 "of", TypedArrayOf |
| 66 ]); | 76 ]); |
| 67 | 77 |
| 68 // Set up non-enumerable functions on the prototype object. | 78 // Set up non-enumerable functions on the prototype object. |
| 69 $installFunctions(GlobalNAME.prototype, DONT_ENUM, [ | 79 $installFunctions(GlobalNAME.prototype, DONT_ENUM, [ |
| 80 "copyWithin", TypedArrayCopyWithin, |
| 70 "every", TypedArrayEvery, | 81 "every", TypedArrayEvery, |
| 71 "forEach", TypedArrayForEach | 82 "forEach", TypedArrayForEach |
| 72 ]); | 83 ]); |
| 73 endmacro | 84 endmacro |
| 74 | 85 |
| 75 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 86 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
| 76 | 87 |
| 77 }) | 88 }) |
| OLD | NEW |