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

Side by Side Diff: src/array.js

Issue 1390023003: Use simple/fast macro version of MinMax in JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: avoid debug directory Created 5 years, 2 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/harmony-atomics.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 unscopablesSymbol = utils.ImportNow("unscopables_symbol"); 22 var unscopablesSymbol = utils.ImportNow("unscopables_symbol");
24 23
25 utils.Import(function(from) { 24 utils.Import(function(from) {
26 Delete = from.Delete; 25 Delete = from.Delete;
27 MathMin = from.MathMin;
28 ObjectHasOwnProperty = from.ObjectHasOwnProperty; 26 ObjectHasOwnProperty = from.ObjectHasOwnProperty;
29 ObjectIsFrozen = from.ObjectIsFrozen; 27 ObjectIsFrozen = from.ObjectIsFrozen;
30 ObjectIsSealed = from.ObjectIsSealed; 28 ObjectIsSealed = from.ObjectIsSealed;
31 ObjectToString = from.ObjectToString; 29 ObjectToString = from.ObjectToString;
32 }); 30 });
33 31
34 // ------------------------------------------------------------------- 32 // -------------------------------------------------------------------
35 33
36 // Global list of arrays visited during toString, toLocaleString and 34 // Global list of arrays visited during toString, toLocaleString and
37 // join invocations. 35 // join invocations.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 255
258 256
259 // This function implements the optimized splice implementation that can use 257 // This function implements the optimized splice implementation that can use
260 // special array operations to handle sparse arrays in a sensible fashion. 258 // special array operations to handle sparse arrays in a sensible fashion.
261 function SparseMove(array, start_i, del_count, len, num_additional_args) { 259 function SparseMove(array, start_i, del_count, len, num_additional_args) {
262 // Bail out if no moving is necessary. 260 // Bail out if no moving is necessary.
263 if (num_additional_args === del_count) return; 261 if (num_additional_args === del_count) return;
264 // Move data to new array. 262 // Move data to new array.
265 var new_array = new InternalArray( 263 var new_array = new InternalArray(
266 // Clamp array length to 2^32-1 to avoid early RangeError. 264 // Clamp array length to 2^32-1 to avoid early RangeError.
267 MathMin(len - del_count + num_additional_args, 0xffffffff)); 265 MIN_SIMPLE(len - del_count + num_additional_args, 0xffffffff));
268 var big_indices; 266 var big_indices;
269 var indices = %GetArrayKeys(array, len); 267 var indices = %GetArrayKeys(array, len);
270 if (IS_NUMBER(indices)) { 268 if (IS_NUMBER(indices)) {
271 var limit = indices; 269 var limit = indices;
272 for (var i = 0; i < start_i && i < limit; ++i) { 270 for (var i = 0; i < start_i && i < limit; ++i) {
273 var current = array[i]; 271 var current = array[i];
274 if (!IS_UNDEFINED(current) || i in array) { 272 if (!IS_UNDEFINED(current) || i in array) {
275 new_array[i] = current; 273 new_array[i] = current;
276 } 274 }
277 } 275 }
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 %InstallToContext([ 1652 %InstallToContext([
1655 "array_pop", ArrayPop, 1653 "array_pop", ArrayPop,
1656 "array_push", ArrayPush, 1654 "array_push", ArrayPush,
1657 "array_shift", ArrayShift, 1655 "array_shift", ArrayShift,
1658 "array_splice", ArraySplice, 1656 "array_splice", ArraySplice,
1659 "array_slice", ArraySlice, 1657 "array_slice", ArraySlice,
1660 "array_unshift", ArrayUnshift, 1658 "array_unshift", ArrayUnshift,
1661 ]); 1659 ]);
1662 1660
1663 }); 1661 });
OLDNEW
« no previous file with comments | « no previous file | src/arraybuffer.js » ('j') | src/harmony-atomics.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698