<!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>[214313] 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/214313">214313</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2017-03-23 13:31:18 -0700 (Thu, 23 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clients of JSArray::tryCreateForInitializationPrivate() should do their own null checks.
https://bugs.webkit.org/show_bug.cgi?id=169783

Reviewed by Saam Barati.

JSTests:

* stress/regress-169783.js: Added.

Source/JavaScriptCore:

Fixed clients of tryCreateForInitializationPrivate() to do a null check and throw
an OutOfMemoryError if allocation fails, or RELEASE_ASSERT that the allocation
succeeds.

* dfg/DFGOperations.cpp:
* ftl/FTLOperations.cpp:
(JSC::FTL::operationMaterializeObjectInOSR):
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSplice):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/JSArray.cpp:
(JSC::JSArray::tryCreateForInitializationPrivate):
(JSC::JSArray::fastSlice):
* runtime/JSArray.h:
(JSC::constructArray):
(JSC::constructArrayNegativeIndexed):
* runtime/RegExpMatchesArray.cpp:
(JSC::createEmptyRegExpMatchesArray):
* runtime/RegExpMatchesArray.h:
(JSC::createRegExpMatchesArray):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOperationscpp">trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLOperationscpp">trunk/Source/JavaScriptCore/ftl/FTLOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeArrayPrototypecpp">trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonSlowPathscpp">trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSArraycpp">trunk/Source/JavaScriptCore/runtime/JSArray.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSArrayh">trunk/Source/JavaScriptCore/runtime/JSArray.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExpMatchesArraycpp">trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExpMatchesArrayh">trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestsstressregress169783js">trunk/JSTests/stress/regress-169783.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/JSTests/ChangeLog        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2017-03-23  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Clients of JSArray::tryCreateForInitializationPrivate() should do their own null checks.
+        https://bugs.webkit.org/show_bug.cgi?id=169783
+
+        Reviewed by Saam Barati.
+
+        * stress/regress-169783.js: Added.
+
</ins><span class="cx"> 2017-03-22  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC][DFG] Propagate AnyIntAsDouble information carefully to utilize it in fixup
</span></span></pre></div>
<a id="trunkJSTestsstressregress169783js"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/regress-169783.js (0 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/regress-169783.js                                (rev 0)
+++ trunk/JSTests/stress/regress-169783.js        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+//@ if $buildType == &quot;debug&quot; then runFTLNoCJIT(&quot;--maxSingleAllocationSize=10000000&quot;) else skip end
+
+function test(a) {
+    var x = [1337, ...a, ...a, ...a, ...a, ...a];
+}
+noInline(test);
+
+function doTest(a, shouldThrow) {
+    var exception;
+    try {
+        test(a);
+    } catch (e) {
+        exception = e;
+    }
+    if (shouldThrow &amp;&amp; exception != &quot;Error: Out of memory&quot;)
+        throw(&quot;FAILED&quot;);
+}
+
+var a = new Array(0x40000);
+doTest(a, true);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2017-03-23  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Clients of JSArray::tryCreateForInitializationPrivate() should do their own null checks.
+        https://bugs.webkit.org/show_bug.cgi?id=169783
+
+        Reviewed by Saam Barati.
+
+        Fixed clients of tryCreateForInitializationPrivate() to do a null check and throw
+        an OutOfMemoryError if allocation fails, or RELEASE_ASSERT that the allocation
+        succeeds.
+
+        * dfg/DFGOperations.cpp:
+        * ftl/FTLOperations.cpp:
+        (JSC::FTL::operationMaterializeObjectInOSR):
+        * runtime/ArrayPrototype.cpp:
+        (JSC::arrayProtoFuncSplice):
+        * runtime/CommonSlowPaths.cpp:
+        (JSC::SLOW_PATH_DECL):
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::tryCreateForInitializationPrivate):
+        (JSC::JSArray::fastSlice):
+        * runtime/JSArray.h:
+        (JSC::constructArray):
+        (JSC::constructArrayNegativeIndexed):
+        * runtime/RegExpMatchesArray.cpp:
+        (JSC::createEmptyRegExpMatchesArray):
+        * runtime/RegExpMatchesArray.h:
+        (JSC::createRegExpMatchesArray):
+
</ins><span class="cx"> 2017-03-23  Guillaume Emont  &lt;guijemont@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [jsc] Add MacroAssemblerMIPS::storeFence()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -2086,6 +2086,10 @@
</span><span class="cx">     Structure* structure = globalObject-&gt;arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous);
</span><span class="cx"> 
</span><span class="cx">     JSArray* result = JSArray::tryCreateForInitializationPrivate(vm, structure, length);
</span><ins>+    if (UNLIKELY(!result)) {
+        throwOutOfMemoryError(exec, scope);
+        return nullptr;
+    }
</ins><span class="cx">     RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="cx"> 
</span><span class="cx">     unsigned index = 0;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLOperations.cpp (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLOperations.cpp        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/ftl/FTLOperations.cpp        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -363,6 +363,9 @@
</span><span class="cx">             Structure* structure = globalObject-&gt;restParameterStructure();
</span><span class="cx">             ASSERT(argumentCount &gt; 0);
</span><span class="cx">             unsigned arraySize = (argumentCount - 1) &gt; numberOfArgumentsToSkip ? argumentCount - 1 - numberOfArgumentsToSkip : 0;
</span><ins>+
+            // FIXME: we should throw an out of memory error here if tryCreateForInitializationPrivate() fails.
+            // https://bugs.webkit.org/show_bug.cgi?id=169784
</ins><span class="cx">             JSArray* array = JSArray::tryCreateForInitializationPrivate(vm, structure, arraySize);
</span><span class="cx">             RELEASE_ASSERT(array);
</span><span class="cx"> 
</span><span class="lines">@@ -452,6 +455,8 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        // FIXME: we should throw an out of memory error here if checkedArraySize has hasOverflowed() or tryCreateForInitializationPrivate() fails.
+        // https://bugs.webkit.org/show_bug.cgi?id=169784
</ins><span class="cx">         unsigned arraySize = checkedArraySize.unsafeGet(); // Crashes if overflowed.
</span><span class="cx">         JSArray* result = JSArray::tryCreateForInitializationPrivate(vm, structure, arraySize);
</span><span class="cx">         RELEASE_ASSERT(result);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeArrayPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -1042,8 +1042,10 @@
</span><span class="cx">             }
</span><span class="cx">         } else {
</span><span class="cx">             result = JSArray::tryCreateForInitializationPrivate(vm, exec-&gt;lexicalGlobalObject()-&gt;arrayStructureForIndexingTypeDuringAllocation(ArrayWithUndecided), actualDeleteCount);
</span><del>-            if (!result)
-                return JSValue::encode(throwOutOfMemoryError(exec, scope));
</del><ins>+            if (UNLIKELY(!result)) {
+                throwOutOfMemoryError(exec, scope);
+                return encodedJSValue();
+            }
</ins><span class="cx">             
</span><span class="cx">             for (unsigned k = 0; k &lt; actualDeleteCount; ++k) {
</span><span class="cx">                 JSValue v = getProperty(exec, thisObj, k + actualStart);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -1010,6 +1010,8 @@
</span><span class="cx">     Structure* structure = globalObject-&gt;arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous);
</span><span class="cx"> 
</span><span class="cx">     JSArray* result = JSArray::tryCreateForInitializationPrivate(vm, structure, arraySize);
</span><ins>+    if (UNLIKELY(!result))
+        THROW(createOutOfMemoryError(exec));
</ins><span class="cx">     CHECK_EXCEPTION();
</span><span class="cx"> 
</span><span class="cx">     unsigned index = 0;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSArraycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSArray.cpp (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSArray.cpp        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/runtime/JSArray.cpp        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> 
</span><span class="cx"> JSArray* JSArray::tryCreateForInitializationPrivate(VM&amp; vm, GCDeferralContext* deferralContext, Structure* structure, unsigned initialLength)
</span><span class="cx"> {
</span><del>-    if (initialLength &gt; MAX_STORAGE_VECTOR_LENGTH)
</del><ins>+    if (UNLIKELY(initialLength &gt; MAX_STORAGE_VECTOR_LENGTH))
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     unsigned outOfLineStorage = structure-&gt;outOfLineCapacity();
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">         unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, initialLength);
</span><span class="cx">         void* temp = vm.auxiliarySpace.tryAllocate(deferralContext, Butterfly::totalSize(0, outOfLineStorage, true, vectorLength * sizeof(EncodedJSValue)));
</span><del>-        if (!temp)
</del><ins>+        if (UNLIKELY(!temp))
</ins><span class="cx">             return nullptr;
</span><span class="cx">         butterfly = Butterfly::fromBase(temp, 0, outOfLineStorage);
</span><span class="cx">         butterfly-&gt;setVectorLength(vectorLength);
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     } else {
</span><span class="cx">         unsigned vectorLength = ArrayStorage::optimalVectorLength(0, structure, initialLength);
</span><span class="cx">         void* temp = vm.auxiliarySpace.tryAllocate(deferralContext, Butterfly::totalSize(0, outOfLineStorage, true, ArrayStorage::sizeFor(vectorLength)));
</span><del>-        if (!temp)
</del><ins>+        if (UNLIKELY(!temp))
</ins><span class="cx">             return nullptr;
</span><span class="cx">         butterfly = Butterfly::fromBase(temp, 0, outOfLineStorage);
</span><span class="cx">         *butterfly-&gt;indexingHeader() = indexingHeaderForArrayStorage(initialLength, vectorLength);
</span><span class="lines">@@ -857,7 +857,7 @@
</span><span class="cx"> 
</span><span class="cx">         Structure* resultStructure = exec.lexicalGlobalObject()-&gt;arrayStructureForIndexingTypeDuringAllocation(arrayType);
</span><span class="cx">         JSArray* resultArray = JSArray::tryCreateForInitializationPrivate(vm, resultStructure, count);
</span><del>-        if (!resultArray)
</del><ins>+        if (UNLIKELY(!resultArray))
</ins><span class="cx">             return nullptr;
</span><span class="cx"> 
</span><span class="cx">         auto&amp; resultButterfly = *resultArray-&gt;butterfly();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSArrayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSArray.h (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSArray.h        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/runtime/JSArray.h        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -300,6 +300,7 @@
</span><span class="cx">     // FIXME: we should probably throw an out of memory error here, but
</span><span class="cx">     // when making this change we should check that all clients of this
</span><span class="cx">     // function will correctly handle an exception being thrown from here.
</span><ins>+    // https://bugs.webkit.org/show_bug.cgi?id=169786
</ins><span class="cx">     RELEASE_ASSERT(array);
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0; i &lt; length; ++i)
</span><span class="lines">@@ -315,6 +316,7 @@
</span><span class="cx">     // FIXME: we should probably throw an out of memory error here, but
</span><span class="cx">     // when making this change we should check that all clients of this
</span><span class="cx">     // function will correctly handle an exception being thrown from here.
</span><ins>+    // https://bugs.webkit.org/show_bug.cgi?id=169786
</ins><span class="cx">     RELEASE_ASSERT(array);
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0; i &lt; length; ++i)
</span><span class="lines">@@ -330,6 +332,7 @@
</span><span class="cx">     // FIXME: we should probably throw an out of memory error here, but
</span><span class="cx">     // when making this change we should check that all clients of this
</span><span class="cx">     // function will correctly handle an exception being thrown from here.
</span><ins>+    // https://bugs.webkit.org/show_bug.cgi?id=169786
</ins><span class="cx">     RELEASE_ASSERT(array);
</span><span class="cx"> 
</span><span class="cx">     for (int i = 0; i &lt; static_cast&lt;int&gt;(length); ++i)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExpMatchesArraycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -40,7 +40,12 @@
</span><span class="cx">     
</span><span class="cx">     if (UNLIKELY(globalObject-&gt;isHavingABadTime())) {
</span><span class="cx">         array = JSArray::tryCreateForInitializationPrivate(vm, &amp;deferralContext, globalObject-&gt;regExpMatchesArrayStructure(), regExp-&gt;numSubpatterns() + 1);
</span><del>-        
</del><ins>+        // FIXME: we should probably throw an out of memory error here, but
+        // when making this change we should check that all clients of this
+        // function will correctly handle an exception being thrown from here.
+        // https://bugs.webkit.org/show_bug.cgi?id=169786
+        RELEASE_ASSERT(array);
+
</ins><span class="cx">         array-&gt;initializeIndexWithoutBarrier(0, jsEmptyString(&amp;vm));
</span><span class="cx">         
</span><span class="cx">         if (unsigned numSubpatterns = regExp-&gt;numSubpatterns()) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExpMatchesArrayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h (214312 => 214313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h        2017-03-23 20:20:10 UTC (rev 214312)
+++ trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h        2017-03-23 20:31:18 UTC (rev 214313)
</span><span class="lines">@@ -81,7 +81,12 @@
</span><span class="cx">     
</span><span class="cx">     if (UNLIKELY(globalObject-&gt;isHavingABadTime())) {
</span><span class="cx">         array = JSArray::tryCreateForInitializationPrivate(vm, &amp;deferralContext, globalObject-&gt;regExpMatchesArrayStructure(), numSubpatterns + 1);
</span><del>-        
</del><ins>+        // FIXME: we should probably throw an out of memory error here, but
+        // when making this change we should check that all clients of this
+        // function will correctly handle an exception being thrown from here.
+        // https://bugs.webkit.org/show_bug.cgi?id=169786
+        RELEASE_ASSERT(array);
+
</ins><span class="cx">         setProperties();
</span><span class="cx">         
</span><span class="cx">         array-&gt;initializeIndexWithoutBarrier(0, jsSubstringOfResolved(vm, &amp;deferralContext, input, result.start, result.end - result.start));
</span></span></pre>
</div>
</div>

</body>
</html>