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

Side by Side Diff: src/array.js

Issue 353953002: Use simple keyed store again in ArrayPush_JS_Builtin (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.push"); 436 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.push");
437 437
438 if (%IsObserved(this)) 438 if (%IsObserved(this))
439 return ObservedArrayPush.apply(this, arguments); 439 return ObservedArrayPush.apply(this, arguments);
440 440
441 var array = TO_OBJECT_INLINE(this); 441 var array = TO_OBJECT_INLINE(this);
442 var n = TO_UINT32(array.length); 442 var n = TO_UINT32(array.length);
443 var m = %_ArgumentsLength(); 443 var m = %_ArgumentsLength();
444 444
445 for (var i = 0; i < m; i++) { 445 for (var i = 0; i < m; i++) {
446 // Use SetProperty rather than a direct keyed store to ensure that the store 446 array[i+n] = %_Arguments(i);
447 // site doesn't become poisened with an elements transition KeyedStoreIC.
448 %SetProperty(array, i+n, %_Arguments(i), 0, kStrictMode);
449 } 447 }
450 448
451 var new_length = n + m; 449 var new_length = n + m;
452 array.length = new_length; 450 array.length = new_length;
453 return new_length; 451 return new_length;
454 } 452 }
455 453
456 454
457 // Returns an array containing the array elements of the object followed 455 // Returns an array containing the array elements of the object followed
458 // by the array elements of each argument in order. See ECMA-262, 456 // by the array elements of each argument in order. See ECMA-262,
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 )); 1523 ));
1526 1524
1527 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1525 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1528 "join", getFunction("join", ArrayJoin), 1526 "join", getFunction("join", ArrayJoin),
1529 "pop", getFunction("pop", ArrayPop), 1527 "pop", getFunction("pop", ArrayPop),
1530 "push", getFunction("push", ArrayPush) 1528 "push", getFunction("push", ArrayPush)
1531 )); 1529 ));
1532 } 1530 }
1533 1531
1534 SetUpArray(); 1532 SetUpArray();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698