ES6: Support Array.of construction
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jan 2015 20:03:00 +0000 (20:03 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jan 2015 20:03:00 +0000 (20:03 +0000)
commit4a214a500b1b52edac1681463bd50b780efb045e
treef4b09ea4fee8a92746bdc5ad18afdd3decd5be2f
parentff20c16dbd201c0d754f8d4347422277d69ad497
ES6: Support Array.of construction
https://bugs.webkit.org/show_bug.cgi?id=140605
<rdar://problem/19513655>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Add and implementation of Array.of, described in 22.1.2.3 of the ES6
specification (15 Jan 2015). The Array.of() method creates a new Array
instance with a variable number of arguments, regardless of number or type
of the arguments.

* runtime/ArrayConstructor.cpp:
(JSC::arrayConstructorOf): Create a new empty Array, then iterate
over the arguments, setting them to the appropriate index.

LayoutTests:

Add 'of' to the Array properties, and a
test for Array.of().

* js/Object-getOwnPropertyNames-expected.txt:
* js/array-of-expected.txt: Added.
* js/array-of.html: Added.
* js/script-tests/Object-getOwnPropertyNames.js:
* js/script-tests/array-of.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178662 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/js/array-of-expected.txt [new file with mode: 0644]
LayoutTests/js/array-of.html [new file with mode: 0644]
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
LayoutTests/js/script-tests/array-of.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayConstructor.cpp