<!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>[162424] branches/jsCStack/Source/JavaScriptCore</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/162424">162424</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-01-20 19:27:59 -0800 (Mon, 20 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>IC status classes should directly query exit site information
https://bugs.webkit.org/show_bug.cgi?id=127326

Not yet reviewed.
        
This consolidates all of the reasoning about whether or not to inline an IC at the IR level.

* bytecode/CallLinkStatus.cpp:
(JSC::CallLinkStatus::computeFromLLInt):
(JSC::CallLinkStatus::computeFor):
* bytecode/CallLinkStatus.h:
* bytecode/CodeBlock.h:
(JSC::CodeBlock::hasExitSite):
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::hasExitSite):
(JSC::GetByIdStatus::computeFor):
* bytecode/GetByIdStatus.h:
* bytecode/PutByIdStatus.cpp:
(JSC::PutByIdStatus::hasExitSite):
(JSC::PutByIdStatus::computeFor):
* bytecode/PutByIdStatus.h:
* bytecode/StructureSet.h:
(JSC::StructureSet::StructureSet):
(JSC::StructureSet::add):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGValidate.cpp:
(JSC::DFG::Validate::validate):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesjsCStackSourceJavaScriptCoreChangeLog">branches/jsCStack/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeCallLinkStatuscpp">branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeCallLinkStatush">branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeCodeBlockh">branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatuscpp">branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatush">branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodePutByIdStatuscpp">branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodePutByIdStatush">branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeStructureSeth">branches/jsCStack/Source/JavaScriptCore/bytecode/StructureSet.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoredfgDFGByteCodeParsercpp">branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoredfgDFGValidatecpp">branches/jsCStack/Source/JavaScriptCore/dfg/DFGValidate.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesjsCStackSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ChangeLog (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2014-01-20  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        IC status classes should directly query exit site information
+        https://bugs.webkit.org/show_bug.cgi?id=127326
+
+        Not yet reviewed.
+        
+        This consolidates all of the reasoning about whether or not to inline an IC at the IR level.
+
+        * bytecode/CallLinkStatus.cpp:
+        (JSC::CallLinkStatus::computeFromLLInt):
+        (JSC::CallLinkStatus::computeFor):
+        * bytecode/CallLinkStatus.h:
+        * bytecode/CodeBlock.h:
+        (JSC::CodeBlock::hasExitSite):
+        * bytecode/GetByIdStatus.cpp:
+        (JSC::GetByIdStatus::hasExitSite):
+        (JSC::GetByIdStatus::computeFor):
+        * bytecode/GetByIdStatus.h:
+        * bytecode/PutByIdStatus.cpp:
+        (JSC::PutByIdStatus::hasExitSite):
+        (JSC::PutByIdStatus::computeFor):
+        * bytecode/PutByIdStatus.h:
+        * bytecode/StructureSet.h:
+        (JSC::StructureSet::StructureSet):
+        (JSC::StructureSet::add):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::handleCall):
+        (JSC::DFG::ByteCodeParser::handleGetById):
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGValidate.cpp:
+        (JSC::DFG::Validate::validate):
+
</ins><span class="cx"> 2014-01-20  Matthew Mirman  &lt;mmirman@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ArithSqrt in FTL
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeCallLinkStatuscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -81,11 +81,17 @@
</span><span class="cx">     return m_executable-&gt;intrinsicFor(kind);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CallLinkStatus CallLinkStatus::computeFromLLInt(CodeBlock* profiledBlock, unsigned bytecodeIndex)
</del><ins>+CallLinkStatus CallLinkStatus::computeFromLLInt(const ConcurrentJITLocker&amp; locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(profiledBlock);
</span><span class="cx">     UNUSED_PARAM(bytecodeIndex);
</span><span class="cx"> #if ENABLE(LLINT)
</span><ins>+    if (profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadFunction))) {
+        // We could force this to be a closure call, but instead we'll just assume that it
+        // takes slow path.
+        return takesSlowPath();
+    }
+    
</ins><span class="cx">     Instruction* instruction = profiledBlock-&gt;instructions().begin() + bytecodeIndex;
</span><span class="cx">     LLIntCallLinkInfo* callLinkInfo = instruction[5].u.callLinkInfo;
</span><span class="cx">     
</span><span class="lines">@@ -102,11 +108,16 @@
</span><span class="cx">     UNUSED_PARAM(profiledBlock);
</span><span class="cx">     UNUSED_PARAM(bytecodeIndex);
</span><span class="cx"> #if ENABLE(JIT)
</span><ins>+    if (profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCacheWatchpoint))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadExecutable)))
+        return takesSlowPath();
+    
</ins><span class="cx">     if (!profiledBlock-&gt;hasBaselineJITProfiling())
</span><del>-        return computeFromLLInt(profiledBlock, bytecodeIndex);
</del><ins>+        return computeFromLLInt(locker, profiledBlock, bytecodeIndex);
</ins><span class="cx">     
</span><span class="cx">     if (profiledBlock-&gt;couldTakeSlowCase(bytecodeIndex))
</span><del>-        return CallLinkStatus::takesSlowPath();
</del><ins>+        return takesSlowPath();
</ins><span class="cx">     
</span><span class="cx">     CallLinkInfo&amp; callLinkInfo = profiledBlock-&gt;getCallLinkInfo(bytecodeIndex);
</span><span class="cx">     if (callLinkInfo.stub)
</span><span class="lines">@@ -114,9 +125,10 @@
</span><span class="cx">     
</span><span class="cx">     JSFunction* target = callLinkInfo.lastSeenCallee.get();
</span><span class="cx">     if (!target)
</span><del>-        return computeFromLLInt(profiledBlock, bytecodeIndex);
</del><ins>+        return computeFromLLInt(locker, profiledBlock, bytecodeIndex);
</ins><span class="cx">     
</span><del>-    if (callLinkInfo.hasSeenClosure)
</del><ins>+    if (callLinkInfo.hasSeenClosure
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadFunction)))
</ins><span class="cx">         return CallLinkStatus(target-&gt;executable(), target-&gt;structure());
</span><span class="cx"> 
</span><span class="cx">     return CallLinkStatus(target);
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeCallLinkStatush"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.h (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.h        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.h        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define CallLinkStatus_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CodeSpecializationKind.h&quot;
</span><ins>+#include &quot;ConcurrentJITLock.h&quot;
</ins><span class="cx"> #include &quot;Intrinsic.h&quot;
</span><span class="cx"> #include &quot;JSCJSValue.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -74,32 +75,6 @@
</span><span class="cx">     
</span><span class="cx">     static CallLinkStatus computeFor(CodeBlock*, unsigned bytecodeIndex);
</span><span class="cx">     
</span><del>-    CallLinkStatus&amp; setHasBadFunctionExitSite(bool didHaveExitSite)
-    {
-        ASSERT(!m_isProved);
-        if (didHaveExitSite) {
-            // Turn this into a closure call.
-            m_callTarget = JSValue();
-        }
-        return *this;
-    }
-    
-    CallLinkStatus&amp; setHasBadCacheExitSite(bool didHaveExitSite)
-    {
-        ASSERT(!m_isProved);
-        if (didHaveExitSite)
-            *this = takesSlowPath();
-        return *this;
-    }
-    
-    CallLinkStatus&amp; setHasBadExecutableExitSite(bool didHaveExitSite)
-    {
-        ASSERT(!m_isProved);
-        if (didHaveExitSite)
-            *this = takesSlowPath();
-        return *this;
-    }
-    
</del><span class="cx">     bool isSet() const { return m_callTarget || m_executable || m_couldTakeSlowPath; }
</span><span class="cx">     
</span><span class="cx">     bool operator!() const { return !isSet(); }
</span><span class="lines">@@ -119,7 +94,7 @@
</span><span class="cx">     void dump(PrintStream&amp;) const;
</span><span class="cx">     
</span><span class="cx"> private:
</span><del>-    static CallLinkStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex);
</del><ins>+    static CallLinkStatus computeFromLLInt(const ConcurrentJITLocker&amp;, CodeBlock*, unsigned bytecodeIndex);
</ins><span class="cx">     
</span><span class="cx">     JSValue m_callTarget;
</span><span class="cx">     ExecutableBase* m_executable;
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -592,11 +592,15 @@
</span><span class="cx">         ConcurrentJITLocker locker(m_lock);
</span><span class="cx">         return m_exitProfile.add(locker, site);
</span><span class="cx">     }
</span><del>-        
</del><ins>+     
+    bool hasExitSite(const ConcurrentJITLocker&amp; locker, const DFG::FrequentExitSite&amp; site) const
+    {
+        return m_exitProfile.hasExitSite(locker, site);
+    }
</ins><span class="cx">     bool hasExitSite(const DFG::FrequentExitSite&amp; site) const
</span><span class="cx">     {
</span><span class="cx">         ConcurrentJITLocker locker(m_lock);
</span><del>-        return m_exitProfile.hasExitSite(locker, site);
</del><ins>+        return hasExitSite(locker, site);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     DFG::ExitProfile&amp; exitProfile() { return m_exitProfile; }
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatuscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -34,6 +34,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+bool GetByIdStatus::hasExitSite(const ConcurrentJITLocker&amp; locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
+{
+    return profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCacheWatchpoint))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCache))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCacheWatchpoint));
+}
+
</ins><span class="cx"> GetByIdStatus GetByIdStatus::computeFromLLInt(CodeBlock* profiledBlock, unsigned bytecodeIndex, StringImpl* uid)
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(profiledBlock);
</span><span class="lines">@@ -114,8 +122,12 @@
</span><span class="cx">     UNUSED_PARAM(uid);
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx">     StructureStubInfo* stubInfo = map.get(CodeOrigin(bytecodeIndex));
</span><del>-    if (!stubInfo || !stubInfo-&gt;seen)
</del><ins>+    if (!stubInfo || !stubInfo-&gt;seen) {
+        if (hasExitSite(locker, profiledBlock, bytecodeIndex))
+            return GetByIdStatus(TakesSlowPath, true);
+    
</ins><span class="cx">         return computeFromLLInt(profiledBlock, bytecodeIndex, uid);
</span><ins>+    }
</ins><span class="cx">     
</span><span class="cx">     if (stubInfo-&gt;resetByGC)
</span><span class="cx">         return GetByIdStatus(TakesSlowPath, true);
</span><span class="lines">@@ -142,7 +154,8 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     // Next check if it takes slow case, in which case we want to be kind of careful.
</span><del>-    if (profiledBlock-&gt;likelyToTakeSlowCase(bytecodeIndex))
</del><ins>+    if (profiledBlock-&gt;likelyToTakeSlowCase(bytecodeIndex)
+        || hasExitSite(locker, profiledBlock, bytecodeIndex))
</ins><span class="cx">         return GetByIdStatus(TakesSlowPath, true);
</span><span class="cx">     
</span><span class="cx">     // Finally figure out if we can derive an access strategy.
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatush"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef GetByIdStatus_h
</span><span class="cx"> #define GetByIdStatus_h
</span><span class="cx"> 
</span><ins>+#include &quot;ConcurrentJITLock.h&quot;
</ins><span class="cx"> #include &quot;IntendedStructureChain.h&quot;
</span><span class="cx"> #include &quot;PropertyOffset.h&quot;
</span><span class="cx"> #include &quot;StructureSet.h&quot;
</span><span class="lines">@@ -90,6 +91,7 @@
</span><span class="cx">     bool wasSeenInJIT() const { return m_wasSeenInJIT; }
</span><span class="cx">     
</span><span class="cx"> private:
</span><ins>+    static bool hasExitSite(const ConcurrentJITLocker&amp;, CodeBlock*, unsigned bytecodeIndex);
</ins><span class="cx">     static void computeForChain(GetByIdStatus&amp; result, CodeBlock*, StringImpl* uid);
</span><span class="cx">     static GetByIdStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex, StringImpl* uid);
</span><span class="cx">     
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodePutByIdStatuscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -35,6 +35,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+bool PutByIdStatus::hasExitSite(const ConcurrentJITLocker&amp; locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
+{
+    return profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCacheWatchpoint))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCache))
+        || profiledBlock-&gt;hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCacheWatchpoint));
+}
+
</ins><span class="cx"> PutByIdStatus PutByIdStatus::computeFromLLInt(CodeBlock* profiledBlock, unsigned bytecodeIndex, StringImpl* uid)
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(profiledBlock);
</span><span class="lines">@@ -89,7 +97,8 @@
</span><span class="cx">     UNUSED_PARAM(bytecodeIndex);
</span><span class="cx">     UNUSED_PARAM(uid);
</span><span class="cx"> #if ENABLE(JIT)
</span><del>-    if (profiledBlock-&gt;likelyToTakeSlowCase(bytecodeIndex))
</del><ins>+    if (profiledBlock-&gt;likelyToTakeSlowCase(bytecodeIndex)
+        || hasExitSite(locker, profiledBlock, bytecodeIndex))
</ins><span class="cx">         return PutByIdStatus(TakesSlowPath, 0, 0, 0, invalidOffset);
</span><span class="cx">     
</span><span class="cx">     StructureStubInfo* stubInfo = map.get(CodeOrigin(bytecodeIndex));
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodePutByIdStatush"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.h (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.h        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/PutByIdStatus.h        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx">     PropertyOffset offset() const { return m_offset; }
</span><span class="cx">     
</span><span class="cx"> private:
</span><ins>+    static bool hasExitSite(const ConcurrentJITLocker&amp;, CodeBlock*, unsigned bytecodeIndex);
</ins><span class="cx">     static PutByIdStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex, StringImpl* uid);
</span><span class="cx">     
</span><span class="cx">     State m_state;
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeStructureSeth"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/StructureSet.h (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/StructureSet.h        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/StructureSet.h        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     
</span><span class="cx">     StructureSet(Structure* structure)
</span><span class="cx">     {
</span><ins>+        ASSERT(structure);
</ins><span class="cx">         m_structures.append(structure);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -55,6 +56,7 @@
</span><span class="cx">     
</span><span class="cx">     void add(Structure* structure)
</span><span class="cx">     {
</span><ins>+        ASSERT(structure);
</ins><span class="cx">         ASSERT(!contains(structure));
</span><span class="cx">         m_structures.append(structure);
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -1158,14 +1158,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_graph.isConstant(callTarget))
</span><span class="cx">         callLinkStatus = CallLinkStatus(m_graph.valueOfJSConstant(callTarget)).setIsProved(true);
</span><del>-    else {
</del><ins>+    else
</ins><span class="cx">         callLinkStatus = CallLinkStatus::computeFor(m_inlineStackTop-&gt;m_profiledBlock, m_currentIndex);
</span><del>-        callLinkStatus.setHasBadFunctionExitSite(m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadFunction));
-        callLinkStatus.setHasBadCacheExitSite(
-            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCache)
-            || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCacheWatchpoint));
-        callLinkStatus.setHasBadExecutableExitSite(m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadExecutable));
-    }
</del><span class="cx">     
</span><span class="cx">     if (!callLinkStatus.canOptimize()) {
</span><span class="cx">         // Oddly, this conflates calls that haven't executed with calls that behaved sufficiently polymorphically
</span><span class="lines">@@ -1775,11 +1769,7 @@
</span><span class="cx">     int destinationOperand, SpeculatedType prediction, Node* base, unsigned identifierNumber,
</span><span class="cx">     const GetByIdStatus&amp; getByIdStatus)
</span><span class="cx"> {
</span><del>-    if (!getByIdStatus.isSimple()
-        || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCache)
-        || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCacheWatchpoint)
-        || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadWeakConstantCache)
-        || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadWeakConstantCacheWatchpoint)) {
</del><ins>+    if (!getByIdStatus.isSimple()) {
</ins><span class="cx">         set(VirtualRegister(destinationOperand),
</span><span class="cx">             addToGraph(
</span><span class="cx">                 getByIdStatus.makesCalls() ? GetByIdFlush : GetById,
</span><span class="lines">@@ -2481,18 +2471,11 @@
</span><span class="cx">                 canCountAsInlined = false;
</span><span class="cx">             }
</span><span class="cx">             
</span><del>-            bool hasExitSite =
-                m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCache)
-                || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCacheWatchpoint)
-                || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadWeakConstantCache)
-                || m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadWeakConstantCacheWatchpoint);
-            
-            if (!hasExitSite &amp;&amp; putByIdStatus.isSimpleReplace()) {
</del><ins>+            if (putByIdStatus.isSimpleReplace()) {
</ins><span class="cx">                 addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(putByIdStatus.oldStructure())), base);
</span><span class="cx">                 handlePutByOffset(base, identifierNumber, putByIdStatus.offset(), value);
</span><span class="cx">             } else if (
</span><del>-                !hasExitSite
-                &amp;&amp; putByIdStatus.isSimpleTransition()
</del><ins>+                putByIdStatus.isSimpleTransition()
</ins><span class="cx">                 &amp;&amp; (!putByIdStatus.structureChain()
</span><span class="cx">                     || putByIdStatus.structureChain()-&gt;isStillValid())) {
</span><span class="cx">                 
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoredfgDFGValidatecpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/dfg/DFGValidate.cpp (162423 => 162424)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/dfg/DFGValidate.cpp        2014-01-21 03:26:22 UTC (rev 162423)
+++ branches/jsCStack/Source/JavaScriptCore/dfg/DFGValidate.cpp        2014-01-21 03:27:59 UTC (rev 162424)
</span><span class="lines">@@ -187,6 +187,13 @@
</span><span class="cx">                 Node* node = block-&gt;at(i);
</span><span class="cx">                 VALIDATE((node), !node-&gt;isTerminal());
</span><span class="cx">             }
</span><ins>+            
+            for (size_t i = 0; i &lt; block-&gt;size(); ++i) {
+                Node* node = block-&gt;at(i);
+                
+                if (node-&gt;hasStructure())
+                    VALIDATE((node), !!node-&gt;structure());
+            }
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         switch (m_graph.m_form) {
</span></span></pre>
</div>
</div>

</body>
</html>