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

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

Issue 2090193002: Array splice should only normalize deleted_elements if it's an array (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « no previous file | test/mjsunit/regress/regress-crbug-618788.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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 722 }
723 723
724 var changed_elements = del_count; 724 var changed_elements = del_count;
725 if (num_elements_to_add != del_count) { 725 if (num_elements_to_add != del_count) {
726 // If the slice needs to do a actually move elements after the insertion 726 // If the slice needs to do a actually move elements after the insertion
727 // point, then include those in the estimate of changed elements. 727 // point, then include those in the estimate of changed elements.
728 changed_elements += len - start_i - del_count; 728 changed_elements += len - start_i - del_count;
729 } 729 }
730 if (UseSparseVariant(array, len, IS_ARRAY(array), changed_elements)) { 730 if (UseSparseVariant(array, len, IS_ARRAY(array), changed_elements)) {
731 %NormalizeElements(array); 731 %NormalizeElements(array);
732 %NormalizeElements(deleted_elements); 732 if (IS_ARRAY(deleted_elements)) %NormalizeElements(deleted_elements);
733 SparseSlice(array, start_i, del_count, len, deleted_elements); 733 SparseSlice(array, start_i, del_count, len, deleted_elements);
734 SparseMove(array, start_i, del_count, len, num_elements_to_add); 734 SparseMove(array, start_i, del_count, len, num_elements_to_add);
735 } else { 735 } else {
736 SimpleSlice(array, start_i, del_count, len, deleted_elements); 736 SimpleSlice(array, start_i, del_count, len, deleted_elements);
737 SimpleMove(array, start_i, del_count, len, num_elements_to_add); 737 SimpleMove(array, start_i, del_count, len, num_elements_to_add);
738 } 738 }
739 739
740 // Insert the arguments into the resulting array in 740 // Insert the arguments into the resulting array in
741 // place of the deleted elements. 741 // place of the deleted elements.
742 var i = start_i; 742 var i = start_i;
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 %InstallToContext([ 1781 %InstallToContext([
1782 "array_pop", ArrayPop, 1782 "array_pop", ArrayPop,
1783 "array_push", ArrayPush, 1783 "array_push", ArrayPush,
1784 "array_shift", ArrayShift, 1784 "array_shift", ArrayShift,
1785 "array_splice", ArraySplice, 1785 "array_splice", ArraySplice,
1786 "array_slice", ArraySlice, 1786 "array_slice", ArraySlice,
1787 "array_unshift", ArrayUnshift, 1787 "array_unshift", ArrayUnshift,
1788 ]); 1788 ]);
1789 1789
1790 }); 1790 });
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-618788.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698