<!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>[194597] trunk/LayoutTests</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/194597">194597</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2016-01-05 12:38:46 -0800 (Tue, 05 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make ftl-polymorphic-xxx tests more polymorphic.
https://bugs.webkit.org/show_bug.cgi?id=152736

Reviewed by Saam Barati.

1. Change the test driver to alternate inputs between numeric operands and
   an object with a valueOf() method.
2. Changed busy work blob to use the operator being tested instead of always using
   the + operator.
3. Updated test results.

With these change, the tests each triggers around 49000+ speculation failures when
run as a benchmark on the VM before the fix for https://webkit.org/b/152708
landed (in <a href="http://trac.webkit.org/projects/webkit/changeset/194560">r194560</a>: &lt;http://trac.webkit.org/<a href="http://trac.webkit.org/projects/webkit/changeset/194560">r194560</a>&gt;).  After the fix, the
number of speculation failures is around 11 or lower.

The benchmark perf with these tests shows about a 10% gain on x86 (32-bit with no
FTL) and about 2x on x86_64 (64-bit with FTL).

* js/regress/script-tests/ftl-polymorphic-bitand.js:
* js/regress/script-tests/ftl-polymorphic-bitor.js:
* js/regress/script-tests/ftl-polymorphic-bitxor.js:
* js/regress/script-tests/ftl-polymorphic-div.js:
* js/regress/script-tests/ftl-polymorphic-lshift.js:
* js/regress/script-tests/ftl-polymorphic-mul.js:
* js/regress/script-tests/ftl-polymorphic-rshift.js:
* js/regress/script-tests/ftl-polymorphic-sub.js:
* js/regress/script-tests/ftl-polymorphic-urshift.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicbitandjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitand.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicbitorjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitor.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicbitxorjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitxor.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicdivjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-div.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphiclshiftjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-lshift.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicmuljs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-mul.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicrshiftjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-rshift.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicsubjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-sub.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsftlpolymorphicurshiftjs">trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-urshift.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/ChangeLog        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-01-05  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Make ftl-polymorphic-xxx tests more polymorphic.
+        https://bugs.webkit.org/show_bug.cgi?id=152736
+
+        Reviewed by Saam Barati.
+
+        1. Change the test driver to alternate inputs between numeric operands and
+           an object with a valueOf() method.
+        2. Changed busy work blob to use the operator being tested instead of always using
+           the + operator.
+        3. Updated test results.
+
+        With these change, the tests each triggers around 49000+ speculation failures when
+        run as a benchmark on the VM before the fix for https://webkit.org/b/152708
+        landed (in r194560: &lt;http://trac.webkit.org/r194560&gt;).  After the fix, the
+        number of speculation failures is around 11 or lower.
+
+        The benchmark perf with these tests shows about a 10% gain on x86 (32-bit with no
+        FTL) and about 2x on x86_64 (64-bit with FTL).
+
+        * js/regress/script-tests/ftl-polymorphic-bitand.js:
+        * js/regress/script-tests/ftl-polymorphic-bitor.js:
+        * js/regress/script-tests/ftl-polymorphic-bitxor.js:
+        * js/regress/script-tests/ftl-polymorphic-div.js:
+        * js/regress/script-tests/ftl-polymorphic-lshift.js:
+        * js/regress/script-tests/ftl-polymorphic-mul.js:
+        * js/regress/script-tests/ftl-polymorphic-rshift.js:
+        * js/regress/script-tests/ftl-polymorphic-sub.js:
+        * js/regress/script-tests/ftl-polymorphic-urshift.js:
+
</ins><span class="cx"> 2016-01-05  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Error message updates for two failing tests.
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicbitandjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitand.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitand.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitand.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -15,8 +15,15 @@
</span><span class="cx">             temp = b &amp; 1;
</span><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result &amp; i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,16 +33,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 4995999180;
</del><ins>+    expectedResult = 499660;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 49955499180;
</del><ins>+    expectedResult = 4999660;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicbitorjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitor.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitor.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitor.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -15,8 +15,15 @@
</span><span class="cx">             temp = b | 1;
</span><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result | i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,16 +33,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 5496249490;
</del><ins>+    expectedResult = 505700591;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 99957999490;
</del><ins>+    expectedResult = 50056912223;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicbitxorjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitxor.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitxor.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-bitxor.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -15,8 +15,15 @@
</span><span class="cx">             temp = b ^ 1;
</span><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result ^ i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,16 +33,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 5495749810;
</del><ins>+    expectedResult = 500050340;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 99952999810;
</del><ins>+    expectedResult = 50000500340;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicdivjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-div.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-div.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-div.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -13,11 +13,20 @@
</span><span class="cx">             temp = a / b;
</span><span class="cx">         else
</span><span class="cx">             temp = b / 1;
</span><del>-        temp = temp | 0;
</del><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Remove rounding errors so we can have a predictable test result.
+    result = result | 0;
+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result / i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -27,16 +36,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 5045480390;
</del><ins>+    expectedResult = 50002814;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 54950300390;
</del><ins>+    expectedResult = 5000017595;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphiclshiftjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-lshift.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-lshift.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-lshift.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -15,8 +15,15 @@
</span><span class="cx">             temp = b &lt;&lt; 1;
</span><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result &lt;&lt; i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,16 +33,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 517250968820;
</del><ins>+    expectedResult = 512050639000;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 51252509968820;
</del><ins>+    expectedResult = 51200511439000;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicmuljs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-mul.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-mul.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-mul.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -13,8 +13,15 @@
</span><span class="cx">         else
</span><span class="cx">             result += b * 1;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result * i;
+    result = origResult &lt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -24,16 +31,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 9997995200;
</del><ins>+    expectedResult = 5000495600;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 549975495200;
</del><ins>+    expectedResult = 500004995600;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicrshiftjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-rshift.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-rshift.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-rshift.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -15,8 +15,15 @@
</span><span class="cx">             temp = b &gt;&gt; 1;
</span><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result &gt;&gt; i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,16 +33,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 4995939420;
</del><ins>+    expectedResult = 439840;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 49998832140;
</del><ins>+    expectedResult = 48330800;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicsubjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-sub.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-sub.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-sub.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -17,6 +17,15 @@
</span><span class="cx">         else
</span><span class="cx">             result += b - 1;
</span><span class="cx">     }
</span><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result - i;
+    result = origResult &lt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,17 +35,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 200020;
</del><ins>+    expectedResult = -4496448060;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 2000020;
</del><ins>+    expectedResult = 40001940;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    o2.i = i;
-    result += foo(o1, o2);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsftlpolymorphicurshiftjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-urshift.js (194596 => 194597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-urshift.js        2016-01-05 20:36:59 UTC (rev 194596)
+++ trunk/LayoutTests/js/regress/script-tests/ftl-polymorphic-urshift.js        2016-01-05 20:38:46 UTC (rev 194597)
</span><span class="lines">@@ -15,8 +15,15 @@
</span><span class="cx">             temp = b &gt;&gt;&gt; 1;
</span><span class="cx">         result += temp;
</span><span class="cx">     }
</span><del>-    for (var i = 0; i &lt; 1000; i++)
-        result += i;
</del><ins>+
+    // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+    // us to speculation fail out to the baseline, this busy work will take a lot longer
+    // to run.
+    // This loop below also gets the DFG to compile this function sooner.
+    var origResult = result;
+    for (var i = 1; i &lt; 1000; i++)
+        result = result &gt;&gt;&gt; i;
+    result = origResult &gt; result ? origResult : result;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> noInline(foo);
</span><span class="lines">@@ -26,16 +33,19 @@
</span><span class="cx"> if (this.window) {
</span><span class="cx">     // The layout test doesn't like too many iterations and may time out.
</span><span class="cx">     iterations = 10000;
</span><del>-    expectedResult = 4995939420;
</del><ins>+    expectedResult = 439840;
</ins><span class="cx"> } else {
</span><span class="cx">     iterations = 100000;
</span><del>-    expectedResult = 49998832140;
</del><ins>+    expectedResult = 48330800;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> for (var i = 0; i &lt;= iterations; i++) {
</span><del>-    o1.i = i + 2;
-    result += foo(o1, 10);
</del><ins>+    o1.i = i;
+    if (i % 2)
+        result += foo(o1, 10);
+    else
+        result += foo(i, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (result != expectedResult)
</span></span></pre>
</div>
</div>

</body>
</html>