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 (function(global, utils, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 function ArrayFill(value, start, end) { | 1690 function ArrayFill(value, start, end) { |
1691 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.fill"); | 1691 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.fill"); |
1692 | 1692 |
1693 var array = TO_OBJECT(this); | 1693 var array = TO_OBJECT(this); |
1694 var length = TO_LENGTH_OR_UINT32(array.length); | 1694 var length = TO_LENGTH_OR_UINT32(array.length); |
1695 | 1695 |
1696 return InnerArrayFill(value, start, end, array, length); | 1696 return InnerArrayFill(value, start, end, array, length); |
1697 } | 1697 } |
1698 | 1698 |
1699 | 1699 |
1700 // ES5, 15.4.3.2 | |
1701 function ArrayIsArray(obj) { | |
1702 return IS_ARRAY(obj); | |
1703 } | |
1704 | |
1705 | |
1706 function AddArrayElement(constructor, array, i, value) { | 1700 function AddArrayElement(constructor, array, i, value) { |
1707 if (constructor === GlobalArray) { | 1701 if (constructor === GlobalArray) { |
1708 AddIndexedProperty(array, i, value); | 1702 AddIndexedProperty(array, i, value); |
1709 } else { | 1703 } else { |
1710 ObjectDefineProperty(array, i, { | 1704 ObjectDefineProperty(array, i, { |
1711 value: value, writable: true, configurable: true, enumerable: true | 1705 value: value, writable: true, configurable: true, enumerable: true |
1712 }); | 1706 }); |
1713 } | 1707 } |
1714 } | 1708 } |
1715 | 1709 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 keys: true, | 1803 keys: true, |
1810 }; | 1804 }; |
1811 | 1805 |
1812 %AddNamedProperty(GlobalArray.prototype, unscopablesSymbol, unscopables, | 1806 %AddNamedProperty(GlobalArray.prototype, unscopablesSymbol, unscopables, |
1813 DONT_ENUM | READ_ONLY); | 1807 DONT_ENUM | READ_ONLY); |
1814 | 1808 |
1815 %FunctionSetLength(ArrayFrom, 1); | 1809 %FunctionSetLength(ArrayFrom, 1); |
1816 | 1810 |
1817 // Set up non-enumerable functions on the Array object. | 1811 // Set up non-enumerable functions on the Array object. |
1818 utils.InstallFunctions(GlobalArray, DONT_ENUM, [ | 1812 utils.InstallFunctions(GlobalArray, DONT_ENUM, [ |
1819 "isArray", ArrayIsArray, | |
1820 "from", ArrayFrom, | 1813 "from", ArrayFrom, |
1821 "of", ArrayOf | 1814 "of", ArrayOf |
1822 ]); | 1815 ]); |
1823 | 1816 |
1824 var specialFunctions = %SpecialArrayFunctions(); | 1817 var specialFunctions = %SpecialArrayFunctions(); |
1825 | 1818 |
1826 var getFunction = function(name, jsBuiltin, len) { | 1819 var getFunction = function(name, jsBuiltin, len) { |
1827 var f = jsBuiltin; | 1820 var f = jsBuiltin; |
1828 if (specialFunctions.hasOwnProperty(name)) { | 1821 if (specialFunctions.hasOwnProperty(name)) { |
1829 f = specialFunctions[name]; | 1822 f = specialFunctions[name]; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 %InstallToContext([ | 1922 %InstallToContext([ |
1930 "array_pop", ArrayPop, | 1923 "array_pop", ArrayPop, |
1931 "array_push", ArrayPush, | 1924 "array_push", ArrayPush, |
1932 "array_shift", ArrayShift, | 1925 "array_shift", ArrayShift, |
1933 "array_splice", ArraySplice, | 1926 "array_splice", ArraySplice, |
1934 "array_slice", ArraySlice, | 1927 "array_slice", ArraySlice, |
1935 "array_unshift", ArrayUnshift, | 1928 "array_unshift", ArrayUnshift, |
1936 ]); | 1929 ]); |
1937 | 1930 |
1938 }); | 1931 }); |
OLD | NEW |