Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: src/harmony-typedarray.js

Issue 1162043008: Revert of Implement %TypedArray%.prototype.{reduce,reduceRight} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/array.js ('k') | src/prologue.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 InnerArrayEvery = from.InnerArrayEvery; 57 InnerArrayEvery = from.InnerArrayEvery;
58 InnerArrayFill = from.InnerArrayFill; 58 InnerArrayFill = from.InnerArrayFill;
59 InnerArrayFilter = from.InnerArrayFilter; 59 InnerArrayFilter = from.InnerArrayFilter;
60 InnerArrayFind = from.InnerArrayFind; 60 InnerArrayFind = from.InnerArrayFind;
61 InnerArrayFindIndex = from.InnerArrayFindIndex; 61 InnerArrayFindIndex = from.InnerArrayFindIndex;
62 InnerArrayForEach = from.InnerArrayForEach; 62 InnerArrayForEach = from.InnerArrayForEach;
63 InnerArrayIndexOf = from.InnerArrayIndexOf; 63 InnerArrayIndexOf = from.InnerArrayIndexOf;
64 InnerArrayJoin = from.InnerArrayJoin; 64 InnerArrayJoin = from.InnerArrayJoin;
65 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf; 65 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf;
66 InnerArrayMap = from.InnerArrayMap; 66 InnerArrayMap = from.InnerArrayMap;
67 InnerArrayReduce = from.InnerArrayReduce;
68 InnerArrayReduceRight = from.InnerArrayReduceRight;
69 InnerArrayReverse = from.InnerArrayReverse; 67 InnerArrayReverse = from.InnerArrayReverse;
70 InnerArraySome = from.InnerArraySome; 68 InnerArraySome = from.InnerArraySome;
71 InnerArraySort = from.InnerArraySort; 69 InnerArraySort = from.InnerArraySort;
72 InnerArrayToLocaleString = from.InnerArrayToLocaleString; 70 InnerArrayToLocaleString = from.InnerArrayToLocaleString;
73 IsNaN = from.IsNaN; 71 IsNaN = from.IsNaN;
74 }); 72 });
75 73
76 // ------------------------------------------------------------------- 74 // -------------------------------------------------------------------
77 75
78 function ConstructTypedArray(constructor, array) { 76 function ConstructTypedArray(constructor, array) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 258
261 // ES6 section 22.2.3.27 259 // ES6 section 22.2.3.27
262 function TypedArrayToLocaleString() { 260 function TypedArrayToLocaleString() {
263 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 261 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
264 262
265 var length = %_TypedArrayGetLength(this); 263 var length = %_TypedArrayGetLength(this);
266 264
267 return InnerArrayToLocaleString(this, length); 265 return InnerArrayToLocaleString(this, length);
268 } 266 }
269 267
270
271 // ES6 section 22.2.3.28 268 // ES6 section 22.2.3.28
272 function TypedArrayToString() { 269 function TypedArrayToString() {
273 return %_CallFunction(this, ArrayToString); 270 return %_CallFunction(this, ArrayToString);
274 } 271 }
275 272
276
277 // ES6 section 22.2.3.14 273 // ES6 section 22.2.3.14
278 function TypedArrayJoin(separator) { 274 function TypedArrayJoin(separator) {
279 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 275 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
280 276
281 var length = %_TypedArrayGetLength(this); 277 var length = %_TypedArrayGetLength(this);
282 278
283 return InnerArrayJoin(separator, this, length); 279 return InnerArrayJoin(separator, this, length);
284 } 280 }
285 281
286 282
287 // ES6 draft 07-15-13, section 22.2.3.19
288 function TypedArrayReduce(callback, current) {
289 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
290
291 var length = %_TypedArrayGetLength(this);
292 return InnerArrayReduce(callback, current, this, length,
293 %_ArgumentsLength());
294 }
295 %FunctionSetLength(TypedArrayReduce, 1);
296
297
298 // ES6 draft 07-15-13, section 22.2.3.19
299 function TypedArrayReduceRight(callback, current) {
300 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
301
302 var length = %_TypedArrayGetLength(this);
303 return InnerArrayReduceRight(callback, current, this, length,
304 %_ArgumentsLength());
305 }
306 %FunctionSetLength(TypedArrayReduceRight, 1);
307
308
309 // ES6 draft 08-24-14, section 22.2.2.2 283 // ES6 draft 08-24-14, section 22.2.2.2
310 function TypedArrayOf() { 284 function TypedArrayOf() {
311 var length = %_ArgumentsLength(); 285 var length = %_ArgumentsLength();
312 var array = new this(length); 286 var array = new this(length);
313 for (var i = 0; i < length; i++) { 287 for (var i = 0; i < length; i++) {
314 array[i] = %_Arguments(i); 288 array[i] = %_Arguments(i);
315 } 289 }
316 return array; 290 return array;
317 } 291 }
318 292
(...skipping 20 matching lines...) Expand all
339 "every", TypedArrayEvery, 313 "every", TypedArrayEvery,
340 "fill", TypedArrayFill, 314 "fill", TypedArrayFill,
341 "filter", TypedArrayFilter, 315 "filter", TypedArrayFilter,
342 "find", TypedArrayFind, 316 "find", TypedArrayFind,
343 "findIndex", TypedArrayFindIndex, 317 "findIndex", TypedArrayFindIndex,
344 "indexOf", TypedArrayIndexOf, 318 "indexOf", TypedArrayIndexOf,
345 "join", TypedArrayJoin, 319 "join", TypedArrayJoin,
346 "lastIndexOf", TypedArrayLastIndexOf, 320 "lastIndexOf", TypedArrayLastIndexOf,
347 "forEach", TypedArrayForEach, 321 "forEach", TypedArrayForEach,
348 "map", TypedArrayMap, 322 "map", TypedArrayMap,
349 "reduce", TypedArrayReduce,
350 "reduceRight", TypedArrayReduceRight,
351 "reverse", TypedArrayReverse, 323 "reverse", TypedArrayReverse,
352 "some", TypedArraySome, 324 "some", TypedArraySome,
353 "sort", TypedArraySort, 325 "sort", TypedArraySort,
354 "toString", TypedArrayToString, 326 "toString", TypedArrayToString,
355 "toLocaleString", TypedArrayToLocaleString 327 "toLocaleString", TypedArrayToLocaleString
356 ]); 328 ]);
357 endmacro 329 endmacro
358 330
359 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) 331 TYPED_ARRAYS(EXTEND_TYPED_ARRAY)
360 332
361 }) 333 })
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698