summaryrefslogtreecommitdiff
path: root/deps/v8/src/harmony-array.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/harmony-array.js')
-rw-r--r--deps/v8/src/harmony-array.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/deps/v8/src/harmony-array.js b/deps/v8/src/harmony-array.js
index dbcb292a08..88b878f0a7 100644
--- a/deps/v8/src/harmony-array.js
+++ b/deps/v8/src/harmony-array.js
@@ -123,11 +123,29 @@ function ArrayFill(value /* [, start [, end ] ] */) { // length == 1
return array;
}
+// ES6, draft 05-22-14, section 22.1.2.3
+function ArrayOf() {
+ var length = %_ArgumentsLength();
+ var constructor = this;
+ // TODO: Implement IsConstructor (ES6 section 7.2.5)
+ var array = IS_SPEC_FUNCTION(constructor) ? new constructor(length) : [];
+ for (var i = 0; i < length; i++) {
+ %AddElement(array, i, %_Arguments(i), NONE);
+ }
+ array.length = length;
+ return array;
+}
+
// -------------------------------------------------------------------
function HarmonyArrayExtendArrayPrototype() {
%CheckIsBootstrapping();
+ // Set up non-enumerable functions on the Array object.
+ InstallFunctions($Array, DONT_ENUM, $Array(
+ "of", ArrayOf
+ ));
+
// Set up the non-enumerable functions on the Array prototype object.
InstallFunctions($Array.prototype, DONT_ENUM, $Array(
"find", ArrayFind,