<!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>[191530] 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/191530">191530</a></dd>
<dt>Author</dt> <dd>msaboff@apple.com</dd>
<dt>Date</dt> <dd>2015-10-23 18:45:30 -0700 (Fri, 23 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/179357">r179357</a>-<a href="http://trac.webkit.org/projects/webkit/changeset/179359">r179359</a>): WebContent Crash using AOL Mail @ com.apple.JavascriptCore JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&amp;, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
https://bugs.webkit.org/show_bug.cgi?id=150513

Reviewed by Saam Barati.

Source/JavaScriptCore:

Add check in linkPolymorphicCall() to make sure we have a CodeBlock for the newly added variant.
If not, we turn the call into a virtual call.

The bug was caused by a stack overflow when preparing the function for execution.  This properly
threw an exception, however linkPolymorphicCall() didn't check for this error case.

Added a new test function &quot;failNextNewCodeBlock()&quot; to test tools to simplify the testing.

* API/JSCTestRunnerUtils.cpp:
(JSC::failNextNewCodeBlock):
(JSC::numberOfDFGCompiles):
* API/JSCTestRunnerUtils.h:
* jit/Repatch.cpp:
(JSC::linkPolymorphicCall):
* jsc.cpp:
(GlobalObject::finishCreation):
(functionTransferArrayBuffer):
(functionFailNextNewCodeBlock):
(functionQuit):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::prepareForExecutionImpl):
* runtime/TestRunnerUtils.cpp:
(JSC::optimizeNextInvocation):
(JSC::failNextNewCodeBlock):
(JSC::numberOfDFGCompiles):
* runtime/TestRunnerUtils.h:
* runtime/VM.h:
(JSC::VM::setFailNextNewCodeBlock):
(JSC::VM::getAndClearFailNextNewCodeBlock):
(JSC::VM::stackPointerAtVMEntry):

Tools:

Added a new test function, failNextNewCodeBlock() to simplify the writing of a regression test.

* DumpRenderTree/TestRunner.cpp:
(simulateWebNotificationClickCallback):
(failNextCodeBlock):
(numberOfDFGCompiles):
(TestRunner::staticFunctions):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setBlockAllPlugins):
(WTR::TestRunner::failNextCodeBlock):
(WTR::TestRunner::numberOfDFGCompiles):
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:

New regression test.

* js/regress-150513-expected.txt: Added.
* js/regress-150513.html: Added.
* js/script-tests/regress-150513.js: Added.
(test):
* resources/standalone-pre.js: Added failNextNewCodeBlock to testRunner object.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsresourcesstandaloneprejs">trunk/LayoutTests/resources/standalone-pre.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreAPIJSCTestRunnerUtilscpp">trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreAPIJSCTestRunnerUtilsh">trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRepatchcpp">trunk/Source/JavaScriptCore/jit/Repatch.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeTestRunnerUtilscpp">trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeTestRunnerUtilsh">trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnercpp">trunk/Tools/DumpRenderTree/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsregress150513expectedtxt">trunk/LayoutTests/js/regress-150513-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsregress150513html">trunk/LayoutTests/js/regress-150513.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsregress150513js">trunk/LayoutTests/js/script-tests/regress-150513.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/LayoutTests/ChangeLog        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-10-23  Michael Saboff  &lt;msaboff@apple.com&gt;
+
+        REGRESSION (r179357-r179359): WebContent Crash using AOL Mail @ com.apple.JavascriptCore JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&amp;, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
+        https://bugs.webkit.org/show_bug.cgi?id=150513
+
+        Reviewed by Saam Barati.
+
+        New regression test.
+
+        * js/regress-150513-expected.txt: Added.
+        * js/regress-150513.html: Added.
+        * js/script-tests/regress-150513.js: Added.
+        (test):
+        * resources/standalone-pre.js: Added failNextNewCodeBlock to testRunner object.
+
</ins><span class="cx"> 2015-10-23  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Removing [ Release ] flag from flaky imported blink tests that are timing out in debug too
</span></span></pre></div>
<a id="trunkLayoutTestsjsregress150513expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress-150513-expected.txt (0 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress-150513-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/regress-150513-expected.txt        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Regression test for https://webkit.org/b/150513.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Didn't crash when calling a virtual JavaScript function that doesn't have a CodeBlock.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregress150513html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress-150513.html (0 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress-150513.html                                (rev 0)
+++ trunk/LayoutTests/js/regress-150513.html        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/regress-150513.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsregress150513js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/regress-150513.js (0 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/regress-150513.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/regress-150513.js        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+description(&quot;Regression test for https://webkit.org/b/150513.&quot;);
+
+// This test verifies that we can properly handle calling a virtual JavaScript
+// function that fails during CodeBlock generation.
+
+var functions = [];
+
+function init()
+{
+    functions.push(new Function(&quot;a&quot;, &quot;return a&quot;));
+    functions.push(new Function(&quot;a&quot;, &quot;return a&quot;));
+    functions.push(new Function(&quot;a&quot;, &quot;return a&quot;));
+}
+
+function test()
+{
+    for (var i = 0; i &lt; 100000; i++) {
+        var f;
+        if (i % 1000 == 999) {
+            testRunner.failNextNewCodeBlock();
+            f = functions[2];
+        } else
+            f = functions[i % 2];
+
+        try {
+            var result = f(1);
+            if (result != 1)
+                testFailed(&quot;Wrong result, expected 1, got &quot; + result);
+        } catch (e) {
+        }
+    }
+}
+
+init();
+
+test();
+
+testPassed(&quot;Didn't crash when calling a virtual JavaScript function that doesn't have a CodeBlock.&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsresourcesstandaloneprejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/standalone-pre.js (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/standalone-pre.js        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/LayoutTests/resources/standalone-pre.js        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -4,7 +4,8 @@
</span><span class="cx"> 
</span><span class="cx"> self.testRunner = {
</span><span class="cx">     neverInlineFunction: neverInlineFunction,
</span><del>-    numberOfDFGCompiles: numberOfDFGCompiles
</del><ins>+    numberOfDFGCompiles: numberOfDFGCompiles,
+    failNextNewCodeBlock: failNextNewCodeBlock
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> var silentTestPass, didPassSomeTestsSilently, didFailSomeTests, successfullyParsed;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreAPIJSCTestRunnerUtilscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -32,6 +32,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+
+JSValueRef failNextNewCodeBlock(JSContextRef context)
+{
+    ExecState* exec= toJS(context);
+    JSLockHolder holder(exec);
+    return toRef(exec, failNextNewCodeBlock(exec));
+}
+
</ins><span class="cx"> JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef)
</span><span class="cx"> {
</span><span class="cx">     ExecState* exec= toJS(context);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreAPIJSCTestRunnerUtilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.h (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.h        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.h        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+JS_EXPORT_PRIVATE JSValueRef failNextNewCodeBlock(JSContextRef);
</ins><span class="cx"> JS_EXPORT_PRIVATE JSValueRef numberOfDFGCompiles(JSContextRef, JSValueRef theFunction);
</span><span class="cx"> JS_EXPORT_PRIVATE JSValueRef setNeverInline(JSContextRef, JSValueRef theFunction);
</span><span class="cx"> JS_EXPORT_PRIVATE JSValueRef setNeverOptimize(JSContextRef, JSValueRef theFunction);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2015-10-23  Michael Saboff  &lt;msaboff@apple.com&gt;
+
+        REGRESSION (r179357-r179359): WebContent Crash using AOL Mail @ com.apple.JavascriptCore JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&amp;, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
+        https://bugs.webkit.org/show_bug.cgi?id=150513
+
+        Reviewed by Saam Barati.
+
+        Add check in linkPolymorphicCall() to make sure we have a CodeBlock for the newly added variant.
+        If not, we turn the call into a virtual call.
+
+        The bug was caused by a stack overflow when preparing the function for execution.  This properly
+        threw an exception, however linkPolymorphicCall() didn't check for this error case.
+
+        Added a new test function &quot;failNextNewCodeBlock()&quot; to test tools to simplify the testing.
+
+        * API/JSCTestRunnerUtils.cpp:
+        (JSC::failNextNewCodeBlock):
+        (JSC::numberOfDFGCompiles):
+        * API/JSCTestRunnerUtils.h:
+        * jit/Repatch.cpp:
+        (JSC::linkPolymorphicCall):
+        * jsc.cpp:
+        (GlobalObject::finishCreation):
+        (functionTransferArrayBuffer):
+        (functionFailNextNewCodeBlock):
+        (functionQuit):
+        * runtime/Executable.cpp:
+        (JSC::ScriptExecutable::prepareForExecutionImpl):
+        * runtime/TestRunnerUtils.cpp:
+        (JSC::optimizeNextInvocation):
+        (JSC::failNextNewCodeBlock):
+        (JSC::numberOfDFGCompiles):
+        * runtime/TestRunnerUtils.h:
+        * runtime/VM.h:
+        (JSC::VM::setFailNextNewCodeBlock):
+        (JSC::VM::getAndClearFailNextNewCodeBlock):
+        (JSC::VM::stackPointerAtVMEntry):
+
</ins><span class="cx"> 2015-10-23  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r191500.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRepatchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/Repatch.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/Repatch.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/jit/Repatch.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -682,9 +682,9 @@
</span><span class="cx">             else
</span><span class="cx"> #endif
</span><span class="cx">                 codeBlock = jsCast&lt;FunctionExecutable*&gt;(executable)-&gt;codeBlockForCall();
</span><del>-            // If we cannot handle a callee, assume that it's better for this whole thing to be a
-            // virtual call.
-            if (exec-&gt;argumentCountIncludingThis() &lt; static_cast&lt;size_t&gt;(codeBlock-&gt;numParameters()) || callLinkInfo.isVarargs()) {
</del><ins>+            // If we cannot handle a callee, either because we don't have a CodeBlock or because arity mismatch,
+            // assume that it's better for this whole thing to be a virtual call.
+            if (!codeBlock || exec-&gt;argumentCountIncludingThis() &lt; static_cast&lt;size_t&gt;(codeBlock-&gt;numParameters()) || callLinkInfo.isVarargs()) {
</ins><span class="cx">                 linkVirtualFor(exec, callLinkInfo);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -526,6 +526,7 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionTransferArrayBuffer(ExecState*);
</span><ins>+static EncodedJSValue JSC_HOST_CALL functionFailNextNewCodeBlock(ExecState*);
</ins><span class="cx"> static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
</span><span class="cx"> static NO_RETURN_DUE_TO_CRASH EncodedJSValue JSC_HOST_CALL functionAbort(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionFalse1(ExecState*);
</span><span class="lines">@@ -687,6 +688,7 @@
</span><span class="cx">         addFunction(vm, &quot;optimizeNextInvocation&quot;, functionOptimizeNextInvocation, 1);
</span><span class="cx">         addFunction(vm, &quot;reoptimizationRetryCount&quot;, functionReoptimizationRetryCount, 1);
</span><span class="cx">         addFunction(vm, &quot;transferArrayBuffer&quot;, functionTransferArrayBuffer, 1);
</span><ins>+        addFunction(vm, &quot;failNextNewCodeBlock&quot;, functionFailNextNewCodeBlock, 1);
</ins><span class="cx"> #if ENABLE(SAMPLING_FLAGS)
</span><span class="cx">         addFunction(vm, &quot;setSamplingFlags&quot;, functionSetSamplingFlags, 1);
</span><span class="cx">         addFunction(vm, &quot;clearSamplingFlags&quot;, functionClearSamplingFlags, 1);
</span><span class="lines">@@ -1375,6 +1377,12 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL functionFailNextNewCodeBlock(ExecState* exec)
+{
+    exec-&gt;vm().setFailNextNewCodeBlock();
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*)
</span><span class="cx"> {
</span><span class="cx">     jscExit(EXIT_SUCCESS);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -387,7 +387,10 @@
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="cx">     DeferGC deferGC(vm.heap);
</span><del>-    
</del><ins>+
+    if (vm.getAndClearFailNextNewCodeBlock())
+        return createError(exec-&gt;callerFrame(), ASCIILiteral(&quot;Forced Failure&quot;));
+
</ins><span class="cx">     JSObject* exception = 0;
</span><span class="cx">     CodeBlock* codeBlock = newCodeBlockFor(kind, function, scope, exception);
</span><span class="cx">     if (!codeBlock) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeTestRunnerUtilscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -103,6 +103,13 @@
</span><span class="cx">     return jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValue failNextNewCodeBlock(ExecState* exec)
+{
+    exec-&gt;vm().setFailNextNewCodeBlock();
+
+    return jsUndefined();
+}
+
</ins><span class="cx"> JSValue numberOfDFGCompiles(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     if (exec-&gt;argumentCount() &lt; 1)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeTestRunnerUtilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> JS_EXPORT_PRIVATE JSValue setNeverOptimize(JSValue function);
</span><span class="cx"> JS_EXPORT_PRIVATE JSValue optimizeNextInvocation(JSValue function);
</span><span class="cx"> 
</span><ins>+JS_EXPORT_PRIVATE JSValue failNextNewCodeBlock(ExecState*);
</ins><span class="cx"> JS_EXPORT_PRIVATE JSValue numberOfDFGCompiles(ExecState*);
</span><span class="cx"> JS_EXPORT_PRIVATE JSValue setNeverInline(ExecState*);
</span><span class="cx"> JS_EXPORT_PRIVATE JSValue setNeverOptimize(ExecState*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -426,6 +426,14 @@
</span><span class="cx">     JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue);
</span><span class="cx">     JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
</span><span class="cx"> 
</span><ins>+    void setFailNextNewCodeBlock() { m_failNextNewCodeBlock = true; }
+    bool getAndClearFailNextNewCodeBlock()
+    {
+        bool result = m_failNextNewCodeBlock;
+        m_failNextNewCodeBlock = false;
+        return result;
+    }
+    
</ins><span class="cx">     void* stackPointerAtVMEntry() const { return m_stackPointerAtVMEntry; }
</span><span class="cx">     void setStackPointerAtVMEntry(void*);
</span><span class="cx"> 
</span><span class="lines">@@ -624,6 +632,7 @@
</span><span class="cx">     void* m_lastStackTop;
</span><span class="cx">     Exception* m_exception { nullptr };
</span><span class="cx">     Exception* m_lastException { nullptr };
</span><ins>+    bool m_failNextNewCodeBlock { false };
</ins><span class="cx">     bool m_inDefineOwnProperty;
</span><span class="cx">     std::unique_ptr&lt;CodeCache&gt; m_codeCache;
</span><span class="cx">     LegacyProfiler* m_enabledProfiler;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Tools/ChangeLog        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-10-23  Michael Saboff  &lt;msaboff@apple.com&gt;
+
+        REGRESSION (r179357-r179359): WebContent Crash using AOL Mail @ com.apple.JavascriptCore JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&amp;, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
+        https://bugs.webkit.org/show_bug.cgi?id=150513
+
+        Reviewed by Saam Barati.
+
+        Added a new test function, failNextNewCodeBlock() to simplify the writing of a regression test.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (simulateWebNotificationClickCallback):
+        (failNextCodeBlock):
+        (numberOfDFGCompiles):
+        (TestRunner::staticFunctions):
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setBlockAllPlugins):
+        (WTR::TestRunner::failNextCodeBlock):
+        (WTR::TestRunner::numberOfDFGCompiles):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
</ins><span class="cx"> 2015-10-23  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Simplify the WebKitLegacy menu conversion code
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -1933,11 +1933,16 @@
</span><span class="cx">     return JSValueMakeUndefined(context);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</del><ins>+static JSValueRef failNextNewCodeBlock(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</ins><span class="cx"> {
</span><span class="cx">     if (argumentCount &lt; 1)
</span><span class="cx">         return JSValueMakeUndefined(context);
</span><span class="cx">     
</span><ins>+    return JSC::failNextNewCodeBlock(context);
+}
+
+static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
</ins><span class="cx">     return JSC::numberOfDFGCompiles(context, arguments[0]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2149,6 +2154,7 @@
</span><span class="cx">         { &quot;denyWebNotificationPermission&quot;, denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;removeAllWebNotificationPermissions&quot;, removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;simulateWebNotificationClick&quot;, simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+        { &quot;failNextNewCodeBlock&quot;, failNextNewCodeBlock, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx">         { &quot;numberOfDFGCompiles&quot;, numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;neverInlineFunction&quot;, neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { 0, 0, 0 }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -205,6 +205,7 @@
</span><span class="cx">     void setBlockAllPlugins(boolean shouldBlock);
</span><span class="cx">     
</span><span class="cx">     // Hooks to the JSC compiler.
</span><ins>+    object failNextNewCodeBlock();
</ins><span class="cx">     object numberOfDFGCompiles(object function);
</span><span class="cx">     object neverInlineFunction(object function);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -861,6 +861,13 @@
</span><span class="cx">     WKBundlePagePostMessage(InjectedBundle::singleton().page()-&gt;page(), messageName.get(), messageBody.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValueRef TestRunner::failNextNewCodeBlock()
+{
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()-&gt;page());
+    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+    return JSC::failNextNewCodeBlock(context);
+}
+
</ins><span class="cx"> JSValueRef TestRunner::numberOfDFGCompiles(JSValueRef theFunction)
</span><span class="cx"> {
</span><span class="cx">     WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()-&gt;page());
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (191529 => 191530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-10-24 01:26:22 UTC (rev 191529)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-10-24 01:45:30 UTC (rev 191530)
</span><span class="lines">@@ -280,6 +280,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool secureEventInputIsEnabled() const;
</span><span class="cx">     
</span><ins>+    JSValueRef failNextNewCodeBlock();
</ins><span class="cx">     JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
</span><span class="cx">     JSValueRef neverInlineFunction(JSValueRef theFunction);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>