Title: [279937] trunk
Revision
279937
Author
[email protected]
Date
2021-07-14 20:11:53 -0700 (Wed, 14 Jul 2021)

Log Message

Implement Array.prototype.findLast and Array.prototype.findLastIndex
https://bugs.webkit.org/show_bug.cgi?id=227939

Reviewed by Yusuke Suzuki.

JSTests:

* stress/typedarray-findLast.js: Added.
(keepEven):
(keepEvenAndChange):
(isBigEnoughAndException):

* stress/typedarray-findLastIndex.js: Added.
(keepEven):
(keepEvenAndChange):
(isBigEnoughAndException):

Source/_javascript_Core:

* builtins/ArrayPrototype.js:
(findLast): Added.
(findLastIndex): Added.
(JSC::ArrayPrototype::finishCreation):
* runtime/JSTypedArrayViewPrototype.cpp:

* builtins/TypedArrayPrototype.js:
(findLast): Added.
(findLastIndex): Added.
* runtime/ArrayPrototype.cpp:
(JSC::JSTypedArrayViewPrototype::finishCreation):

* runtime/OptionsList.h:

Source/WebInspectorUI:

* UserInterface/Models/NativeFunctionParameters.js:

LayoutTests:

* js/array-findLast.html: Added.
* js/array-findLast-expected.txt: Added.
* js/script-tests/array-findLast.js: Added.
(passUndefined):
(passZero):
(passNull):
(passFalse):
(passEmptyString):
(passEven):
(passAfter5):
(toObject):
(findItemAddedDuringSearch):
(numberOfCallbacksInFindInArrayWithHoles):
(throwError):

* js/array-findLastIndex.html: Added.
* js/array-findLastIndex-expected.txt: Added.
* js/script-tests/array-findLastIndex.js: Added.
(passUndefined):
(passZero):
(passNull):
(passFalse):
(passEmptyString):
(passEven):
(passAfter5):
(toObject):
(findItemAddedDuringSearch):
(numberOfCallbacksInFindIndexInArrayWithHoles):
(throwError):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (279936 => 279937)


--- trunk/JSTests/ChangeLog	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/JSTests/ChangeLog	2021-07-15 03:11:53 UTC (rev 279937)
@@ -1,3 +1,20 @@
+2021-07-14  Devin Rousso  <[email protected]>
+
+        Implement Array.prototype.findLast and Array.prototype.findLastIndex
+        https://bugs.webkit.org/show_bug.cgi?id=227939
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/typedarray-findLast.js: Added.
+        (keepEven):
+        (keepEvenAndChange):
+        (isBigEnoughAndException):
+
+        * stress/typedarray-findLastIndex.js: Added.
+        (keepEven):
+        (keepEvenAndChange):
+        (isBigEnoughAndException):
+
 2021-07-14  Keith Miller  <[email protected]>
 
         Unreviewed, test gardening.

Added: trunk/JSTests/stress/typedarray-findLast.js (0 => 279937)


--- trunk/JSTests/stress/typedarray-findLast.js	                        (rev 0)
+++ trunk/JSTests/stress/typedarray-findLast.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,57 @@
+//@ requireOptions("--useArrayFindLastMethod=true")
+load("./resources/typedarray-test-helper-functions.js", "caller relative");
+description(
+"This test checks the behavior of the TypedArray.prototype.findLast function"
+);
+
+shouldBe("Int32Array.prototype.findLast.length", "1");
+shouldBe("Int32Array.prototype.findLast.name", "'findLast'");
+shouldBeTrue("isSameFunctionForEachTypedArrayPrototype('findLast')");
+shouldBeTrue("testPrototypeReceivesArray('findLast', [undefined, this, { }, [ ], true, ''])");
+debug("");
+
+debug("testPrototypeFunction has the following arg list (name, args, init, result [ , expectedArray ])");
+debug("");
+
+debug("1.0 Single Argument Testing");
+function keepEven(e, i) {
+    return !(e & 1) || (this.keep ? this.keep === i : false);
+}
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEven)', [12, 5, 8, 13, 44], 44)");
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEven)', [11, 13, 17, 13, 22], 22)");
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEven)', [22, 13, 17, 13, 11], 22)");
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEven)', [11, 13, 17, 13, 11], undefined)");
+debug("");
+
+debug("2.0 Two Argument Testing");
+var thisValue = { keep: 3 };
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEven, thisValue)', [11, 23, 11, 1, 44], 44)");
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEven, thisValue)', [11, 23, 11, 1, 43], 1)");
+debug("");
+
+debug("3.0 Array Element Changing");
+function keepEvenAndChange(e, i, a) {
+    a[a.length - 1 - i] = 5;
+    return !(e & 1);
+}
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEvenAndChange)', [11, 15, 3, 12, 44], 44, [5, 15, 3, 12, 44])");
+shouldBeTrue("testPrototypeFunction('findLast', '(keepEvenAndChange)', [44, 12, 3, 15, 11], undefined, [5, 5, 5, 5, 5])");
+debug("");
+
+debug("4.0 Exception Test");
+function isBigEnoughAndException(element, index, array) {
+    if(index==3) throw "exception from function";
+    return (element == 44);
+}
+shouldBeTrue("testPrototypeFunction('findLast', '(isBigEnoughAndException)', [12, 15, 10, 13, 44], 44)");
+shouldThrow("testPrototypeFunction('findLast', '(isBigEnoughAndException)', [9, 15, 10, 13, 43], false)");
+debug("");
+
+debug("5.0 Wrong Type for Callback Test");
+shouldThrow("testPrototypeFunction('findLast', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLast callback must be a function'");
+shouldThrow("testPrototypeFunction('findLast', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLast callback must be a function'");
+shouldThrow("testPrototypeFunction('findLast', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLast callback must be a function'");
+shouldThrow("testPrototypeFunction('findLast', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLast callback must be a function'");
+shouldThrow("testPrototypeFunction('findLast', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLast callback must be a function'");
+debug("");
+finishJSTest();

Added: trunk/JSTests/stress/typedarray-findLastIndex.js (0 => 279937)


--- trunk/JSTests/stress/typedarray-findLastIndex.js	                        (rev 0)
+++ trunk/JSTests/stress/typedarray-findLastIndex.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,57 @@
+//@ requireOptions("--useArrayFindLastMethod=true")
+load("./resources/typedarray-test-helper-functions.js", "caller relative");
+description(
+"This test checks the behavior of the TypedArray.prototype.findLastIndex function"
+);
+
+shouldBe("Int32Array.prototype.findLastIndex.length", "1");
+shouldBe("Int32Array.prototype.findLastIndex.name", "'findLastIndex'");
+shouldBeTrue("isSameFunctionForEachTypedArrayPrototype('findLastIndex')");
+shouldBeTrue("testPrototypeReceivesArray('findLastIndex', [undefined, this, { }, [ ], true, ''])");
+debug("");
+
+debug("testPrototypeFunction has the following arg list (name, args, init, result [ , expectedArray ])");
+debug("");
+
+debug("1.0 Single Argument Testing");
+function keepEven(e, i) {
+    return !(e & 1) || (this.keep ? this.keep === i : false);
+}
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEven)', [12, 5, 8, 13, 44], 4)");
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEven)', [11, 13, 17, 13, 22], 4)");
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEven)', [22, 13, 17, 13, 11], 0)");
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEven)', [11, 13, 17, 13, 11], -1)");
+debug("");
+
+debug("2.0 Two Argument Testing");
+var thisValue = { keep: 3 };
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEven, thisValue)', [11, 23, 11, 1, 44], 4)");
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEven, thisValue)', [11, 23, 11, 1, 43], 3)");
+debug("");
+
+debug("3.0 Array Element Changing");
+function keepEvenAndChange(e, i, a) {
+    a[a.length - 1 - i] = 5;
+    return !(e & 1);
+}
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEvenAndChange)', [11, 15, 3, 12, 44], 4, [5, 15, 3, 12, 44])");
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(keepEvenAndChange)', [44, 12, 3, 15, 11], -1, [5, 5, 5, 5, 5])");
+debug("");
+
+debug("4.0 Exception Test");
+function isBigEnoughAndException(element, index, array) {
+    if(index==3) throw "exception from function";
+    return (element >= 44);
+}
+shouldBeTrue("testPrototypeFunction('findLastIndex', '(isBigEnoughAndException)', [12, 15, 10, 13, 44], 4)");
+shouldThrow("testPrototypeFunction('findLastIndex', '(isBigEnoughAndException)', [9, 15, 10, 13, 43], false)");
+debug("");
+
+debug("5.0 Wrong Type for Callback Test");
+shouldThrow("testPrototypeFunction('findLastIndex', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLastIndex callback must be a function'");
+shouldThrow("testPrototypeFunction('findLastIndex', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLastIndex callback must be a function'");
+shouldThrow("testPrototypeFunction('findLastIndex', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLastIndex callback must be a function'");
+shouldThrow("testPrototypeFunction('findLastIndex', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLastIndex callback must be a function'");
+shouldThrow("testPrototypeFunction('findLastIndex', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findLastIndex callback must be a function'");
+debug("");
+finishJSTest();

Modified: trunk/LayoutTests/ChangeLog (279936 => 279937)


--- trunk/LayoutTests/ChangeLog	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/LayoutTests/ChangeLog	2021-07-15 03:11:53 UTC (rev 279937)
@@ -1,3 +1,40 @@
+2021-07-14  Devin Rousso  <[email protected]>
+
+        Implement Array.prototype.findLast and Array.prototype.findLastIndex
+        https://bugs.webkit.org/show_bug.cgi?id=227939
+
+        Reviewed by Yusuke Suzuki.
+
+        * js/array-findLast.html: Added.
+        * js/array-findLast-expected.txt: Added.
+        * js/script-tests/array-findLast.js: Added.
+        (passUndefined):
+        (passZero):
+        (passNull):
+        (passFalse):
+        (passEmptyString):
+        (passEven):
+        (passAfter5):
+        (toObject):
+        (findItemAddedDuringSearch):
+        (numberOfCallbacksInFindInArrayWithHoles):
+        (throwError):
+
+        * js/array-findLastIndex.html: Added.
+        * js/array-findLastIndex-expected.txt: Added.
+        * js/script-tests/array-findLastIndex.js: Added.
+        (passUndefined):
+        (passZero):
+        (passNull):
+        (passFalse):
+        (passEmptyString):
+        (passEven):
+        (passAfter5):
+        (toObject):
+        (findItemAddedDuringSearch):
+        (numberOfCallbacksInFindIndexInArrayWithHoles):
+        (throwError):
+
 2021-07-14  Eric Hutchison  <[email protected]>
 
         Update expectations for webanimations/multiple-transform-properties-and-multiple-transform-properties-animation-with-delay-on-forced-layer.html.

Added: trunk/LayoutTests/js/array-findLast-expected.txt (0 => 279937)


--- trunk/LayoutTests/js/array-findLast-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/array-findLast-expected.txt	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,71 @@
+Tests for Array.prototype.findLast
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Array.prototype.findLast.length is 1
+PASS Array.prototype.findLast.name is 'findLast'
+PASS [undefined, 0, null, false, ''].findLast(passUndefined) is undefined
+PASS [undefined, 0, null, false, ''].findLast(passZero) is 0
+PASS [undefined, 0, null, false, ''].findLast(passNull) is null
+PASS [undefined, 0, null, false, ''].findLast(passFalse) is false
+PASS [undefined, 0, null, false, ''].findLast(passEmptyString) is ''
+PASS [0,1,2,3,4,5,6,7,8,9].findLast(passEven) is 8
+PASS [0,1,2,3,4,5,6,7,8,9].findLast(passAfter5) is 9
+PASS [0, null, false, ''].findLast(passUndefined) is undefined
+PASS [undefined, 0, false, ''].findLast(passNull) is undefined
+PASS [undefined, 0, null, ''].findLast(passFalse) is undefined
+PASS [undefined, 0, null, false].findLast(passEmptyString) is undefined
+PASS [1,3,5,7,9].findLast(passEven) is undefined
+PASS [0,1,2,3,4].findLast(passAfter5) is undefined
+PASS [undefined, null, false, ''].findLast(passZero) is undefined
+Array with holes
+PASS (new Array(20)).findLast(passUndefined) is undefined
+PASS arrayWithHoles.findLast(passUndefined) is undefined
+PASS arrayWithHoles.findLast(passZero) is 0
+PASS arrayWithHoles.findLast(passNull) is null
+PASS arrayWithHoles.findLast(passFalse) is false
+PASS arrayWithHoles.findLast(passEmptyString) is ''
+PASS arrayWithHoles.findLast(passAfter5) is ''
+Generic Object
+PASS toObject([undefined, 0, null, false, '']).findLast(passUndefined) is undefined
+PASS toObject([undefined, 0, null, false, '']).findLast(passZero) is 0
+PASS toObject([undefined, 0, null, false, '']).findLast(passNull) is null
+PASS toObject([undefined, 0, null, false, '']).findLast(passFalse) is false
+PASS toObject([undefined, 0, null, false, '']).findLast(passEmptyString) is ''
+PASS toObject([0, null, false, '']).findLast(passUndefined) is undefined
+PASS toObject([undefined, 0, false, '']).findLast(passNull) is undefined
+PASS toObject([undefined, 0, null, '']).findLast(passFalse) is undefined
+PASS toObject([undefined, 0, null, false]).findLast(passEmptyString) is undefined
+PASS toObject([undefined, null, false, '']).findLast(passZero) is undefined
+PASS toObject(new Array(20)).findLast(passUndefined) is undefined
+Array-like object with invalid lengths
+PASS var obj = { 0: 1, 1: 2, 2: 3, length: 0 }; Array.prototype.findLast.call(obj, throwError) is undefined.
+PASS var obj = { 0: 1, 1: 2, 2: 3, length: -0 }; Array.prototype.findLast.call(obj, throwError) is undefined.
+PASS var obj = { 0: 1, 1: 2, 2: 3, length: -3 }; Array.prototype.findLast.call(obj, throwError) is undefined.
+Modification during search
+PASS [0,1,2,3,4,5,6,7,8,9].findLast(findItemAddedDuringSearch) is undefined
+PASS [0,1,2,3,4,5,6,7,8,9].findLast(findItemRemovedDuringSearch) is undefined
+Exceptions
+PASS Array.prototype.findLast.call(undefined, function() {}) threw exception TypeError: Array.prototype.findLast requires that |this| not be null or undefined.
+PASS Array.prototype.findLast.call(null, function() {}) threw exception TypeError: Array.prototype.findLast requires that |this| not be null or undefined.
+PASS [].findLast(1) threw exception TypeError: Array.prototype.findLast callback must be a function.
+PASS [].findLast('hello') threw exception TypeError: Array.prototype.findLast callback must be a function.
+PASS [].findLast([]) threw exception TypeError: Array.prototype.findLast callback must be a function.
+PASS [].findLast({}) threw exception TypeError: Array.prototype.findLast callback must be a function.
+PASS [].findLast(null) threw exception TypeError: Array.prototype.findLast callback must be a function.
+PASS [].findLast(undefined) threw exception TypeError: Array.prototype.findLast callback must be a function.
+Callbacks in the expected order and *not* skipping holes
+findLast callback called with index 7
+findLast callback called with index 6
+findLast callback called with index 5
+findLast callback called with index 4
+findLast callback called with index 3
+findLast callback called with index 2
+findLast callback called with index 1
+findLast callback called with index 0
+PASS numberOfCallbacksInFindInArrayWithHoles() is 8
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/array-findLast.html (0 => 279937)


--- trunk/LayoutTests/js/array-findLast.html	                        (rev 0)
+++ trunk/LayoutTests/js/array-findLast.html	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useArrayFindLastMethod=true ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/js/array-findLastIndex-expected.txt (0 => 279937)


--- trunk/LayoutTests/js/array-findLastIndex-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/array-findLastIndex-expected.txt	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,72 @@
+Tests for Array.prototype.findLastIndex
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Array.prototype.findLastIndex.length is 1
+PASS Array.prototype.findLastIndex.name is 'findLastIndex'
+PASS [undefined, 0, null, false, ''].findLastIndex(passUndefined) is 0
+PASS [undefined, 0, null, false, ''].findLastIndex(passZero) is 1
+PASS [undefined, 0, null, false, ''].findLastIndex(passNull) is 2
+PASS [undefined, 0, null, false, ''].findLastIndex(passFalse) is 3
+PASS [undefined, 0, null, false, ''].findLastIndex(passEmptyString) is 4
+PASS [0,1,2,3,4,5,6,7,8,9].findLastIndex(passEven) is 8
+PASS [0,1,2,3,4,5,6,7,8,9].findLastIndex(passAfter5) is 9
+PASS [0, null, false, ''].findLastIndex(passUndefined) is -1
+PASS [undefined, 0, false, ''].findLastIndex(passNull) is -1
+PASS [undefined, 0, null, ''].findLastIndex(passFalse) is -1
+PASS [undefined, 0, null, false].findLastIndex(passEmptyString) is -1
+PASS [1,3,5,7,9].findLastIndex(passEven) is -1
+PASS [0,1,2,3,4].findLastIndex(passAfter5) is -1
+PASS [undefined, null, false, ''].findLastIndex(passZero) is -1
+Array with holes
+PASS (new Array(20)).findLastIndex(passUndefined) is 19
+PASS arrayWithHoles.findLastIndex(passUndefined) is 6
+PASS arrayWithHoles.findLastIndex(passZero) is 1
+PASS arrayWithHoles.findLastIndex(passNull) is 3
+PASS arrayWithHoles.findLastIndex(passFalse) is 5
+PASS arrayWithHoles.findLastIndex(passEmptyString) is 7
+PASS arrayWithHoles.findLastIndex(passAfter5) is 7
+PASS arrayWithHoles.findLastIndex(passUndefined) is 4
+Generic Object
+PASS toObject([undefined, 0, null, false, '']).findLastIndex(passUndefined) is 0
+PASS toObject([undefined, 0, null, false, '']).findLastIndex(passZero) is 1
+PASS toObject([undefined, 0, null, false, '']).findLastIndex(passNull) is 2
+PASS toObject([undefined, 0, null, false, '']).findLastIndex(passFalse) is 3
+PASS toObject([undefined, 0, null, false, '']).findLastIndex(passEmptyString) is 4
+PASS toObject([0, null, false, '']).findLastIndex(passUndefined) is -1
+PASS toObject([undefined, 0, false, '']).findLastIndex(passNull) is -1
+PASS toObject([undefined, 0, null, '']).findLastIndex(passFalse) is -1
+PASS toObject([undefined, 0, null, false]).findLastIndex(passEmptyString) is -1
+PASS toObject([undefined, null, false, '']).findLastIndex(passZero) is -1
+PASS toObject(new Array(20)).findLastIndex(passUndefined) is 19
+Array-like object with invalid lengths
+PASS var obj = { 0: 1, 1: 2, 2: 3, length: 0 }; Array.prototype.findLastIndex.call(obj, throwError) is -1
+PASS var obj = { 0: 1, 1: 2, 2: 3, length: -0 }; Array.prototype.findLastIndex.call(obj, throwError) is -1
+PASS var obj = { 0: 1, 1: 2, 2: 3, length: -3 }; Array.prototype.findLastIndex.call(obj, throwError) is -1
+Modification during search
+PASS [0,1,2,3,4,5,6,7,8,9].findLastIndex(findItemAddedDuringSearch) is -1
+PASS [0,1,2,3,4,5,6,7,8,9].findLastIndex(findItemRemovedDuringSearch) is -1
+Exceptions
+PASS Array.prototype.findLastIndex.call(undefined, function() {}) threw exception TypeError: Array.prototype.findLastIndex requires that |this| not be null or undefined.
+PASS Array.prototype.findLastIndex.call(null, function() {}) threw exception TypeError: Array.prototype.findLastIndex requires that |this| not be null or undefined.
+PASS [].findLastIndex(1) threw exception TypeError: Array.prototype.findLastIndex callback must be a function.
+PASS [].findLastIndex('hello') threw exception TypeError: Array.prototype.findLastIndex callback must be a function.
+PASS [].findLastIndex([]) threw exception TypeError: Array.prototype.findLastIndex callback must be a function.
+PASS [].findLastIndex({}) threw exception TypeError: Array.prototype.findLastIndex callback must be a function.
+PASS [].findLastIndex(null) threw exception TypeError: Array.prototype.findLastIndex callback must be a function.
+PASS [].findLastIndex(undefined) threw exception TypeError: Array.prototype.findLastIndex callback must be a function.
+Callbacks in the expected order and *not* skipping holes
+find callback called with index 0
+find callback called with index 1
+find callback called with index 2
+find callback called with index 3
+find callback called with index 4
+find callback called with index 5
+find callback called with index 6
+find callback called with index 7
+PASS numberOfCallbacksInFindIndexInArrayWithHoles() is 8
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/array-findLastIndex.html (0 => 279937)


--- trunk/LayoutTests/js/array-findLastIndex.html	                        (rev 0)
+++ trunk/LayoutTests/js/array-findLastIndex.html	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useArrayFindLastMethod=true ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/js/script-tests/array-findLast.js (0 => 279937)


--- trunk/LayoutTests/js/script-tests/array-findLast.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/array-findLast.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,120 @@
+//@ requireOptions("--useArrayFindLastMethod=true")
+description("Tests for Array.prototype.findLast");
+
+shouldBe("Array.prototype.findLast.length", "1");
+shouldBe("Array.prototype.findLast.name", "'findLast'");
+
+function passUndefined(element, index, array) {
+    return typeof element === "undefined";
+}
+function passZero(element, index, array) {
+    return element === 0;
+}
+function passNull(element, index, array) {
+    return element === null;
+}
+function passFalse(element, index, array) {
+    return element === false;
+}
+function passEmptyString(element, index, array) {
+    return element === "";
+}
+function passEven(a) {
+    return !(a & 1);
+}
+function passAfter5(element, index) {
+    return index >= 5;
+}
+function toObject(array) {
+    var result = {};
+    result.length = array.length;
+    for (var i in array)
+        result[i] = array[i];
+    result.findLast=Array.prototype.findLast;
+    return result;
+}
+function findItemAddedDuringSearch(element, index, array) {
+    if (index === array.length - 1)
+        array.unshift(array.length);
+    return (index === array.length - 1);
+}
+function findItemRemovedDuringSearch(element, index, array) {
+    if (index === 0)
+        array.shift();
+    return (index === 0 && array[0] === element);
+}
+arrayWithHoles = [];
+arrayWithHoles[1] = 0;
+arrayWithHoles[3] = null;
+arrayWithHoles[5] = false;
+arrayWithHoles[7] = "";
+function numberOfCallbacksInFindInArrayWithHoles() {
+    var count = 0;
+    arrayWithHoles.findLast(function(element, index, array) {
+        debug("findLast callback called with index " + index);
+        count++;
+    });
+    return count;
+}
+
+shouldBe("[undefined, 0, null, false, ''].findLast(passUndefined)", "undefined");
+shouldBe("[undefined, 0, null, false, ''].findLast(passZero)", "0");
+shouldBe("[undefined, 0, null, false, ''].findLast(passNull)", "null");
+shouldBe("[undefined, 0, null, false, ''].findLast(passFalse)", "false");
+shouldBe("[undefined, 0, null, false, ''].findLast(passEmptyString)", "''");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLast(passEven)", "8");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLast(passAfter5)", "9");
+shouldBe("[0, null, false, ''].findLast(passUndefined)", "undefined");
+shouldBe("[undefined, 0, false, ''].findLast(passNull)", "undefined");
+shouldBe("[undefined, 0, null, ''].findLast(passFalse)", "undefined");
+shouldBe("[undefined, 0, null, false].findLast(passEmptyString)", "undefined");
+shouldBe("[1,3,5,7,9].findLast(passEven)", "undefined");
+shouldBe("[0,1,2,3,4].findLast(passAfter5)", "undefined");
+shouldBe("[undefined, null, false, ''].findLast(passZero)", "undefined");
+
+debug("Array with holes")
+shouldBe("(new Array(20)).findLast(passUndefined)", "undefined");
+shouldBe("arrayWithHoles.findLast(passUndefined)", "undefined");
+shouldBe("arrayWithHoles.findLast(passZero)", "0");
+shouldBe("arrayWithHoles.findLast(passNull)", "null");
+shouldBe("arrayWithHoles.findLast(passFalse)", "false");
+shouldBe("arrayWithHoles.findLast(passEmptyString)", "''");
+shouldBe("arrayWithHoles.findLast(passAfter5)", "''");
+
+debug("Generic Object");
+shouldBe("toObject([undefined, 0, null, false, '']).findLast(passUndefined)", "undefined");
+shouldBe("toObject([undefined, 0, null, false, '']).findLast(passZero)", "0");
+shouldBe("toObject([undefined, 0, null, false, '']).findLast(passNull)", "null");
+shouldBe("toObject([undefined, 0, null, false, '']).findLast(passFalse)", "false");
+shouldBe("toObject([undefined, 0, null, false, '']).findLast(passEmptyString)", "''");
+shouldBe("toObject([0, null, false, '']).findLast(passUndefined)", "undefined");
+shouldBe("toObject([undefined, 0, false, '']).findLast(passNull)", "undefined");
+shouldBe("toObject([undefined, 0, null, '']).findLast(passFalse)", "undefined");
+shouldBe("toObject([undefined, 0, null, false]).findLast(passEmptyString)", "undefined");
+shouldBe("toObject([undefined, null, false, '']).findLast(passZero)", "undefined");
+shouldBe("toObject(new Array(20)).findLast(passUndefined)", "undefined");
+
+debug("Array-like object with invalid lengths");
+var throwError = function throwError() {
+    throw new Error("should not reach here");
+};
+shouldBeUndefined("var obj = { 0: 1, 1: 2, 2: 3, length: 0 }; Array.prototype.findLast.call(obj, throwError)");
+shouldBeUndefined("var obj = { 0: 1, 1: 2, 2: 3, length: -0 }; Array.prototype.findLast.call(obj, throwError)");
+shouldBeUndefined("var obj = { 0: 1, 1: 2, 2: 3, length: -3 }; Array.prototype.findLast.call(obj, throwError)");
+
+debug("Modification during search");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLast(findItemAddedDuringSearch)", "undefined");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLast(findItemRemovedDuringSearch)", "undefined");
+
+debug("Exceptions");
+shouldThrow("Array.prototype.findLast.call(undefined, function() {})", "'TypeError: Array.prototype.findLast requires that |this| not be null or undefined'");
+shouldThrow("Array.prototype.findLast.call(null, function() {})", "'TypeError: Array.prototype.findLast requires that |this| not be null or undefined'");
+shouldThrow("[].findLast(1)", "'TypeError: Array.prototype.findLast callback must be a function'");
+shouldThrow("[].findLast('hello')", "'TypeError: Array.prototype.findLast callback must be a function'");
+shouldThrow("[].findLast([])", "'TypeError: Array.prototype.findLast callback must be a function'");
+shouldThrow("[].findLast({})", "'TypeError: Array.prototype.findLast callback must be a function'");
+shouldThrow("[].findLast(null)", "'TypeError: Array.prototype.findLast callback must be a function'");
+shouldThrow("[].findLast(undefined)", "'TypeError: Array.prototype.findLast callback must be a function'");
+
+debug("Callbacks in the expected order and *not* skipping holes");
+shouldBe("numberOfCallbacksInFindInArrayWithHoles()", "8");

Added: trunk/LayoutTests/js/script-tests/array-findLastIndex.js (0 => 279937)


--- trunk/LayoutTests/js/script-tests/array-findLastIndex.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/array-findLastIndex.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -0,0 +1,122 @@
+//@ requireOptions("--useArrayFindLastMethod=true")
+description("Tests for Array.prototype.findLastIndex");
+
+shouldBe("Array.prototype.findLastIndex.length", "1");
+shouldBe("Array.prototype.findLastIndex.name", "'findLastIndex'");
+
+function passUndefined(element, index, array) {
+    return typeof element === "undefined";
+}
+function passZero(element, index, array) {
+    return element === 0;
+}
+function passNull(element, index, array) {
+    return element === null;
+}
+function passFalse(element, index, array) {
+    return element === false;
+}
+function passEmptyString(element, index, array) {
+    return element === "";
+}
+function passEven(a) {
+    return !(a & 1);
+}
+function passAfter5(element, index) {
+    return index >= 5;
+}
+function toObject(array) {
+    var result = {};
+    result.length = array.length;
+    for (var i in array)
+        result[i] = array[i];
+    result.findLastIndex = Array.prototype.findLastIndex;
+    return result;
+}
+function findItemAddedDuringSearch(element, index, array) {
+    if (index === array.length - 1)
+        array.unshift(array.length);
+    return (index === array.length - 1);
+}
+function findItemRemovedDuringSearch(element, index, array) {
+    if (index === 0)
+        array.shift();
+    return (index === 0 && array[0] === element);
+}
+var arrayWithHoles = [];
+arrayWithHoles[1] = 0;
+arrayWithHoles[3] = null;
+arrayWithHoles[5] = false;
+arrayWithHoles[7] = "";
+function numberOfCallbacksInFindIndexInArrayWithHoles() {
+    var count = 0;
+    arrayWithHoles.find(function(element, index, array) {
+        debug("find callback called with index " + index);
+        count++;
+    });
+    return count;
+}
+
+shouldBe("[undefined, 0, null, false, ''].findLastIndex(passUndefined)", "0");
+shouldBe("[undefined, 0, null, false, ''].findLastIndex(passZero)", "1");
+shouldBe("[undefined, 0, null, false, ''].findLastIndex(passNull)", "2");
+shouldBe("[undefined, 0, null, false, ''].findLastIndex(passFalse)", "3");
+shouldBe("[undefined, 0, null, false, ''].findLastIndex(passEmptyString)", "4");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLastIndex(passEven)", "8");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLastIndex(passAfter5)", "9");
+shouldBe("[0, null, false, ''].findLastIndex(passUndefined)", "-1");
+shouldBe("[undefined, 0, false, ''].findLastIndex(passNull)", "-1");
+shouldBe("[undefined, 0, null, ''].findLastIndex(passFalse)", "-1");
+shouldBe("[undefined, 0, null, false].findLastIndex(passEmptyString)", "-1");
+shouldBe("[1,3,5,7,9].findLastIndex(passEven)", "-1");
+shouldBe("[0,1,2,3,4].findLastIndex(passAfter5)", "-1");
+shouldBe("[undefined, null, false, ''].findLastIndex(passZero)", "-1");
+
+debug("Array with holes");
+shouldBe("(new Array(20)).findLastIndex(passUndefined)", "19");
+shouldBe("arrayWithHoles.findLastIndex(passUndefined)", "6");
+shouldBe("arrayWithHoles.findLastIndex(passZero)", "1");
+shouldBe("arrayWithHoles.findLastIndex(passNull)", "3");
+shouldBe("arrayWithHoles.findLastIndex(passFalse)", "5");
+shouldBe("arrayWithHoles.findLastIndex(passEmptyString)", "7");
+shouldBe("arrayWithHoles.findLastIndex(passAfter5)", "7");
+arrayWithHoles[6] = {};
+shouldBe("arrayWithHoles.findLastIndex(passUndefined)", "4");
+
+debug("Generic Object");
+shouldBe("toObject([undefined, 0, null, false, '']).findLastIndex(passUndefined)", "0");
+shouldBe("toObject([undefined, 0, null, false, '']).findLastIndex(passZero)", "1");
+shouldBe("toObject([undefined, 0, null, false, '']).findLastIndex(passNull)", "2");
+shouldBe("toObject([undefined, 0, null, false, '']).findLastIndex(passFalse)", "3");
+shouldBe("toObject([undefined, 0, null, false, '']).findLastIndex(passEmptyString)", "4");
+shouldBe("toObject([0, null, false, '']).findLastIndex(passUndefined)", "-1");
+shouldBe("toObject([undefined, 0, false, '']).findLastIndex(passNull)", "-1");
+shouldBe("toObject([undefined, 0, null, '']).findLastIndex(passFalse)", "-1");
+shouldBe("toObject([undefined, 0, null, false]).findLastIndex(passEmptyString)", "-1");
+shouldBe("toObject([undefined, null, false, '']).findLastIndex(passZero)", "-1");
+shouldBe("toObject(new Array(20)).findLastIndex(passUndefined)", "19");
+
+debug("Array-like object with invalid lengths");
+var throwError = function throwError() {
+    throw new Error("should not reach here");
+};
+shouldBe("var obj = { 0: 1, 1: 2, 2: 3, length: 0 }; Array.prototype.findLastIndex.call(obj, throwError)", "-1");
+shouldBe("var obj = { 0: 1, 1: 2, 2: 3, length: -0 }; Array.prototype.findLastIndex.call(obj, throwError)", "-1");
+shouldBe("var obj = { 0: 1, 1: 2, 2: 3, length: -3 }; Array.prototype.findLastIndex.call(obj, throwError)", "-1");
+
+debug("Modification during search");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLastIndex(findItemAddedDuringSearch)", "-1");
+shouldBe("[0,1,2,3,4,5,6,7,8,9].findLastIndex(findItemRemovedDuringSearch)", "-1");
+
+debug("Exceptions");
+shouldThrow("Array.prototype.findLastIndex.call(undefined, function() {})", "'TypeError: Array.prototype.findLastIndex requires that |this| not be null or undefined'");
+shouldThrow("Array.prototype.findLastIndex.call(null, function() {})", "'TypeError: Array.prototype.findLastIndex requires that |this| not be null or undefined'");
+shouldThrow("[].findLastIndex(1)", "'TypeError: Array.prototype.findLastIndex callback must be a function'");
+shouldThrow("[].findLastIndex('hello')", "'TypeError: Array.prototype.findLastIndex callback must be a function'");
+shouldThrow("[].findLastIndex([])", "'TypeError: Array.prototype.findLastIndex callback must be a function'");
+shouldThrow("[].findLastIndex({})", "'TypeError: Array.prototype.findLastIndex callback must be a function'");
+shouldThrow("[].findLastIndex(null)", "'TypeError: Array.prototype.findLastIndex callback must be a function'");
+shouldThrow("[].findLastIndex(undefined)", "'TypeError: Array.prototype.findLastIndex callback must be a function'");
+
+debug("Callbacks in the expected order and *not* skipping holes");
+shouldBe("numberOfCallbacksInFindIndexInArrayWithHoles()", "8");

Modified: trunk/Source/_javascript_Core/ChangeLog (279936 => 279937)


--- trunk/Source/_javascript_Core/ChangeLog	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-07-15 03:11:53 UTC (rev 279937)
@@ -1,3 +1,24 @@
+2021-07-14  Devin Rousso  <[email protected]>
+
+        Implement Array.prototype.findLast and Array.prototype.findLastIndex
+        https://bugs.webkit.org/show_bug.cgi?id=227939
+
+        Reviewed by Yusuke Suzuki.
+
+        * builtins/ArrayPrototype.js:
+        (findLast): Added.
+        (findLastIndex): Added.
+        (JSC::ArrayPrototype::finishCreation):
+        * runtime/JSTypedArrayViewPrototype.cpp:
+
+        * builtins/TypedArrayPrototype.js:
+        (findLast): Added.
+        (findLastIndex): Added.
+        * runtime/ArrayPrototype.cpp:
+        (JSC::JSTypedArrayViewPrototype::finishCreation):
+
+        * runtime/OptionsList.h:
+
 2021-07-14  Michael Saboff  <[email protected]>
 
         [macOS] Add new entitlement to limit process to a single JIT region

Modified: trunk/Source/_javascript_Core/builtins/ArrayPrototype.js (279936 => 279937)


--- trunk/Source/_javascript_Core/builtins/ArrayPrototype.js	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/_javascript_Core/builtins/ArrayPrototype.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -254,6 +254,25 @@
     return @undefined;
 }
 
+function findLast(callback /*, thisArg */)
+{
+    "use strict";
+
+    var array = @toObject(this, "Array.prototype.findLast requires that |this| not be null or undefined");
+    var length = @toLength(array.length);
+
+    if (!@isCallable(callback))
+        @throwTypeError("Array.prototype.findLast callback must be a function");
+
+    var thisArg = @argument(1);
+    for (var i = length - 1; i >= 0; i--) {
+        var element = array[i];
+        if (callback.@call(thisArg, element, i, array))
+            return element;
+    }
+    return @undefined;
+}
+
 function findIndex(callback /*, thisArg */)
 {
     "use strict";
@@ -272,6 +291,24 @@
     return -1;
 }
 
+function findLastIndex(callback /*, thisArg */)
+{
+    "use strict";
+
+    var array = @toObject(this, "Array.prototype.findLastIndex requires that |this| not be null or undefined");
+    var length = @toLength(array.length);
+
+    if (!@isCallable(callback))
+        @throwTypeError("Array.prototype.findLastIndex callback must be a function");
+
+    var thisArg = @argument(1);
+    for (var i = length - 1; i >= 0; i--) {
+        if (callback.@call(thisArg, array[i], i, array))
+            return i;
+    }
+    return -1;
+}
+
 function includes(searchElement /*, fromIndex*/)
 {
     "use strict";

Modified: trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js (279936 => 279937)


--- trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -86,6 +86,23 @@
     return @undefined;
 }
 
+function findLast(callback /* [, thisArg] */)
+{
+    "use strict";
+    var length = @typedArrayLength(this);
+    var thisArg = @argument(1);
+
+    if (!@isCallable(callback))
+        @throwTypeError("TypedArray.prototype.findLast callback must be a function");
+
+    for (var i = length - 1; i >= 0; i--) {
+        var element = this[i];
+        if (callback.@call(thisArg, element, i, this))
+            return element;
+    }
+    return @undefined;
+}
+
 function findIndex(callback /* [, thisArg] */)
 {
     "use strict";
@@ -102,6 +119,22 @@
     return -1;
 }
 
+function findLastIndex(callback /* [, thisArg] */)
+{
+    "use strict";
+    var length = @typedArrayLength(this);
+    var thisArg = @argument(1);
+
+    if (!@isCallable(callback))
+        @throwTypeError("TypedArray.prototype.findLastIndex callback must be a function");
+
+    for (var i = length - 1; i >= 0; i--) {
+        if (callback.@call(thisArg, this[i], i, this))
+            return i;
+    }
+    return -1;
+}
+
 function forEach(callback /* [, thisArg] */)
 {
     "use strict";

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (279936 => 279937)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2021-07-15 03:11:53 UTC (rev 279937)
@@ -108,7 +108,11 @@
     JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().keysPublicName(), arrayProtoFuncKeys, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ArrayKeysIntrinsic);
     JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().entriesPublicName(), arrayProtoFuncEntries, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ArrayEntriesIntrinsic);
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findPublicName(), arrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastPublicName(), arrayPrototypeFindLastCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastIndexPublicName(), arrayPrototypeFindLastIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
 
@@ -134,6 +138,10 @@
         &vm.propertyNames->builtinNames().keysPublicName(),
         &vm.propertyNames->builtinNames().valuesPublicName()
     };
+    if (Options::useArrayFindLastMethod()) {
+        unscopables->putDirect(vm, vm.propertyNames->builtinNames().findLastPublicName(), jsBoolean(true));
+        unscopables->putDirect(vm, vm.propertyNames->builtinNames().findLastIndexPublicName(), jsBoolean(true));
+    }
     if (Options::useAtMethod())
         unscopables->putDirect(vm, vm.propertyNames->builtinNames().atPublicName(), jsBoolean(true));
     for (const auto* unscopableName : unscopableNames)

Modified: trunk/Source/_javascript_Core/runtime/JSTypedArrayViewPrototype.cpp (279936 => 279937)


--- trunk/Source/_javascript_Core/runtime/JSTypedArrayViewPrototype.cpp	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/_javascript_Core/runtime/JSTypedArrayViewPrototype.cpp	2021-07-15 03:11:53 UTC (rev 279937)
@@ -453,7 +453,11 @@
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("includes", typedArrayViewProtoFuncIncludes, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().fillPublicName(), typedArrayViewProtoFuncFill, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("find", typedArrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastPublicName(), typedArrayPrototypeFindLastCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("findIndex", typedArrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastIndexPublicName(), typedArrayPrototypeFindLastIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->forEach, typedArrayPrototypeForEachCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("indexOf", typedArrayViewProtoFuncIndexOf, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->join, typedArrayViewProtoFuncJoin, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);

Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (279936 => 279937)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2021-07-15 03:11:53 UTC (rev 279937)
@@ -550,6 +550,7 @@
     v(Bool, useDataICInOptimizingJIT, false, Normal, nullptr) \
     v(Bool, useDataICSharing, false, Normal, nullptr) \
     v(Bool, useTemporal, false, Normal, "Expose the Temporal object.") \
+    v(Bool, useArrayFindLastMethod, false, Normal, "Expose the findLast() and findLastIndex() methods on Array and %TypedArray%.") \
 
 
 enum OptionEquivalence {

Modified: trunk/Source/WebInspectorUI/ChangeLog (279936 => 279937)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-07-15 03:11:53 UTC (rev 279937)
@@ -1,3 +1,12 @@
+2021-07-14  Devin Rousso  <[email protected]>
+
+        Implement Array.prototype.findLast and Array.prototype.findLastIndex
+        https://bugs.webkit.org/show_bug.cgi?id=227939
+
+        Reviewed by Yusuke Suzuki.
+
+        * UserInterface/Models/NativeFunctionParameters.js:
+
 2021-07-12  Patrick Angle  <[email protected]>
 
         Web Inspector: REGRESSION(r279510): Elements: Computed: an (i) button is shown for computed property traces

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (279936 => 279937)


--- trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js	2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js	2021-07-15 03:11:53 UTC (rev 279937)
@@ -249,6 +249,8 @@
         filter: "callback, [thisArg]",
         find: "callback, [thisArg]",
         findIndex: "callback, [thisArg]",
+        findLast: "callback, [thisArg]",
+        findLastIndex: "callback, [thisArg]",
         forEach: "callback, [thisArg]",
         includes: "searchValue, [startIndex=0]",
         indexOf: "searchValue, [startIndex=0]",
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to