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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // ES6 draft 07-15-13, section 22.2.3.11 | 83 // ES6 draft 07-15-13, section 22.2.3.11 |
84 function TypedArrayFindIndex(predicate, thisArg) { | 84 function TypedArrayFindIndex(predicate, thisArg) { |
85 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 85 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
86 | 86 |
87 var length = %_TypedArrayGetLength(this); | 87 var length = %_TypedArrayGetLength(this); |
88 | 88 |
89 return $innerArrayFindIndex(predicate, thisArg, this, length); | 89 return $innerArrayFindIndex(predicate, thisArg, this, length); |
90 } | 90 } |
91 %FunctionSetLength(TypedArrayFindIndex, 1); | 91 %FunctionSetLength(TypedArrayFindIndex, 1); |
92 | 92 |
| 93 // ES6 draft 05-18-15, section 22.2.3.21 |
| 94 function TypedArrayReverse() { |
| 95 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 96 |
| 97 var length = %_TypedArrayGetLength(this); |
| 98 |
| 99 return $innerArrayReverse(this, length); |
| 100 } |
| 101 |
93 | 102 |
94 // ES6 draft 08-24-14, section 22.2.2.2 | 103 // ES6 draft 08-24-14, section 22.2.2.2 |
95 function TypedArrayOf() { | 104 function TypedArrayOf() { |
96 var length = %_ArgumentsLength(); | 105 var length = %_ArgumentsLength(); |
97 var array = new this(length); | 106 var array = new this(length); |
98 for (var i = 0; i < length; i++) { | 107 for (var i = 0; i < length; i++) { |
99 array[i] = %_Arguments(i); | 108 array[i] = %_Arguments(i); |
100 } | 109 } |
101 return array; | 110 return array; |
102 } | 111 } |
(...skipping 30 matching lines...) Expand all Loading... |
133 "of", TypedArrayOf | 142 "of", TypedArrayOf |
134 ]); | 143 ]); |
135 | 144 |
136 // Set up non-enumerable functions on the prototype object. | 145 // Set up non-enumerable functions on the prototype object. |
137 $installFunctions(GlobalNAME.prototype, DONT_ENUM, [ | 146 $installFunctions(GlobalNAME.prototype, DONT_ENUM, [ |
138 "copyWithin", TypedArrayCopyWithin, | 147 "copyWithin", TypedArrayCopyWithin, |
139 "every", TypedArrayEvery, | 148 "every", TypedArrayEvery, |
140 "forEach", TypedArrayForEach, | 149 "forEach", TypedArrayForEach, |
141 "find", TypedArrayFind, | 150 "find", TypedArrayFind, |
142 "findIndex", TypedArrayFindIndex, | 151 "findIndex", TypedArrayFindIndex, |
143 "fill", TypedArrayFill | 152 "fill", TypedArrayFill, |
| 153 "reverse", TypedArrayReverse |
144 ]); | 154 ]); |
145 endmacro | 155 endmacro |
146 | 156 |
147 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 157 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
148 | 158 |
149 }) | 159 }) |
OLD | NEW |