<!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>[242855] branches/safari-607-branch</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/242855">242855</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2019-03-13 01:24:31 -0700 (Wed, 13 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/242276">r242276</a>. rdar://problem/48839389

    DFG: Loop-invariant code motion (LICM) should not hoist dead code
    https://bugs.webkit.org/show_bug.cgi?id=194945
    <rdar://problem/48311657>

    Reviewed by Saam Barati.

    * dfg/DFGLICMPhase.cpp:
    (JSC::DFG::LICMPhase::run):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242276 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari607branchJSTestsChangeLog">branches/safari-607-branch/JSTests/ChangeLog</a></li>
<li><a href="#branchessafari607branchSourceJavaScriptCoreChangeLog">branches/safari-607-branch/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchessafari607branchSourceJavaScriptCoredfgDFGLICMPhasecpp">branches/safari-607-branch/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari607branchJSTestsstresslicmdeadcodejs">branches/safari-607-branch/JSTests/stress/licm-dead-code.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari607branchJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/JSTests/ChangeLog (242854 => 242855)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/JSTests/ChangeLog     2019-03-13 08:24:29 UTC (rev 242854)
+++ branches/safari-607-branch/JSTests/ChangeLog        2019-03-13 08:24:31 UTC (rev 242855)
</span><span class="lines">@@ -1,40 +1,57 @@
</span><span class="cx"> 2019-03-13  Babak Shafiei  <bshafiei@apple.com>
</span><span class="cx"> 
</span><del>-        Cherry-pick r242114. rdar://problem/48839372
</del><ins>+        Cherry-pick r242276. rdar://problem/48839389
</ins><span class="cx"> 
</span><del>-    wasmToJS() should purify incoming NaNs.
-    https://bugs.webkit.org/show_bug.cgi?id=194807
-    <rdar://problem/48189132>
</del><ins>+    DFG: Loop-invariant code motion (LICM) should not hoist dead code
+    https://bugs.webkit.org/show_bug.cgi?id=194945
+    <rdar://problem/48311657>
</ins><span class="cx">     
</span><span class="cx">     Reviewed by Saam Barati.
</span><span class="cx">     
</span><del>-    JSTests:
</del><ins>+    * dfg/DFGLICMPhase.cpp:
+    (JSC::DFG::LICMPhase::run):
</ins><span class="cx">     
</span><del>-    * wasm/regress/wasmToJS-should-purify-NaNs.js: Added.
</del><span class="cx">     
</span><del>-    Source/JavaScriptCore:
</del><span class="cx">     
</span><del>-    * runtime/JSCJSValue.h:
-    (JSC::jsNumber):
-    * runtime/TypedArrayAdaptors.h:
-    (JSC::IntegralTypedArrayAdaptor::toJSValue):
-    * wasm/js/WasmToJS.cpp:
-    (JSC::Wasm::wasmToJS):
-    
-    
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
</del><ins>+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
</ins><span class="cx"> 
</span><del>-    2019-02-26  Mark Lam  <mark.lam@apple.com>
</del><ins>+    2019-03-13  Babak Shafiei  <bshafiei@apple.com>
</ins><span class="cx"> 
</span><del>-            wasmToJS() should purify incoming NaNs.
-            https://bugs.webkit.org/show_bug.cgi?id=194807
-            <rdar://problem/48189132>
</del><ins>+            Cherry-pick r242114. rdar://problem/48839372
</ins><span class="cx"> 
</span><del>-            Reviewed by Saam Barati.
</del><ins>+        wasmToJS() should purify incoming NaNs.
+        https://bugs.webkit.org/show_bug.cgi?id=194807
+        <rdar://problem/48189132>
</ins><span class="cx"> 
</span><del>-            * wasm/regress/wasmToJS-should-purify-NaNs.js: Added.
</del><ins>+        Reviewed by Saam Barati.
</ins><span class="cx"> 
</span><ins>+        JSTests:
+
+        * wasm/regress/wasmToJS-should-purify-NaNs.js: Added.
+
+        Source/JavaScriptCore:
+
+        * runtime/JSCJSValue.h:
+        (JSC::jsNumber):
+        * runtime/TypedArrayAdaptors.h:
+        (JSC::IntegralTypedArrayAdaptor::toJSValue):
+        * wasm/js/WasmToJS.cpp:
+        (JSC::Wasm::wasmToJS):
+
+
+
+        git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+        2019-02-26  Mark Lam  <mark.lam@apple.com>
+
+                wasmToJS() should purify incoming NaNs.
+                https://bugs.webkit.org/show_bug.cgi?id=194807
+                <rdar://problem/48189132>
+
+                Reviewed by Saam Barati.
+
+                * wasm/regress/wasmToJS-should-purify-NaNs.js: Added.
+
</ins><span class="cx"> 2019-03-13  Babak Shafiei  <bshafiei@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Cherry-pick r241615. rdar://problem/48839366
</span><span class="lines">@@ -56,6 +73,16 @@
</span><span class="cx">     
</span><span class="cx">     Ditto for TypeSet::toJSONString() and TypeSet::toJSONString().
</span><span class="cx">     
</span><ins>+2019-02-27  Robin Morisset  <rmorisset@apple.com>
+
+        DFG: Loop-invariant code motion (LICM) should not hoist dead code
+        https://bugs.webkit.org/show_bug.cgi?id=194945
+        <rdar://problem/48311657>
+
+        Reviewed by Mark Lam.
+
+        * stress/licm-dead-code.js: Added.
+
</ins><span class="cx">     * runtime/SamplingProfiler.cpp:
</span><span class="cx">     (JSC::SamplingProfiler::stackTracesAsJSON):
</span><span class="cx">     * runtime/TypeSet.cpp:
</span></span></pre></div>
<a id="branchessafari607branchJSTestsstresslicmdeadcodejs"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/JSTests/stress/licm-dead-code.js (0 => 242855)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/JSTests/stress/licm-dead-code.js                              (rev 0)
+++ branches/safari-607-branch/JSTests/stress/licm-dead-code.js 2019-03-13 08:24:31 UTC (rev 242855)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+for (let i = 0; i < 1000; i++) {
+}
+for (let i = 0; i < 10; ++i) {
+    function foo() {
+        for (let j = 0; j < 3; j = j + "asdf") {
+            const cond = Error != Error;
+            if (!cond) {
+                42[0];
+            }
+
+            function bar(arg) {
+                return arg.baz = 42;
+            }
+            for (let k = 0; k < 10000; ++k) {
+                bar({}, ...arguments);
+            }
+        }
+        for (let j = 0; j < 1000000; ++j) {}
+    }
+    foo();
+}
+
</ins></span></pre></div>
<a id="branchessafari607branchSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/JavaScriptCore/ChangeLog (242854 => 242855)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/JavaScriptCore/ChangeLog       2019-03-13 08:24:29 UTC (rev 242854)
+++ branches/safari-607-branch/Source/JavaScriptCore/ChangeLog  2019-03-13 08:24:31 UTC (rev 242855)
</span><span class="lines">@@ -1,45 +1,62 @@
</span><span class="cx"> 2019-03-13  Babak Shafiei  <bshafiei@apple.com>
</span><span class="cx"> 
</span><del>-        Cherry-pick r242114. rdar://problem/48839372
</del><ins>+        Cherry-pick r242276. rdar://problem/48839389
</ins><span class="cx"> 
</span><del>-    wasmToJS() should purify incoming NaNs.
-    https://bugs.webkit.org/show_bug.cgi?id=194807
-    <rdar://problem/48189132>
</del><ins>+    DFG: Loop-invariant code motion (LICM) should not hoist dead code
+    https://bugs.webkit.org/show_bug.cgi?id=194945
+    <rdar://problem/48311657>
</ins><span class="cx">     
</span><span class="cx">     Reviewed by Saam Barati.
</span><span class="cx">     
</span><del>-    JSTests:
</del><ins>+    * dfg/DFGLICMPhase.cpp:
+    (JSC::DFG::LICMPhase::run):
</ins><span class="cx">     
</span><del>-    * wasm/regress/wasmToJS-should-purify-NaNs.js: Added.
</del><span class="cx">     
</span><del>-    Source/JavaScriptCore:
</del><span class="cx">     
</span><del>-    * runtime/JSCJSValue.h:
-    (JSC::jsNumber):
-    * runtime/TypedArrayAdaptors.h:
-    (JSC::IntegralTypedArrayAdaptor::toJSValue):
-    * wasm/js/WasmToJS.cpp:
-    (JSC::Wasm::wasmToJS):
-    
-    
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
</del><ins>+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
</ins><span class="cx"> 
</span><del>-    2019-02-26  Mark Lam  <mark.lam@apple.com>
</del><ins>+    2019-03-13  Babak Shafiei  <bshafiei@apple.com>
</ins><span class="cx"> 
</span><del>-            wasmToJS() should purify incoming NaNs.
-            https://bugs.webkit.org/show_bug.cgi?id=194807
-            <rdar://problem/48189132>
</del><ins>+            Cherry-pick r242114. rdar://problem/48839372
</ins><span class="cx"> 
</span><del>-            Reviewed by Saam Barati.
</del><ins>+        wasmToJS() should purify incoming NaNs.
+        https://bugs.webkit.org/show_bug.cgi?id=194807
+        <rdar://problem/48189132>
</ins><span class="cx"> 
</span><del>-            * runtime/JSCJSValue.h:
-            (JSC::jsNumber):
-            * runtime/TypedArrayAdaptors.h:
-            (JSC::IntegralTypedArrayAdaptor::toJSValue):
-            * wasm/js/WasmToJS.cpp:
-            (JSC::Wasm::wasmToJS):
</del><ins>+        Reviewed by Saam Barati.
</ins><span class="cx"> 
</span><ins>+        JSTests:
+
+        * wasm/regress/wasmToJS-should-purify-NaNs.js: Added.
+
+        Source/JavaScriptCore:
+
+        * runtime/JSCJSValue.h:
+        (JSC::jsNumber):
+        * runtime/TypedArrayAdaptors.h:
+        (JSC::IntegralTypedArrayAdaptor::toJSValue):
+        * wasm/js/WasmToJS.cpp:
+        (JSC::Wasm::wasmToJS):
+
+
+
+        git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+        2019-02-26  Mark Lam  <mark.lam@apple.com>
+
+                wasmToJS() should purify incoming NaNs.
+                https://bugs.webkit.org/show_bug.cgi?id=194807
+                <rdar://problem/48189132>
+
+                Reviewed by Saam Barati.
+
+                * runtime/JSCJSValue.h:
+                (JSC::jsNumber):
+                * runtime/TypedArrayAdaptors.h:
+                (JSC::IntegralTypedArrayAdaptor::toJSValue):
+                * wasm/js/WasmToJS.cpp:
+                (JSC::Wasm::wasmToJS):
+
</ins><span class="cx"> 2019-03-13  Babak Shafiei  <bshafiei@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Cherry-pick r241615. rdar://problem/48839366
</span><span class="lines">@@ -415,6 +432,17 @@
</span><span class="cx">             https://bugs.webkit.org/show_bug.cgi?id=194334
</span><span class="cx">             <rdar://problem/47844327>
</span><span class="cx"> 
</span><ins>+2019-02-27  Robin Morisset  <rmorisset@apple.com>
+
+        DFG: Loop-invariant code motion (LICM) should not hoist dead code
+        https://bugs.webkit.org/show_bug.cgi?id=194945
+        <rdar://problem/48311657>
+
+        Reviewed by Saam Barati.
+
+        * dfg/DFGLICMPhase.cpp:
+        (JSC::DFG::LICMPhase::run):
+
</ins><span class="cx">             Reviewed by Mark Lam.
</span><span class="cx"> 
</span><span class="cx">             * dfg/DFGAbstractInterpreterInlines.h:
</span></span></pre></div>
<a id="branchessafari607branchSourceJavaScriptCoredfgDFGLICMPhasecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp (242854 => 242855)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp    2019-03-13 08:24:29 UTC (rev 242854)
+++ branches/safari-607-branch/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp       2019-03-13 08:24:31 UTC (rev 242855)
</span><span class="lines">@@ -184,6 +184,9 @@
</span><span class="cx">         Vector<const NaturalLoop*> loopStack;
</span><span class="cx">         bool changed = false;
</span><span class="cx">         for (BasicBlock* block : m_graph.blocksInPreOrder()) {
</span><ins>+            if (!block->cfaHasVisited)
+                continue;
+
</ins><span class="cx">             const NaturalLoop* loop = m_graph.m_ssaNaturalLoops->innerMostLoopOf(block);
</span><span class="cx">             if (!loop)
</span><span class="cx">                 continue;
</span><span class="lines">@@ -210,6 +213,8 @@
</span><span class="cx">             
</span><span class="cx">             for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
</span><span class="cx">                 Node*& nodeRef = block->at(nodeIndex);
</span><ins>+                if (nodeRef->op() == ForceOSRExit)
+                    break;
</ins><span class="cx">                 for (unsigned stackIndex = loopStack.size(); stackIndex--;)
</span><span class="cx">                     changed |= attemptHoist(block, nodeRef, loopStack[stackIndex]);
</span><span class="cx">             }
</span></span></pre>
</div>
</div>

</body>
</html>