Diff
Modified: trunk/LayoutTests/ChangeLog (167379 => 167380)
--- trunk/LayoutTests/ChangeLog 2014-04-16 20:02:48 UTC (rev 167379)
+++ trunk/LayoutTests/ChangeLog 2014-04-16 20:10:41 UTC (rev 167380)
@@ -1,3 +1,18 @@
+2014-04-16 Oliver Hunt <oli...@apple.com>
+
+ Simple ES6 feature:Array.prototype.fill
+ https://bugs.webkit.org/show_bug.cgi?id=131703
+
+ Reviewed by David Hyatt.
+
+ Add tests.
+
+ * js/Object-getOwnPropertyNames-expected.txt:
+ * js/array-fill-expected.txt: Added.
+ * js/array-fill.html: Added.
+ * js/script-tests/Object-getOwnPropertyNames.js:
+ * js/script-tests/array-fill.js: Added.
+
2014-04-16 David Kilzer <ddkil...@apple.com>
Remove test results that match platform/mac results
Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (167379 => 167380)
--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt 2014-04-16 20:02:48 UTC (rev 167379)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt 2014-04-16 20:10:41 UTC (rev 167380)
@@ -45,7 +45,7 @@
PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']
PASS getSortedOwnPropertyNames(Array) is ['isArray', 'length', 'name', 'prototype']
-PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']
+PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']
PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'length', 'name', 'prototype']
PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']
PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype']
Added: trunk/LayoutTests/js/array-fill-expected.txt (0 => 167380)
--- trunk/LayoutTests/js/array-fill-expected.txt (rev 0)
+++ trunk/LayoutTests/js/array-fill-expected.txt 2014-04-16 20:10:41 UTC (rev 167380)
@@ -0,0 +1,20 @@
+This test checks the behavior of the Array.prototype.fill()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS [0, 0, 0, 0, 0].fill() is [undefined, undefined, undefined, undefined, undefined]
+PASS [0, 0, 0, 0, 0].fill(3) is [3, 3, 3, 3, 3]
+PASS [0, 0, 0, 0, 0].fill(3, 1) is [0, 3, 3, 3, 3]
+PASS [0, 0, 0, 0, 0].fill(3, 1, 3) is [0, 3, 3, 0, 0]
+PASS [0, 0, 0, 0, 0].fill(3, 1, 1000) is [0, 3, 3, 3, 3]
+PASS [0, 0, 0, 0, 0].fill(3, -2, 1000) is [0, 0, 0, 3, 3]
+PASS [0, 0, 0, 0, 0].fill(3, -2, 4) is [0, 0, 0, 3, 0]
+PASS [0, 0, 0, 0, 0].fill(3, -2, -1) is [0, 0, 0, 3, 0]
+PASS [0, 0, 0, 0, 0].fill(3, -2, -3) is [0, 0, 0, 0, 0]
+PASS [0, 0, 0, 0, 0].fill(3, undefined, 4) is [3, 3, 3, 3, 0]
+PASS [ , , , , 0].fill(3, 1, 3) is [, 3, 3, , 0]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/js/array-fill.html (0 => 167380)
--- trunk/LayoutTests/js/array-fill.html (rev 0)
+++ trunk/LayoutTests/js/array-fill.html 2014-04-16 20:10:41 UTC (rev 167380)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (167379 => 167380)
--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js 2014-04-16 20:02:48 UTC (rev 167379)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js 2014-04-16 20:10:41 UTC (rev 167380)
@@ -53,7 +53,7 @@
"Function": "['length', 'name', 'prototype']",
"Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']",
"Array": "['isArray', 'length', 'name', 'prototype']",
- "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']",
+ "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']",
"String": "['fromCharCode', 'length', 'name', 'prototype']",
"String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']",
"Boolean": "['length', 'name', 'prototype']",
Added: trunk/LayoutTests/js/script-tests/array-fill.js (0 => 167380)
--- trunk/LayoutTests/js/script-tests/array-fill.js (rev 0)
+++ trunk/LayoutTests/js/script-tests/array-fill.js 2014-04-16 20:10:41 UTC (rev 167380)
@@ -0,0 +1,18 @@
+description(
+"This test checks the behavior of the Array.prototype.fill()"
+);
+
+shouldBe("[0, 0, 0, 0, 0].fill()", "[undefined, undefined, undefined, undefined, undefined]");
+shouldBe("[0, 0, 0, 0, 0].fill(3)", "[3, 3, 3, 3, 3]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, 1)", "[0, 3, 3, 3, 3]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, 1, 3)", "[0, 3, 3, 0, 0]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, 1, 1000)", "[0, 3, 3, 3, 3]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, -2, 1000)", "[0, 0, 0, 3, 3]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, -2, 4)", "[0, 0, 0, 3, 0]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, -2, -1)", "[0, 0, 0, 3, 0]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, -2, -3)", "[0, 0, 0, 0, 0]");
+shouldBe("[0, 0, 0, 0, 0].fill(3, undefined, 4)", "[3, 3, 3, 3, 0]");
+shouldBe("[ , , , , 0].fill(3, 1, 3)", "[, 3, 3, , 0]");
+
+
+successfullyParsed = true;
Modified: trunk/Source/_javascript_Core/ChangeLog (167379 => 167380)
--- trunk/Source/_javascript_Core/ChangeLog 2014-04-16 20:02:48 UTC (rev 167379)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-04-16 20:10:41 UTC (rev 167380)
@@ -1,3 +1,16 @@
+2014-04-16 Oliver Hunt <oli...@apple.com>
+
+ Simple ES6 feature:Array.prototype.fill
+ https://bugs.webkit.org/show_bug.cgi?id=131703
+
+ Reviewed by David Hyatt.
+
+ Add support for Array.prototype.fill
+
+ * builtins/Array.prototype.js:
+ (fill):
+ * runtime/ArrayPrototype.cpp:
+
2014-04-16 Mark Hahnenberg <mhahnenb...@apple.com>
[WebKit] Cleanup the build from uninitialized variable in _javascript_Core
Modified: trunk/Source/_javascript_Core/builtins/Array.prototype.js (167379 => 167380)
--- trunk/Source/_javascript_Core/builtins/Array.prototype.js 2014-04-16 20:02:48 UTC (rev 167379)
+++ trunk/Source/_javascript_Core/builtins/Array.prototype.js 2014-04-16 20:10:41 UTC (rev 167380)
@@ -147,3 +147,45 @@
}
return false;
}
+
+function fill(value /* [, start [, end]] */)
+{
+ "use strict";
+ if (this === null)
+ throw new @TypeError("Array.prototype.fill requires that |this| not be null");
+
+ if (this === undefined)
+ throw new @TypeError("Array.prototype.fill requires that |this| not be undefined");
+ var O = @Object(this);
+ var len = O.length >>> 0;
+ var relativeStart = 0;
+ if (arguments.length > 1 && arguments[1] !== undefined)
+ relativeStart = arguments[1] | 0;
+ var k = 0;
+ if (relativeStart < 0) {
+ k = len + relativeStart;
+ if (k < 0)
+ k = 0;
+ } else {
+ k = relativeStart;
+ if (k > len)
+ k = len;
+ }
+ var relativeEnd = len;
+ if (arguments.length > 2 && arguments[2] !== undefined)
+ relativeEnd = arguments[2] | 0;
+ var final = 0;
+ if (relativeEnd < 0) {
+ final = len + relativeEnd;
+ if (final < 0)
+ final = 0;
+ } else {
+ final = relativeEnd;
+ if (final > len)
+ final = len;
+ }
+ for (; k < final; k++)
+ O[k] = value;
+ return O;
+}
+
Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (167379 => 167380)
--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2014-04-16 20:02:48 UTC (rev 167379)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2014-04-16 20:10:41 UTC (rev 167380)
@@ -94,6 +94,7 @@
toString arrayProtoFuncToString DontEnum|Function 0
toLocaleString arrayProtoFuncToLocaleString DontEnum|Function 0
concat arrayProtoFuncConcat DontEnum|Function 1
+ fill arrayProtoFuncFill DontEnum|Function 1
join arrayProtoFuncJoin DontEnum|Function 1
pop arrayProtoFuncPop DontEnum|Function 0
push arrayProtoFuncPush DontEnum|Function 1