<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[279937] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/279937">279937</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2021-07-14 20:11:53 -0700 (Wed, 14 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>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/JavaScriptCore:

* 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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsArrayPrototypejs">trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsTypedArrayPrototypejs">trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeArrayPrototypecpp">trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypecpp">trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeOptionsListh">trunk/Source/JavaScriptCore/runtime/OptionsList.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsNativeFunctionParametersjs">trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestsstresstypedarrayfindLastjs">trunk/JSTests/stress/typedarray-findLast.js</a></li>
<li><a href="#trunkJSTestsstresstypedarrayfindLastIndexjs">trunk/JSTests/stress/typedarray-findLastIndex.js</a></li>
<li><a href="#trunkLayoutTestsjsarrayfindLastexpectedtxt">trunk/LayoutTests/js/array-findLast-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrayfindLasthtml">trunk/LayoutTests/js/array-findLast.html</a></li>
<li><a href="#trunkLayoutTestsjsarrayfindLastIndexexpectedtxt">trunk/LayoutTests/js/array-findLastIndex-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrayfindLastIndexhtml">trunk/LayoutTests/js/array-findLastIndex.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrayfindLastjs">trunk/LayoutTests/js/script-tests/array-findLast.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrayfindLastIndexjs">trunk/LayoutTests/js/script-tests/array-findLastIndex.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog  2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/JSTests/ChangeLog     2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2021-07-14  Devin Rousso  <drousso@apple.com>
+
+        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):
+
</ins><span class="cx"> 2021-07-14  Keith Miller  <keith_miller@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, test gardening.
</span></span></pre></div>
<a id="trunkJSTestsstresstypedarrayfindLastjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/typedarray-findLast.js (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/typedarray-findLast.js                              (rev 0)
+++ trunk/JSTests/stress/typedarray-findLast.js 2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+//@ 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();
</ins></span></pre></div>
<a id="trunkJSTestsstresstypedarrayfindLastIndexjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/typedarray-findLastIndex.js (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/typedarray-findLastIndex.js                         (rev 0)
+++ trunk/JSTests/stress/typedarray-findLastIndex.js    2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+//@ 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();
</ins></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/LayoutTests/ChangeLog 2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2021-07-14  Devin Rousso  <drousso@apple.com>
+
+        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):
+
</ins><span class="cx"> 2021-07-14  Eric Hutchison  <ehutchison@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Update expectations for webanimations/multiple-transform-properties-and-multiple-transform-properties-animation-with-delay-on-forced-layer.html.
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrayfindLastexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/array-findLast-expected.txt (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+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
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrayfindLasthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/array-findLast.html (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/array-findLast.html                         (rev 0)
+++ trunk/LayoutTests/js/array-findLast.html    2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useArrayFindLastMethod=true ] -->
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script src="script-tests/array-findLast.js"></script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrayfindLastIndexexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/array-findLastIndex-expected.txt (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+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
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrayfindLastIndexhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/array-findLastIndex.html (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/array-findLastIndex.html                            (rev 0)
+++ trunk/LayoutTests/js/array-findLastIndex.html       2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useArrayFindLastMethod=true ] -->
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script src="script-tests/array-findLastIndex.js"></script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrayfindLastjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/array-findLast.js (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,120 @@
</span><ins>+//@ 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");
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrayfindLastIndexjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/array-findLastIndex.js (0 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+//@ 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");
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/JavaScriptCore/ChangeLog       2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2021-07-14  Devin Rousso  <drousso@apple.com>
+
+        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:
+
</ins><span class="cx"> 2021-07-14  Michael Saboff  <msaboff@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [macOS] Add new entitlement to limit process to a single JIT region
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsArrayPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js   2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js      2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -254,6 +254,25 @@
</span><span class="cx">     return @undefined;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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;
+}
+
</ins><span class="cx"> function findIndex(callback /*, thisArg */)
</span><span class="cx"> {
</span><span class="cx">     "use strict";
</span><span class="lines">@@ -272,6 +291,24 @@
</span><span class="cx">     return -1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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;
+}
+
</ins><span class="cx"> function includes(searchElement /*, fromIndex*/)
</span><span class="cx"> {
</span><span class="cx">     "use strict";
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsTypedArrayPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js      2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js 2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -86,6 +86,23 @@
</span><span class="cx">     return @undefined;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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;
+}
+
</ins><span class="cx"> function findIndex(callback /* [, thisArg] */)
</span><span class="cx"> {
</span><span class="cx">     "use strict";
</span><span class="lines">@@ -102,6 +119,22 @@
</span><span class="cx">     return -1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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;
+}
+
</ins><span class="cx"> function forEach(callback /* [, thisArg] */)
</span><span class="cx"> {
</span><span class="cx">     "use strict";
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeArrayPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp   2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp      2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -108,7 +108,11 @@
</span><span class="cx">     JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().keysPublicName(), arrayProtoFuncKeys, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ArrayKeysIntrinsic);
</span><span class="cx">     JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().entriesPublicName(), arrayProtoFuncEntries, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ArrayEntriesIntrinsic);
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findPublicName(), arrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><ins>+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastPublicName(), arrayPrototypeFindLastCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</ins><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><ins>+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastIndexPublicName(), arrayPrototypeFindLastIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</ins><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><span class="cx"> 
</span><span class="lines">@@ -134,6 +138,10 @@
</span><span class="cx">         &vm.propertyNames->builtinNames().keysPublicName(),
</span><span class="cx">         &vm.propertyNames->builtinNames().valuesPublicName()
</span><span class="cx">     };
</span><ins>+    if (Options::useArrayFindLastMethod()) {
+        unscopables->putDirect(vm, vm.propertyNames->builtinNames().findLastPublicName(), jsBoolean(true));
+        unscopables->putDirect(vm, vm.propertyNames->builtinNames().findLastIndexPublicName(), jsBoolean(true));
+    }
</ins><span class="cx">     if (Options::useAtMethod())
</span><span class="cx">         unscopables->putDirect(vm, vm.propertyNames->builtinNames().atPublicName(), jsBoolean(true));
</span><span class="cx">     for (const auto* unscopableName : unscopableNames)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp        2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp   2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -453,7 +453,11 @@
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("includes", typedArrayViewProtoFuncIncludes, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().fillPublicName(), typedArrayViewProtoFuncFill, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("find", typedArrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><ins>+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastPublicName(), typedArrayPrototypeFindLastCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</ins><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("findIndex", typedArrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><ins>+    if (Options::useArrayFindLastMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findLastIndexPublicName(), typedArrayPrototypeFindLastIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</ins><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->forEach, typedArrayPrototypeForEachCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("indexOf", typedArrayViewProtoFuncIndexOf, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->join, typedArrayViewProtoFuncJoin, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeOptionsListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/OptionsList.h (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/OptionsList.h        2021-07-15 01:20:29 UTC (rev 279936)
+++ trunk/Source/JavaScriptCore/runtime/OptionsList.h   2021-07-15 03:11:53 UTC (rev 279937)
</span><span class="lines">@@ -550,6 +550,7 @@
</span><span class="cx">     v(Bool, useDataICInOptimizingJIT, false, Normal, nullptr) \
</span><span class="cx">     v(Bool, useDataICSharing, false, Normal, nullptr) \
</span><span class="cx">     v(Bool, useTemporal, false, Normal, "Expose the Temporal object.") \
</span><ins>+    v(Bool, useArrayFindLastMethod, false, Normal, "Expose the findLast() and findLastIndex() methods on Array and %TypedArray%.") \
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> enum OptionEquivalence {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2021-07-14  Devin Rousso  <drousso@apple.com>
+
+        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:
+
</ins><span class="cx"> 2021-07-12  Patrick Angle  <pangle@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: REGRESSION(r279510): Elements: Computed: an (i) button is shown for computed property traces
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsNativeFunctionParametersjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (279936 => 279937)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -249,6 +249,8 @@
</span><span class="cx">         filter: "callback, [thisArg]",
</span><span class="cx">         find: "callback, [thisArg]",
</span><span class="cx">         findIndex: "callback, [thisArg]",
</span><ins>+        findLast: "callback, [thisArg]",
+        findLastIndex: "callback, [thisArg]",
</ins><span class="cx">         forEach: "callback, [thisArg]",
</span><span class="cx">         includes: "searchValue, [startIndex=0]",
</span><span class="cx">         indexOf: "searchValue, [startIndex=0]",
</span></span></pre>
</div>
</div>

</body>
</html>