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 |
11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
12 // Imports | 12 // Imports |
13 | 13 |
14 var Delete; | 14 var Delete; |
15 var FLAG_harmony_tolength; | 15 var FLAG_harmony_tolength; |
16 var GlobalArray = global.Array; | 16 var GlobalArray = global.Array; |
17 var InternalArray = utils.InternalArray; | 17 var InternalArray = utils.InternalArray; |
18 var InternalPackedArray = utils.InternalPackedArray; | 18 var InternalPackedArray = utils.InternalPackedArray; |
19 var MathMin; | 19 var MinSimple; |
20 var ObjectHasOwnProperty; | 20 var ObjectHasOwnProperty; |
21 var ObjectIsFrozen; | 21 var ObjectIsFrozen; |
22 var ObjectIsSealed; | 22 var ObjectIsSealed; |
23 var ObjectToString; | 23 var ObjectToString; |
24 var ObserveBeginPerformSplice; | 24 var ObserveBeginPerformSplice; |
25 var ObserveEndPerformSplice; | 25 var ObserveEndPerformSplice; |
26 var ObserveEnqueueSpliceRecord; | 26 var ObserveEnqueueSpliceRecord; |
27 var unscopablesSymbol = utils.ImportNow("unscopables_symbol"); | 27 var unscopablesSymbol = utils.ImportNow("unscopables_symbol"); |
28 | 28 |
29 utils.Import(function(from) { | 29 utils.Import(function(from) { |
30 Delete = from.Delete; | 30 Delete = from.Delete; |
31 MathMin = from.MathMin; | 31 MinSimple = from.MinSimple; |
32 ObjectHasOwnProperty = from.ObjectHasOwnProperty; | 32 ObjectHasOwnProperty = from.ObjectHasOwnProperty; |
33 ObjectIsFrozen = from.ObjectIsFrozen; | 33 ObjectIsFrozen = from.ObjectIsFrozen; |
34 ObjectIsSealed = from.ObjectIsSealed; | 34 ObjectIsSealed = from.ObjectIsSealed; |
35 ObjectToString = from.ObjectToString; | 35 ObjectToString = from.ObjectToString; |
36 ObserveBeginPerformSplice = from.ObserveBeginPerformSplice; | 36 ObserveBeginPerformSplice = from.ObserveBeginPerformSplice; |
37 ObserveEndPerformSplice = from.ObserveEndPerformSplice; | 37 ObserveEndPerformSplice = from.ObserveEndPerformSplice; |
38 ObserveEnqueueSpliceRecord = from.ObserveEnqueueSpliceRecord; | 38 ObserveEnqueueSpliceRecord = from.ObserveEnqueueSpliceRecord; |
39 }); | 39 }); |
40 | 40 |
41 utils.ImportFromExperimental(function(from) { | 41 utils.ImportFromExperimental(function(from) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 | 265 |
266 // This function implements the optimized splice implementation that can use | 266 // This function implements the optimized splice implementation that can use |
267 // special array operations to handle sparse arrays in a sensible fashion. | 267 // special array operations to handle sparse arrays in a sensible fashion. |
268 function SparseMove(array, start_i, del_count, len, num_additional_args) { | 268 function SparseMove(array, start_i, del_count, len, num_additional_args) { |
269 // Bail out if no moving is necessary. | 269 // Bail out if no moving is necessary. |
270 if (num_additional_args === del_count) return; | 270 if (num_additional_args === del_count) return; |
271 // Move data to new array. | 271 // Move data to new array. |
272 var new_array = new InternalArray( | 272 var new_array = new InternalArray( |
273 // Clamp array length to 2^32-1 to avoid early RangeError. | 273 // Clamp array length to 2^32-1 to avoid early RangeError. |
274 MathMin(len - del_count + num_additional_args, 0xffffffff)); | 274 MinSimple(len - del_count + num_additional_args, 0xffffffff)); |
275 var big_indices; | 275 var big_indices; |
276 var indices = %GetArrayKeys(array, len); | 276 var indices = %GetArrayKeys(array, len); |
277 if (IS_NUMBER(indices)) { | 277 if (IS_NUMBER(indices)) { |
278 var limit = indices; | 278 var limit = indices; |
279 for (var i = 0; i < start_i && i < limit; ++i) { | 279 for (var i = 0; i < start_i && i < limit; ++i) { |
280 var current = array[i]; | 280 var current = array[i]; |
281 if (!IS_UNDEFINED(current) || i in array) { | 281 if (!IS_UNDEFINED(current) || i in array) { |
282 new_array[i] = current; | 282 new_array[i] = current; |
283 } | 283 } |
284 } | 284 } |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 %InstallToContext([ | 1672 %InstallToContext([ |
1673 "array_pop", ArrayPop, | 1673 "array_pop", ArrayPop, |
1674 "array_push", ArrayPush, | 1674 "array_push", ArrayPush, |
1675 "array_shift", ArrayShift, | 1675 "array_shift", ArrayShift, |
1676 "array_splice", ArraySplice, | 1676 "array_splice", ArraySplice, |
1677 "array_slice", ArraySlice, | 1677 "array_slice", ArraySlice, |
1678 "array_unshift", ArrayUnshift, | 1678 "array_unshift", ArrayUnshift, |
1679 ]); | 1679 ]); |
1680 | 1680 |
1681 }); | 1681 }); |
OLD | NEW |