| 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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 // The specification allows "implementation dependent" behavior | 1017 // The specification allows "implementation dependent" behavior |
| 1018 // if an element on the prototype chain has an element that | 1018 // if an element on the prototype chain has an element that |
| 1019 // might interact with sorting. | 1019 // might interact with sorting. |
| 1020 max_prototype_element = CopyFromPrototype(array, length); | 1020 max_prototype_element = CopyFromPrototype(array, length); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 // %RemoveArrayHoles returns -1 if fast removal is not supported. | 1023 // %RemoveArrayHoles returns -1 if fast removal is not supported. |
| 1024 var num_non_undefined = %RemoveArrayHoles(array, length); | 1024 var num_non_undefined = %RemoveArrayHoles(array, length); |
| 1025 | 1025 |
| 1026 if (num_non_undefined == -1) { | 1026 if (num_non_undefined == -1) { |
| 1027 // The array is observed, or there were indexed accessors in the array. | 1027 // There were indexed accessors in the array. |
| 1028 // Move array holes and undefineds to the end using a Javascript function | 1028 // Move array holes and undefineds to the end using a Javascript function |
| 1029 // that is safe in the presence of accessors and is observable. | 1029 // that is safe in the presence of accessors. |
| 1030 num_non_undefined = SafeRemoveArrayHoles(array); | 1030 num_non_undefined = SafeRemoveArrayHoles(array); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 QuickSort(array, 0, num_non_undefined); | 1033 QuickSort(array, 0, num_non_undefined); |
| 1034 | 1034 |
| 1035 if (!is_array && (num_non_undefined + 1 < max_prototype_element)) { | 1035 if (!is_array && (num_non_undefined + 1 < max_prototype_element)) { |
| 1036 // For compatibility with JSC, we shadow any elements in the prototype | 1036 // For compatibility with JSC, we shadow any elements in the prototype |
| 1037 // chain that has become exposed by sort moving a hole to its position. | 1037 // chain that has become exposed by sort moving a hole to its position. |
| 1038 ShadowPrototypeElements(array, num_non_undefined, max_prototype_element); | 1038 ShadowPrototypeElements(array, num_non_undefined, max_prototype_element); |
| 1039 } | 1039 } |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 %InstallToContext([ | 1794 %InstallToContext([ |
| 1795 "array_pop", ArrayPop, | 1795 "array_pop", ArrayPop, |
| 1796 "array_push", ArrayPush, | 1796 "array_push", ArrayPush, |
| 1797 "array_shift", ArrayShift, | 1797 "array_shift", ArrayShift, |
| 1798 "array_splice", ArraySplice, | 1798 "array_splice", ArraySplice, |
| 1799 "array_slice", ArraySlice, | 1799 "array_slice", ArraySlice, |
| 1800 "array_unshift", ArrayUnshift, | 1800 "array_unshift", ArrayUnshift, |
| 1801 ]); | 1801 ]); |
| 1802 | 1802 |
| 1803 }); | 1803 }); |
| OLD | NEW |