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

Side by Side Diff: src/array.js

Issue 1330483003: Adding ElementsAccessor::Concat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-09-01_array_builtins_shift
Patch Set: fixing concat spreadable issues Created 5 years, 3 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 | « no previous file | src/builtins.cc » ('j') | src/builtins.cc » ('J')
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) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 for (var i = 0; i < m; i++) { 515 for (var i = 0; i < m; i++) {
516 array[i+n] = %_Arguments(i); 516 array[i+n] = %_Arguments(i);
517 } 517 }
518 518
519 var new_length = n + m; 519 var new_length = n + m;
520 array.length = new_length; 520 array.length = new_length;
521 return new_length; 521 return new_length;
522 } 522 }
523 523
524 524
525 // Returns an array containing the array elements of the object followed
526 // by the array elements of each argument in order. See ECMA-262,
527 // section 15.4.4.7.
528 function ArrayConcatJS(arg1) { // length == 1 525 function ArrayConcatJS(arg1) { // length == 1
Camillo Bruni 2015/09/04 13:54:55 This is no longer needed, however, I don't know ho
529 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.concat"); 526 return 1
530
531 var array = TO_OBJECT(this);
532 var arg_count = %_ArgumentsLength();
533 var arrays = new InternalArray(1 + arg_count);
534 arrays[0] = array;
535 for (var i = 0; i < arg_count; i++) {
536 arrays[i + 1] = %_Arguments(i);
537 }
538
539 return %ArrayConcat(arrays);
540 } 527 }
541 528
542 529
543 // For implementing reverse() on large, sparse arrays. 530 // For implementing reverse() on large, sparse arrays.
544 function SparseReverse(array, len) { 531 function SparseReverse(array, len) {
545 var keys = GetSortedArrayKeys(array, %GetArrayKeys(array, len)); 532 var keys = GetSortedArrayKeys(array, %GetArrayKeys(array, len));
546 var high_counter = keys.length - 1; 533 var high_counter = keys.length - 1;
547 var low_counter = 0; 534 var low_counter = 0;
548 while (low_counter <= high_counter) { 535 while (low_counter <= high_counter) {
549 var i = keys[low_counter]; 536 var i = keys[low_counter];
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 "array_concat", ArrayConcatJS, 1696 "array_concat", ArrayConcatJS,
1710 "array_pop", ArrayPop, 1697 "array_pop", ArrayPop,
1711 "array_push", ArrayPush, 1698 "array_push", ArrayPush,
1712 "array_shift", ArrayShift, 1699 "array_shift", ArrayShift,
1713 "array_splice", ArraySplice, 1700 "array_splice", ArraySplice,
1714 "array_slice", ArraySlice, 1701 "array_slice", ArraySlice,
1715 "array_unshift", ArrayUnshift, 1702 "array_unshift", ArrayUnshift,
1716 ]); 1703 ]);
1717 1704
1718 }); 1705 });
OLDNEW
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | src/builtins.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698