OLD | NEW |
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 Loading... |
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 Loading... |
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 }); |
OLD | NEW |