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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // ES6 draft 05-18-15, section 22.2.3.25 | 208 // ES6 draft 05-18-15, section 22.2.3.25 |
209 function TypedArraySort(comparefn) { | 209 function TypedArraySort(comparefn) { |
210 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 210 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
211 | 211 |
212 var length = %_TypedArrayGetLength(this); | 212 var length = %_TypedArrayGetLength(this); |
213 | 213 |
214 if (IS_UNDEFINED(comparefn)) { | 214 if (IS_UNDEFINED(comparefn)) { |
215 comparefn = TypedArrayComparefn; | 215 comparefn = TypedArrayComparefn; |
216 } | 216 } |
217 | 217 |
218 return %_CallFunction(this, length, comparefn, InnerArraySort); | 218 return InnerArraySort(this, length, comparefn); |
219 } | 219 } |
220 | 220 |
221 | 221 |
222 // ES6 section 22.2.3.13 | 222 // ES6 section 22.2.3.13 |
223 function TypedArrayIndexOf(element, index) { | 223 function TypedArrayIndexOf(element, index) { |
224 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 224 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
225 | 225 |
226 var length = %_TypedArrayGetLength(this); | 226 var length = %_TypedArrayGetLength(this); |
227 | 227 return InnerArrayIndexOf(this, element, index, length); |
228 return %_CallFunction(this, element, index, length, InnerArrayIndexOf); | |
229 } | 228 } |
230 %FunctionSetLength(TypedArrayIndexOf, 1); | 229 %FunctionSetLength(TypedArrayIndexOf, 1); |
231 | 230 |
232 | 231 |
233 // ES6 section 22.2.3.16 | 232 // ES6 section 22.2.3.16 |
234 function TypedArrayLastIndexOf(element, index) { | 233 function TypedArrayLastIndexOf(element, index) { |
235 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 234 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
236 | 235 |
237 var length = %_TypedArrayGetLength(this); | 236 var length = %_TypedArrayGetLength(this); |
238 | 237 |
239 return %_CallFunction(this, element, index, length, | 238 return InnerArrayLastIndexOf(this, element, index, length, |
240 %_ArgumentsLength(), InnerArrayLastIndexOf); | 239 %_ArgumentsLength()); |
241 } | 240 } |
242 %FunctionSetLength(TypedArrayLastIndexOf, 1); | 241 %FunctionSetLength(TypedArrayLastIndexOf, 1); |
243 | 242 |
244 | 243 |
245 // ES6 draft 07-15-13, section 22.2.3.18 | 244 // ES6 draft 07-15-13, section 22.2.3.18 |
246 function TypedArrayMap(predicate, thisArg) { | 245 function TypedArrayMap(predicate, thisArg) { |
247 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 246 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
248 | 247 |
249 // TODO(littledan): Preallocate rather than making an intermediate | 248 // TODO(littledan): Preallocate rather than making an intermediate |
250 // InternalArray, for better performance. | 249 // InternalArray, for better performance. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 "some", TypedArraySome, | 405 "some", TypedArraySome, |
407 "sort", TypedArraySort, | 406 "sort", TypedArraySort, |
408 "toString", TypedArrayToString, | 407 "toString", TypedArrayToString, |
409 "toLocaleString", TypedArrayToLocaleString | 408 "toLocaleString", TypedArrayToLocaleString |
410 ]); | 409 ]); |
411 endmacro | 410 endmacro |
412 | 411 |
413 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 412 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
414 | 413 |
415 }) | 414 }) |
OLD | NEW |