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

Side by Side Diff: src/array.js

Issue 990883002: Hide Math function implementations in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove printf and unnecessary test case change. Created 5 years, 9 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/arraybuffer.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 "use strict"; 5 "use strict";
6 6
7 // This file relies on the fact that the following declarations have been made 7 // This file relies on the fact that the following declarations have been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Array = global.Array; 9 // var $Array = global.Array;
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 234
235 // This function implements the optimized splice implementation that can use 235 // This function implements the optimized splice implementation that can use
236 // special array operations to handle sparse arrays in a sensible fashion. 236 // special array operations to handle sparse arrays in a sensible fashion.
237 function SparseMove(array, start_i, del_count, len, num_additional_args) { 237 function SparseMove(array, start_i, del_count, len, num_additional_args) {
238 // Bail out if no moving is necessary. 238 // Bail out if no moving is necessary.
239 if (num_additional_args === del_count) return; 239 if (num_additional_args === del_count) return;
240 // Move data to new array. 240 // Move data to new array.
241 var new_array = new InternalArray( 241 var new_array = new InternalArray(
242 // Clamp array length to 2^32-1 to avoid early RangeError. 242 // Clamp array length to 2^32-1 to avoid early RangeError.
243 MathMin(len - del_count + num_additional_args, 0xffffffff)); 243 $min(len - del_count + num_additional_args, 0xffffffff));
244 var big_indices; 244 var big_indices;
245 var indices = %GetArrayKeys(array, len); 245 var indices = %GetArrayKeys(array, len);
246 if (IS_NUMBER(indices)) { 246 if (IS_NUMBER(indices)) {
247 var limit = indices; 247 var limit = indices;
248 for (var i = 0; i < start_i && i < limit; ++i) { 248 for (var i = 0; i < start_i && i < limit; ++i) {
249 var current = array[i]; 249 var current = array[i];
250 if (!IS_UNDEFINED(current) || i in array) { 250 if (!IS_UNDEFINED(current) || i in array) {
251 new_array[i] = current; 251 new_array[i] = current;
252 } 252 }
253 } 253 }
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 )); 1581 ));
1582 1582
1583 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1583 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1584 "join", getFunction("join", ArrayJoin), 1584 "join", getFunction("join", ArrayJoin),
1585 "pop", getFunction("pop", ArrayPop), 1585 "pop", getFunction("pop", ArrayPop),
1586 "push", getFunction("push", ArrayPush) 1586 "push", getFunction("push", ArrayPush)
1587 )); 1587 ));
1588 } 1588 }
1589 1589
1590 SetUpArray(); 1590 SetUpArray();
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/arraybuffer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698