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

Side by Side Diff: src/array.js

Issue 1144163002: Revert of Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « BUILD.gn ('k') | src/array-iterator.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 var $arrayConcat; 5 var $arrayConcat;
6 var $arrayJoin; 6 var $arrayJoin;
7 var $arrayPush; 7 var $arrayPush;
8 var $arrayPop; 8 var $arrayPop;
9 var $arrayShift; 9 var $arrayShift;
10 var $arraySlice; 10 var $arraySlice;
11 var $arraySplice; 11 var $arraySplice;
12 var $arrayUnshift; 12 var $arrayUnshift;
13 var $innerArrayForEach; 13 var $innerArrayForEach;
14 var $innerArrayEvery; 14 var $innerArrayEvery;
15 var $innerArrayIndexOf; 15 var $innerArrayIndexOf;
16 var $innerArrayLastIndexOf; 16 var $innerArrayLastIndexOf;
17 var $innerArrayReverse; 17 var $innerArrayReverse;
18 var $innerArraySort; 18 var $innerArraySort;
19 19
20 (function(global, utils) { 20 (function(global, shared, exports) {
21 21
22 "use strict"; 22 "use strict";
23 23
24 %CheckIsBootstrapping(); 24 %CheckIsBootstrapping();
25 25
26 // ------------------------------------------------------------------- 26 // -------------------------------------------------------------------
27 // Imports 27 // Imports
28 28
29 var GlobalArray = global.Array; 29 var GlobalArray = global.Array;
30 var InternalArray = utils.InternalArray; 30 var InternalArray = exports.InternalArray;
31 var InternalPackedArray = utils.InternalPackedArray; 31 var InternalPackedArray = exports.InternalPackedArray;
32
33 var MathMin;
34
35 utils.Import(function(from) {
36 MathMin = from.MathMin;
37 });
38 32
39 // ------------------------------------------------------------------- 33 // -------------------------------------------------------------------
40 34
41 // Global list of arrays visited during toString, toLocaleString and 35 // Global list of arrays visited during toString, toLocaleString and
42 // join invocations. 36 // join invocations.
43 var visited_arrays = new InternalArray(); 37 var visited_arrays = new InternalArray();
44 38
45 39
46 // Gets a sorted array of array keys. Useful for operations on sparse 40 // Gets a sorted array of array keys. Useful for operations on sparse
47 // arrays. Dupes have not been removed. 41 // arrays. Dupes have not been removed.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 255
262 256
263 // This function implements the optimized splice implementation that can use 257 // This function implements the optimized splice implementation that can use
264 // special array operations to handle sparse arrays in a sensible fashion. 258 // special array operations to handle sparse arrays in a sensible fashion.
265 function SparseMove(array, start_i, del_count, len, num_additional_args) { 259 function SparseMove(array, start_i, del_count, len, num_additional_args) {
266 // Bail out if no moving is necessary. 260 // Bail out if no moving is necessary.
267 if (num_additional_args === del_count) return; 261 if (num_additional_args === del_count) return;
268 // Move data to new array. 262 // Move data to new array.
269 var new_array = new InternalArray( 263 var new_array = new InternalArray(
270 // Clamp array length to 2^32-1 to avoid early RangeError. 264 // Clamp array length to 2^32-1 to avoid early RangeError.
271 MathMin(len - del_count + num_additional_args, 0xffffffff)); 265 $min(len - del_count + num_additional_args, 0xffffffff));
272 var big_indices; 266 var big_indices;
273 var indices = %GetArrayKeys(array, len); 267 var indices = %GetArrayKeys(array, len);
274 if (IS_NUMBER(indices)) { 268 if (IS_NUMBER(indices)) {
275 var limit = indices; 269 var limit = indices;
276 for (var i = 0; i < start_i && i < limit; ++i) { 270 for (var i = 0; i < start_i && i < limit; ++i) {
277 var current = array[i]; 271 var current = array[i];
278 if (!IS_UNDEFINED(current) || i in array) { 272 if (!IS_UNDEFINED(current) || i in array) {
279 new_array[i] = current; 273 new_array[i] = current;
280 } 274 }
281 } 275 }
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 $arrayUnshift = ArrayUnshift; 1637 $arrayUnshift = ArrayUnshift;
1644 1638
1645 $innerArrayForEach = InnerArrayForEach; 1639 $innerArrayForEach = InnerArrayForEach;
1646 $innerArrayEvery = InnerArrayEvery; 1640 $innerArrayEvery = InnerArrayEvery;
1647 $innerArrayIndexOf = InnerArrayIndexOf; 1641 $innerArrayIndexOf = InnerArrayIndexOf;
1648 $innerArrayLastIndexOf = InnerArrayLastIndexOf; 1642 $innerArrayLastIndexOf = InnerArrayLastIndexOf;
1649 $innerArrayReverse = InnerArrayReverse; 1643 $innerArrayReverse = InnerArrayReverse;
1650 $innerArraySort = InnerArraySort; 1644 $innerArraySort = InnerArraySort;
1651 1645
1652 }); 1646 });
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/array-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698