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

Side by Side Diff: src/array.js

Issue 1345333002: src: Use simple/fast macro version of MinMax in JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Back from beginInt to startInt Created 5 years, 3 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 | src/arraybuffer.js » ('j') | src/arraybuffer.js » ('J')
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) { 5 (function(global, utils) {
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 GlobalArray = global.Array; 15 var GlobalArray = global.Array;
16 var InternalArray = utils.InternalArray; 16 var InternalArray = utils.InternalArray;
17 var InternalPackedArray = utils.InternalPackedArray; 17 var InternalPackedArray = utils.InternalPackedArray;
18 var MathMin;
19 var ObjectHasOwnProperty; 18 var ObjectHasOwnProperty;
20 var ObjectIsFrozen; 19 var ObjectIsFrozen;
21 var ObjectIsSealed; 20 var ObjectIsSealed;
22 var ObjectToString; 21 var ObjectToString;
23 var ToNumber; 22 var ToNumber;
24 var ToString; 23 var ToString;
25 var unscopablesSymbol = utils.ImportNow("unscopables_symbol"); 24 var unscopablesSymbol = utils.ImportNow("unscopables_symbol");
26 25
27 utils.Import(function(from) { 26 utils.Import(function(from) {
28 Delete = from.Delete; 27 Delete = from.Delete;
29 MathMin = from.MathMin;
30 ObjectHasOwnProperty = from.ObjectHasOwnProperty; 28 ObjectHasOwnProperty = from.ObjectHasOwnProperty;
31 ObjectIsFrozen = from.ObjectIsFrozen; 29 ObjectIsFrozen = from.ObjectIsFrozen;
32 ObjectIsSealed = from.ObjectIsSealed; 30 ObjectIsSealed = from.ObjectIsSealed;
33 ObjectToString = from.ObjectToString; 31 ObjectToString = from.ObjectToString;
34 ToNumber = from.ToNumber; 32 ToNumber = from.ToNumber;
35 ToString = from.ToString; 33 ToString = from.ToString;
36 }); 34 });
37 35
38 // ------------------------------------------------------------------- 36 // -------------------------------------------------------------------
39 37
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 258
261 259
262 // This function implements the optimized splice implementation that can use 260 // This function implements the optimized splice implementation that can use
263 // special array operations to handle sparse arrays in a sensible fashion. 261 // special array operations to handle sparse arrays in a sensible fashion.
264 function SparseMove(array, start_i, del_count, len, num_additional_args) { 262 function SparseMove(array, start_i, del_count, len, num_additional_args) {
265 // Bail out if no moving is necessary. 263 // Bail out if no moving is necessary.
266 if (num_additional_args === del_count) return; 264 if (num_additional_args === del_count) return;
267 // Move data to new array. 265 // Move data to new array.
268 var new_array = new InternalArray( 266 var new_array = new InternalArray(
269 // Clamp array length to 2^32-1 to avoid early RangeError. 267 // Clamp array length to 2^32-1 to avoid early RangeError.
270 MathMin(len - del_count + num_additional_args, 0xffffffff)); 268 MIN_SIMPLE(len - del_count + num_additional_args, 0xffffffff));
271 var big_indices; 269 var big_indices;
272 var indices = %GetArrayKeys(array, len); 270 var indices = %GetArrayKeys(array, len);
273 if (IS_NUMBER(indices)) { 271 if (IS_NUMBER(indices)) {
274 var limit = indices; 272 var limit = indices;
275 for (var i = 0; i < start_i && i < limit; ++i) { 273 for (var i = 0; i < start_i && i < limit; ++i) {
276 var current = array[i]; 274 var current = array[i];
277 if (!IS_UNDEFINED(current) || i in array) { 275 if (!IS_UNDEFINED(current) || i in array) {
278 new_array[i] = current; 276 new_array[i] = current;
279 } 277 }
280 } 278 }
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 %InstallToContext([ 1656 %InstallToContext([
1659 "array_pop", ArrayPop, 1657 "array_pop", ArrayPop,
1660 "array_push", ArrayPush, 1658 "array_push", ArrayPush,
1661 "array_shift", ArrayShift, 1659 "array_shift", ArrayShift,
1662 "array_splice", ArraySplice, 1660 "array_splice", ArraySplice,
1663 "array_slice", ArraySlice, 1661 "array_slice", ArraySlice,
1664 "array_unshift", ArrayUnshift, 1662 "array_unshift", ArrayUnshift,
1665 ]); 1663 ]);
1666 1664
1667 }); 1665 });
OLDNEW
« no previous file with comments | « no previous file | src/arraybuffer.js » ('j') | src/arraybuffer.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698