OLD | NEW |
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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Use SetProperty rather than a direct keyed store to ensure that the store |
447 // site doesn't become poisened with an elements transition KeyedStoreIC. | 447 // site doesn't become poisened with an elements transition KeyedStoreIC. |
448 %SetProperty(array, i+n, %_Arguments(i), 0, kStrictMode); | 448 %SetProperty(array, i+n, %_Arguments(i), kStrictMode); |
449 } | 449 } |
450 | 450 |
451 var new_length = n + m; | 451 var new_length = n + m; |
452 array.length = new_length; | 452 array.length = new_length; |
453 return new_length; | 453 return new_length; |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 // Returns an array containing the array elements of the object followed | 457 // Returns an array containing the array elements of the object followed |
458 // by the array elements of each argument in order. See ECMA-262, | 458 // by the array elements of each argument in order. See ECMA-262, |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 } | 1455 } |
1456 | 1456 |
1457 | 1457 |
1458 // ------------------------------------------------------------------- | 1458 // ------------------------------------------------------------------- |
1459 | 1459 |
1460 function SetUpArray() { | 1460 function SetUpArray() { |
1461 %CheckIsBootstrapping(); | 1461 %CheckIsBootstrapping(); |
1462 | 1462 |
1463 // Set up non-enumerable constructor property on the Array.prototype | 1463 // Set up non-enumerable constructor property on the Array.prototype |
1464 // object. | 1464 // object. |
1465 %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM); | 1465 %DefineProperty($Array.prototype, "constructor", $Array, DONT_ENUM); |
1466 | 1466 |
1467 // Set up non-enumerable functions on the Array object. | 1467 // Set up non-enumerable functions on the Array object. |
1468 InstallFunctions($Array, DONT_ENUM, $Array( | 1468 InstallFunctions($Array, DONT_ENUM, $Array( |
1469 "isArray", ArrayIsArray | 1469 "isArray", ArrayIsArray |
1470 )); | 1470 )); |
1471 | 1471 |
1472 var specialFunctions = %SpecialArrayFunctions(); | 1472 var specialFunctions = %SpecialArrayFunctions(); |
1473 | 1473 |
1474 var getFunction = function(name, jsBuiltin, len) { | 1474 var getFunction = function(name, jsBuiltin, len) { |
1475 var f = jsBuiltin; | 1475 var f = jsBuiltin; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 )); | 1525 )); |
1526 | 1526 |
1527 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( | 1527 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( |
1528 "join", getFunction("join", ArrayJoin), | 1528 "join", getFunction("join", ArrayJoin), |
1529 "pop", getFunction("pop", ArrayPop), | 1529 "pop", getFunction("pop", ArrayPop), |
1530 "push", getFunction("push", ArrayPush) | 1530 "push", getFunction("push", ArrayPush) |
1531 )); | 1531 )); |
1532 } | 1532 } |
1533 | 1533 |
1534 SetUpArray(); | 1534 SetUpArray(); |
OLD | NEW |