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

Side by Side Diff: src/js/array.js

Issue 2693753002: Revert of [typedarrays] move %TypedArray%.prototype.copyWithin to C++ (Closed)
Patch Set: Fix merge conflict Created 3 years, 10 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/builtins/builtins-typedarray.cc ('k') | src/js/typedarray.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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, extrasUtils) { 5 (function(global, utils, extrasUtils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1263
1264 // Pull out the length so that side effects are visible before the 1264 // Pull out the length so that side effects are visible before the
1265 // callback function is checked. 1265 // callback function is checked.
1266 var array = TO_OBJECT(this); 1266 var array = TO_OBJECT(this);
1267 var length = TO_LENGTH(array.length); 1267 var length = TO_LENGTH(array.length);
1268 return InnerArrayReduceRight(callback, current, array, length, 1268 return InnerArrayReduceRight(callback, current, array, length,
1269 arguments.length); 1269 arguments.length);
1270 } 1270 }
1271 1271
1272 1272
1273 // ES6 draft 03-17-15, section 22.1.3.3 1273 function InnerArrayCopyWithin(target, start, end, array, length) {
1274 function ArrayCopyWithin(target, start, end) {
1275 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.copyWithin");
1276
1277 var array = TO_OBJECT(this);
1278 var length = TO_LENGTH(array.length);
1279
1280 target = TO_INTEGER(target); 1274 target = TO_INTEGER(target);
1281 var to; 1275 var to;
1282 if (target < 0) { 1276 if (target < 0) {
1283 to = MaxSimple(length + target, 0); 1277 to = MaxSimple(length + target, 0);
1284 } else { 1278 } else {
1285 to = MinSimple(target, length); 1279 to = MinSimple(target, length);
1286 } 1280 }
1287 1281
1288 start = TO_INTEGER(start); 1282 start = TO_INTEGER(start);
1289 var from; 1283 var from;
(...skipping 27 matching lines...) Expand all
1317 } 1311 }
1318 from = from + direction; 1312 from = from + direction;
1319 to = to + direction; 1313 to = to + direction;
1320 count--; 1314 count--;
1321 } 1315 }
1322 1316
1323 return array; 1317 return array;
1324 } 1318 }
1325 1319
1326 1320
1321 // ES6 draft 03-17-15, section 22.1.3.3
1322 function ArrayCopyWithin(target, start, end) {
1323 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.copyWithin");
1324
1325 var array = TO_OBJECT(this);
1326 var length = TO_LENGTH(array.length);
1327
1328 return InnerArrayCopyWithin(target, start, end, array, length);
1329 }
1330
1331
1327 function InnerArrayFind(predicate, thisArg, array, length) { 1332 function InnerArrayFind(predicate, thisArg, array, length) {
1328 if (!IS_CALLABLE(predicate)) { 1333 if (!IS_CALLABLE(predicate)) {
1329 throw %make_type_error(kCalledNonCallable, predicate); 1334 throw %make_type_error(kCalledNonCallable, predicate);
1330 } 1335 }
1331 1336
1332 for (var i = 0; i < length; i++) { 1337 for (var i = 0; i < length; i++) {
1333 var element = array[i]; 1338 var element = array[i];
1334 if (%_Call(predicate, thisArg, element, i, array)) { 1339 if (%_Call(predicate, thisArg, element, i, array)) {
1335 return element; 1340 return element;
1336 } 1341 }
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 1618
1614 // ------------------------------------------------------------------- 1619 // -------------------------------------------------------------------
1615 // Exports 1620 // Exports
1616 1621
1617 utils.Export(function(to) { 1622 utils.Export(function(to) {
1618 to.ArrayFrom = ArrayFrom; 1623 to.ArrayFrom = ArrayFrom;
1619 to.ArrayJoin = ArrayJoin; 1624 to.ArrayJoin = ArrayJoin;
1620 to.ArrayPush = ArrayPush; 1625 to.ArrayPush = ArrayPush;
1621 to.ArrayToString = ArrayToString; 1626 to.ArrayToString = ArrayToString;
1622 to.ArrayValues = IteratorFunctions.values, 1627 to.ArrayValues = IteratorFunctions.values,
1628 to.InnerArrayCopyWithin = InnerArrayCopyWithin;
1623 to.InnerArrayEvery = InnerArrayEvery; 1629 to.InnerArrayEvery = InnerArrayEvery;
1624 to.InnerArrayFill = InnerArrayFill; 1630 to.InnerArrayFill = InnerArrayFill;
1625 to.InnerArrayFilter = InnerArrayFilter; 1631 to.InnerArrayFilter = InnerArrayFilter;
1626 to.InnerArrayFind = InnerArrayFind; 1632 to.InnerArrayFind = InnerArrayFind;
1627 to.InnerArrayFindIndex = InnerArrayFindIndex; 1633 to.InnerArrayFindIndex = InnerArrayFindIndex;
1628 to.InnerArrayForEach = InnerArrayForEach; 1634 to.InnerArrayForEach = InnerArrayForEach;
1629 to.InnerArrayJoin = InnerArrayJoin; 1635 to.InnerArrayJoin = InnerArrayJoin;
1630 to.InnerArrayLastIndexOf = InnerArrayLastIndexOf; 1636 to.InnerArrayLastIndexOf = InnerArrayLastIndexOf;
1631 to.InnerArrayReduce = InnerArrayReduce; 1637 to.InnerArrayReduce = InnerArrayReduce;
1632 to.InnerArrayReduceRight = InnerArrayReduceRight; 1638 to.InnerArrayReduceRight = InnerArrayReduceRight;
(...skipping 10 matching lines...) Expand all
1643 "array_pop", ArrayPop, 1649 "array_pop", ArrayPop,
1644 "array_push", ArrayPush, 1650 "array_push", ArrayPush,
1645 "array_shift", ArrayShift, 1651 "array_shift", ArrayShift,
1646 "array_splice", ArraySplice, 1652 "array_splice", ArraySplice,
1647 "array_slice", ArraySlice, 1653 "array_slice", ArraySlice,
1648 "array_unshift", ArrayUnshift, 1654 "array_unshift", ArrayUnshift,
1649 "array_values_iterator", IteratorFunctions.values, 1655 "array_values_iterator", IteratorFunctions.values,
1650 ]); 1656 ]);
1651 1657
1652 }); 1658 });
OLDNEW
« no previous file with comments | « src/builtins/builtins-typedarray.cc ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698