<!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>[162940] 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/162940">162940</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-01-28 09:43:07 -0800 (Tue, 28 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Jettison DFG code when neither breakpoints or the profiler are active.
&lt;https://webkit.org/b/127766&gt;

Reviewed by Geoffrey Garen.

Source/JavaScriptCore: 

We need to jettison the DFG CodeBlocks under the following circumstances:
1. When adding breakpoints to a CodeBlock, jettison it if it is a DFG CodeBlock.
2. When enabling stepping mode in a CodeBlock, jettison it if it a DFG CodeBlock.
3. When settign the enabled profiler in the VM, we need to jettison all DFG
   CodeBlocks.

Instead of emitting speculation checks, the DFG code will now treat Breakpoint,
ProfileWillCall, and ProfileDidCall as no-ops similar to a Phantom node. We
still need to track these nodes so that they match the corresponding opcodes
in the baseline JIT when we jettison and OSR exit. Without them, we would OSR
exit to the wrong location in the baseline JIT code.

In DFGDriver's compileImpl() and DFGPlan's finalizeWithoutNotifyingCallback()
we fail the compilation effort with a CompilationInvalidated result. This allows
the DFG compiler to re-attampt the compilation of the function after some time
if it is hot. The CompilationInvalidated result is supposed to cause the DFG
to exercise an exponential back off before re-attempting compilation again
(see runtime/CompilationResult.h).

This patch improves the Octane score from ~2950 to ~3067.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::addBreakpoint):
(JSC::CodeBlock::setSteppingMode):
* bytecode/CodeBlock.h:
* debugger/Debugger.h:
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter&lt;AbstractStateType&gt;::executeEffects):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDriver.cpp:
(JSC::DFG::compileImpl):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::finalizeWithoutNotifyingCallback):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* profiler/LegacyProfiler.cpp:
(JSC::LegacyProfiler::startProfiling):
(JSC::LegacyProfiler::stopProfiling):
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::SetEnabledProfilerFunctor::operator()):
(JSC::VM::setEnabledProfiler):
* runtime/VM.h:
(JSC::VM::enabledProfiler):

LayoutTests: 

Added a test to exercise setting a breakpoint in 2 DFG compiled functions:
1 not inlined, and 1 inlined.

* inspector-protocol/debugger/resources/breakpoint.js:
(notInlineable):
(inlineable):
(notInliningFoo):
(inliningFoo):
(dfgWithoutInline):
(dfgWithInline):
* inspector-protocol/debugger/setBreakpoint-dfg-expected.txt: Added.
* inspector-protocol/debugger/setBreakpoint-dfg.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggerresourcesbreakpointjs">trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggerh">trunk/Source/JavaScriptCore/debugger/Debugger.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh">trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGClobberizeh">trunk/Source/JavaScriptCore/dfg/DFGClobberize.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGDrivercpp">trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGPlancpp">trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerLegacyProfilercpp">trunk/Source/JavaScriptCore/profiler/LegacyProfiler.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggersetBreakpointdfgexpectedtxt">trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggersetBreakpointdfghtml">trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/LayoutTests/ChangeLog        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-01-28  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Jettison DFG code when neither breakpoints or the profiler are active.
+        &lt;https://webkit.org/b/127766&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        Added a test to exercise setting a breakpoint in 2 DFG compiled functions:
+        1 not inlined, and 1 inlined.
+
+        * inspector-protocol/debugger/resources/breakpoint.js:
+        (notInlineable):
+        (inlineable):
+        (notInliningFoo):
+        (inliningFoo):
+        (dfgWithoutInline):
+        (dfgWithInline):
+        * inspector-protocol/debugger/setBreakpoint-dfg-expected.txt: Added.
+        * inspector-protocol/debugger/setBreakpoint-dfg.html: Added.
+
</ins><span class="cx"> 2014-01-28  Gurpreet Kaur  &lt;k.gurpreet@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for menclose element
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggerresourcesbreakpointjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -17,3 +17,42 @@
</span><span class="cx"> {
</span><span class="cx">     log(&quot;inside breakpointActions a:(&quot; + a + &quot;) b:(&quot; + b + &quot;)&quot;);
</span><span class="cx"> }
</span><ins>+
+function notInlineable(x)
+{
+    var func = new Function(&quot;return x + 100;&quot;);
+    return x + 3;
+}
+
+function inlineable(x)
+{
+    return x + 5;
+}
+
+function notInliningFoo(x)
+{
+    return notInlineable(x);
+}
+
+function inliningFoo(x)
+{
+    return inlineable(x);
+}
+
+function dfgWithoutInline()
+{
+    var i;
+    var result = 0;
+    for (i = 0; i &lt; 1000; i++)
+        result += notInliningFoo(i);
+    log(&quot;dfgWithoutInline result: &quot; + result);    
+}
+
+function dfgWithInline()
+{
+    var i;
+    var result = 0;
+    for (i = 0; i &lt; 1000; i++)
+        result += inliningFoo(i);
+    log(&quot;dfgWithInline result: &quot; + result);    
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggersetBreakpointdfgexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-expected.txt (0 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-expected.txt        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Debugger.setBreakpoint in DFG compiled functions.
+
+Found breakpoint.js
+dfgWithoutInline result: 502500
+dfgWithInline result: 504500
+dfg functions warmed up
+
+Breakpoint set in notInlineable()
+Breakpoint set in inlineable()
+
+Hit Breakpoint 1!
+Removed Breakpoint 1!
+dfgWithoutInline result: 502500
+Hit Breakpoint 2!
+Removed Breakpoint 2!
+PASS
+dfgWithInline result: 504500
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggersetBreakpointdfghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg.html (0 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg.html                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg.html        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../http/tests/inspector-protocol/resources/protocol-test.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/breakpoint.js&quot;&gt;&lt;/script&gt;
+
+&lt;script&gt;
+// Put this here instead of on &lt;body onload&gt; to prevent an extra Debugger.scriptParsed event.
+window.onload = runTest;
+
+function test()
+{
+    // This test setting 2 breakpoints in DFG compiled functions: one inlined,
+    // and one not inlined.
+
+    InspectorTest.sendCommand(&quot;Debugger.enable&quot;, {});
+
+    var dfgNonInlinedBreakpointId = null;
+    var dfgInlinedBreakpointId = null;
+    var scriptIdentifier = 0;
+    var startLine = 0;
+
+    InspectorTest.eventHandler[&quot;Debugger.scriptParsed&quot;] = function(messageObject)
+    {
+        if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
+            InspectorTest.log(&quot;Found breakpoint.js&quot;);
+            scriptIdentifier = messageObject.params.scriptId;
+            startLine = messageObject.params.startLine;
+
+            InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {
+                expression: &quot;dfgWithoutInline(); dfgWithInline();&quot;
+            }, function(responseObject) {
+                InspectorTest.log(&quot;dfg functions warmed up\n&quot;);
+
+                var location1 = {scriptId: scriptIdentifier, lineNumber: 22, columnNumber: 0};
+
+                InspectorTest.sendCommand(&quot;Debugger.setBreakpoint&quot;, {location: location1}, function(responseObject) {
+                    InspectorTest.checkForError(responseObject);
+                    InspectorTest.log(&quot;Breakpoint set in notInlineable()&quot;);
+
+                    dfgNonInlinedBreakpointId = responseObject.result.breakpointId;
+                    var location2 = {scriptId: scriptIdentifier, lineNumber: 28, columnNumber: 0};
+                    InspectorTest.sendCommand(&quot;Debugger.setBreakpoint&quot;, {location: location2}, function(responseObject) {
+                        InspectorTest.checkForError(responseObject);
+                        InspectorTest.log(&quot;Breakpoint set in inlineable()\n&quot;);
+
+                        dfgInlinedBreakpointId = responseObject.result.breakpointId;
+                        InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {
+                            expression: &quot;dfgWithoutInline(); dfgWithInline();&quot;
+                        });
+                    });
+                });
+            });
+        }
+    }
+
+    var breakpointsHit = 0;
+    InspectorTest.eventHandler[&quot;Debugger.paused&quot;] = function(messageObject)
+    {
+        var breakpointId = null;
+        breakpointsHit++;
+        InspectorTest.log(&quot;Hit Breakpoint &quot; + breakpointsHit + &quot;!&quot;);
+        if (breakpointsHit == 1)
+            breakpointId = dfgNonInlinedBreakpointId;
+        else if (breakpointsHit == 2)
+            breakpointId = dfgInlinedBreakpointId;
+        else
+            InspectorTest.log(&quot;Unexpected breakpoint&quot;);
+
+        InspectorTest.sendCommand(&quot;Debugger.removeBreakpoint&quot;, {&quot;breakpointId&quot;: breakpointId}, function(responseObject) {
+            InspectorTest.log(&quot;Removed Breakpoint &quot; + breakpointsHit + &quot;!&quot;);
+            InspectorTest.sendCommand(&quot;Debugger.resume&quot;, {}, function(responseObject) {
+                if (breakpointsHit == 2) {
+                    InspectorTest.log(&quot;PASS&quot;);
+                    InspectorTest.completeTest();
+                }
+            });
+        });
+    }
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;Debugger.setBreakpoint in DFG compiled functions.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2014-01-28  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Jettison DFG code when neither breakpoints or the profiler are active.
+        &lt;https://webkit.org/b/127766&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        We need to jettison the DFG CodeBlocks under the following circumstances:
+        1. When adding breakpoints to a CodeBlock, jettison it if it is a DFG CodeBlock.
+        2. When enabling stepping mode in a CodeBlock, jettison it if it a DFG CodeBlock.
+        3. When settign the enabled profiler in the VM, we need to jettison all DFG
+           CodeBlocks.
+
+        Instead of emitting speculation checks, the DFG code will now treat Breakpoint,
+        ProfileWillCall, and ProfileDidCall as no-ops similar to a Phantom node. We
+        still need to track these nodes so that they match the corresponding opcodes
+        in the baseline JIT when we jettison and OSR exit. Without them, we would OSR
+        exit to the wrong location in the baseline JIT code.
+
+        In DFGDriver's compileImpl() and DFGPlan's finalizeWithoutNotifyingCallback()
+        we fail the compilation effort with a CompilationInvalidated result. This allows
+        the DFG compiler to re-attampt the compilation of the function after some time
+        if it is hot. The CompilationInvalidated result is supposed to cause the DFG
+        to exercise an exponential back off before re-attempting compilation again
+        (see runtime/CompilationResult.h).
+
+        This patch improves the Octane score from ~2950 to ~3067.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::addBreakpoint):
+        (JSC::CodeBlock::setSteppingMode):
+        * bytecode/CodeBlock.h:
+        * debugger/Debugger.h:
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter&lt;AbstractStateType&gt;::executeEffects):
+        * dfg/DFGClobberize.h:
+        (JSC::DFG::clobberize):
+        * dfg/DFGDriver.cpp:
+        (JSC::DFG::compileImpl):
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::finalizeWithoutNotifyingCallback):
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * profiler/LegacyProfiler.cpp:
+        (JSC::LegacyProfiler::startProfiling):
+        (JSC::LegacyProfiler::stopProfiling):
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        (JSC::SetEnabledProfilerFunctor::operator()):
+        (JSC::VM::setEnabledProfiler):
+        * runtime/VM.h:
+        (JSC::VM::enabledProfiler):
+
</ins><span class="cx"> 2014-01-27  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         -[JSContext evaluteScript:] calls JSEvaluteScript with startingLineNumber 0, later interpreted as a oneBasedInt
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -3531,4 +3531,19 @@
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CodeBlock::addBreakpoint(unsigned numBreakpoints)
+{
+    m_numBreakpoints += numBreakpoints;
+    ASSERT(m_numBreakpoints);
+    if (jitType() == JITCode::DFGJIT)
+        jettison();
+}
+
+void CodeBlock::setSteppingMode(CodeBlock::SteppingMode mode)
+{
+    m_steppingMode = mode;
+    if (mode == SteppingModeEnabled &amp;&amp; jitType() == JITCode::DFGJIT)
+        jettison();
+}
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -872,7 +872,7 @@
</span><span class="cx">     int hasDebuggerRequests() const { return !!m_debuggerRequests; }
</span><span class="cx">     void* debuggerRequestsAddress() { return &amp;m_debuggerRequests; }
</span><span class="cx"> 
</span><del>-    void addBreakpoint(unsigned numBreakpoints) { m_numBreakpoints += numBreakpoints; }
</del><ins>+    void addBreakpoint(unsigned numBreakpoints);
</ins><span class="cx">     void removeBreakpoint(unsigned numBreakpoints)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_numBreakpoints &gt;= numBreakpoints);
</span><span class="lines">@@ -883,7 +883,7 @@
</span><span class="cx">         SteppingModeDisabled,
</span><span class="cx">         SteppingModeEnabled
</span><span class="cx">     };
</span><del>-    void setSteppingMode(SteppingMode mode) { m_steppingMode = mode; }
</del><ins>+    void setSteppingMode(SteppingMode);
</ins><span class="cx"> 
</span><span class="cx">     void clearDebuggerRequests() { m_debuggerRequests = 0; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/Debugger.h (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/Debugger.h        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/debugger/Debugger.h        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx">     void stepOutOfFunction();
</span><span class="cx"> 
</span><span class="cx">     bool isPaused() { return m_isPaused; }
</span><ins>+    bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }
</ins><span class="cx"> 
</span><span class="cx">     virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String&amp; errorMessage) = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -170,7 +171,6 @@
</span><span class="cx">         SteppingModeEnabled
</span><span class="cx">     };
</span><span class="cx">     void setSteppingMode(SteppingMode);
</span><del>-    bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }
</del><span class="cx"> 
</span><span class="cx">     enum BreakpointState {
</span><span class="cx">         BreakpointDisabled,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -1754,13 +1754,13 @@
</span><span class="cx">         node-&gt;setCanExit(true);
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case Breakpoint:
-    case ProfileWillCall:
-    case ProfileDidCall:
</del><span class="cx">     case CheckWatchdogTimer:
</span><span class="cx">         node-&gt;setCanExit(true);
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+    case Breakpoint:
+    case ProfileWillCall:
+    case ProfileDidCall:
</ins><span class="cx">     case Phantom:
</span><span class="cx">     case Check:
</span><span class="cx">     case CountExecution:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGClobberizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGClobberize.h (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -88,6 +88,9 @@
</span><span class="cx">     case WeakJSConstant:
</span><span class="cx">     case Identity:
</span><span class="cx">     case Phantom:
</span><ins>+    case Breakpoint:
+    case ProfileWillCall:
+    case ProfileDidCall:
</ins><span class="cx">     case BitAnd:
</span><span class="cx">     case BitOr:
</span><span class="cx">     case BitXor:
</span><span class="lines">@@ -618,9 +621,6 @@
</span><span class="cx">         clobberizeForAllocation(read, write);
</span><span class="cx">         return;
</span><span class="cx">         
</span><del>-    case Breakpoint:
-    case ProfileWillCall:
-    case ProfileDidCall:
</del><span class="cx">     case CountExecution:
</span><span class="cx">     case CheckWatchdogTimer:
</span><span class="cx">         read(InternalState);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGDrivercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include &quot;DFGPlan.h&quot;
</span><span class="cx"> #include &quot;DFGThunks.h&quot;
</span><span class="cx"> #include &quot;DFGWorklist.h&quot;
</span><ins>+#include &quot;Debugger.h&quot;
</ins><span class="cx"> #include &quot;JITCode.h&quot;
</span><span class="cx"> #include &quot;Operations.h&quot;
</span><span class="cx"> #include &quot;Options.h&quot;
</span><span class="lines">@@ -73,6 +74,13 @@
</span><span class="cx">     if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock-&gt;instructionCount()))
</span><span class="cx">         return CompilationFailed;
</span><span class="cx">     
</span><ins>+    if (vm.enabledProfiler())
+        return CompilationInvalidated;
+
+    Debugger* debugger = codeBlock-&gt;globalObject()-&gt;debugger();
+    if (debugger &amp;&amp; (debugger-&gt;isStepping() || codeBlock-&gt;baselineAlternative()-&gt;hasDebuggerRequests()))
+        return CompilationInvalidated;
+
</ins><span class="cx">     if (logCompilationChanges())
</span><span class="cx">         dataLog(&quot;DFG(Driver) compiling &quot;, *codeBlock, &quot; with &quot;, mode, &quot;, number of instructions = &quot;, codeBlock-&gt;instructionCount(), &quot;\n&quot;);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPlancpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> #include &quot;DFGValidate.h&quot;
</span><span class="cx"> #include &quot;DFGVirtualRegisterAllocationPhase.h&quot;
</span><span class="cx"> #include &quot;DFGWatchpointCollectionPhase.h&quot;
</span><ins>+#include &quot;Debugger.h&quot;
</ins><span class="cx"> #include &quot;OperandsInlines.h&quot;
</span><span class="cx"> #include &quot;Operations.h&quot;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="lines">@@ -346,7 +347,14 @@
</span><span class="cx"> {
</span><span class="cx">     if (!isStillValid())
</span><span class="cx">         return CompilationInvalidated;
</span><del>-    
</del><ins>+
+    if (vm.enabledProfiler())
+        return CompilationInvalidated;
+
+    Debugger* debugger = codeBlock-&gt;globalObject()-&gt;debugger();
+    if (debugger &amp;&amp; (debugger-&gt;isStepping() || codeBlock-&gt;baselineAlternative()-&gt;hasDebuggerRequests()))
+        return CompilationInvalidated;
+
</ins><span class="cx">     bool result;
</span><span class="cx">     if (codeBlock-&gt;codeType() == FunctionCode)
</span><span class="cx">         result = finalizer-&gt;finalizeFunction();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -4232,26 +4232,6 @@
</span><span class="cx">     case Flush:
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case Breakpoint: {
-        GPRTemporary temp(this);
-        GPRReg debuggerRequestsGPR = temp.gpr();
-        m_jit.load32(m_jit.codeBlock()-&gt;debuggerRequestsAddress(), debuggerRequestsGPR);
-        speculationCheck(
-            DebuggerEvent, JSValueRegs(), 0,
-            m_jit.branchTest32(JITCompiler::NonZero, debuggerRequestsGPR));
-        break;
-    }
-
-    case ProfileWillCall:
-    case ProfileDidCall: {
-        GPRTemporary temp(this);
-        m_jit.loadPtr(m_jit.vm()-&gt;enabledProfilerAddress(), temp.gpr());
-        speculationCheck(
-            DebuggerEvent, JSValueRegs(), 0,
-            m_jit.branchTestPtr(JITCompiler::NonZero, temp.gpr()));
-        break;
-    }
-
</del><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><span class="cx">         emitCall(node);
</span><span class="lines">@@ -4690,6 +4670,9 @@
</span><span class="cx">         noResult(node);
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+    case Breakpoint:
+    case ProfileWillCall:
+    case ProfileDidCall:
</ins><span class="cx">     case PhantomLocal:
</span><span class="cx">     case LoopHint:
</span><span class="cx">         // This is a no-op.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -4524,25 +4524,6 @@
</span><span class="cx">     case Flush:
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case Breakpoint: {
-        GPRTemporary temp(this);
-        GPRReg debuggerRequestsGPR = temp.gpr();
-        m_jit.load32(m_jit.codeBlock()-&gt;debuggerRequestsAddress(), debuggerRequestsGPR);
-        speculationCheck(
-            DebuggerEvent, JSValueRegs(), 0,
-            m_jit.branchTest32(JITCompiler::NonZero, debuggerRequestsGPR));
-        break;
-    }
-
-    case ProfileWillCall:
-    case ProfileDidCall:
-        speculationCheck(
-            DebuggerEvent, JSValueRegs(), 0,
-            m_jit.branchTestPtr(
-                JITCompiler::NonZero,
-                JITCompiler::AbsoluteAddress(m_jit.vm()-&gt;enabledProfilerAddress())));
-        break;
-
</del><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><span class="cx">         emitCall(node);
</span><span class="lines">@@ -4939,6 +4920,9 @@
</span><span class="cx">         noResult(node);
</span><span class="cx">         break;
</span><span class="cx">         
</span><ins>+    case Breakpoint:
+    case ProfileWillCall:
+    case ProfileDidCall:
</ins><span class="cx">     case PhantomLocal:
</span><span class="cx">     case LoopHint:
</span><span class="cx">         // This is a no-op.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerLegacyProfilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/LegacyProfiler.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/LegacyProfiler.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/profiler/LegacyProfiler.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    exec-&gt;vm().m_enabledProfiler = this;
</del><ins>+    exec-&gt;vm().setEnabledProfiler(this);
</ins><span class="cx">     RefPtr&lt;ProfileGenerator&gt; profileGenerator = ProfileGenerator::create(exec, title, ++ProfilesUID);
</span><span class="cx">     m_currentProfiles.append(profileGenerator);
</span><span class="cx"> }
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> 
</span><span class="cx">             m_currentProfiles.remove(i);
</span><span class="cx">             if (!m_currentProfiles.size())
</span><del>-                exec-&gt;vm().m_enabledProfiler = 0;
</del><ins>+                exec-&gt;vm().setEnabledProfiler(nullptr);
</ins><span class="cx">             
</span><span class="cx">             return returnProfile;
</span><span class="cx">         }
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">             profileGenerator-&gt;stopProfiling();
</span><span class="cx">             m_currentProfiles.remove(i);
</span><span class="cx">             if (!m_currentProfiles.size())
</span><del>-                origin-&gt;vm().m_enabledProfiler = 0;
</del><ins>+                origin-&gt;vm().setEnabledProfiler(nullptr);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -197,7 +197,6 @@
</span><span class="cx">     , jsFinalObjectClassInfo(JSFinalObject::info())
</span><span class="cx">     , sizeOfLastScratchBuffer(0)
</span><span class="cx">     , entryScope(0)
</span><del>-    , m_enabledProfiler(0)
</del><span class="cx">     , m_regExpCache(new RegExpCache(this))
</span><span class="cx"> #if ENABLE(REGEXP_TRACING)
</span><span class="cx">     , m_rtTraceList(new RTTraceList())
</span><span class="lines">@@ -222,6 +221,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     , m_inDefineOwnProperty(false)
</span><span class="cx">     , m_codeCache(CodeCache::create())
</span><ins>+    , m_enabledProfiler(nullptr)
</ins><span class="cx"> {
</span><span class="cx">     interpreter = new Interpreter(*this);
</span><span class="cx">     StackBounds stack = wtfThreadData().stack();
</span><span class="lines">@@ -780,4 +780,23 @@
</span><span class="cx">         watchpointSet-&gt;fireAll();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+class SetEnabledProfilerFunctor {
+public:
+    bool operator()(CodeBlock* codeBlock)
+    {
+        if (codeBlock-&gt;jitType() == JITCode::DFGJIT)
+            codeBlock-&gt;jettison();
+        return false;
+    }
+};
+
+void VM::setEnabledProfiler(LegacyProfiler* profiler)
+{
+    m_enabledProfiler = profiler;
+    if (m_enabledProfiler) {
+        SetEnabledProfilerFunctor functor;
+        heap.forEachCodeBlock(functor);
+    }
+}
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (162939 => 162940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2014-01-28 17:38:49 UTC (rev 162939)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2014-01-28 17:43:07 UTC (rev 162940)
</span><span class="lines">@@ -304,10 +304,9 @@
</span><span class="cx">             return m_inDefineOwnProperty;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        LegacyProfiler* enabledProfiler()
-        {
-            return m_enabledProfiler;
-        }
</del><ins>+        LegacyProfiler* enabledProfiler() { return m_enabledProfiler; }
+        void setEnabledProfiler(LegacyProfiler*);
+
</ins><span class="cx">         void* enabledProfilerAddress() { return &amp;m_enabledProfiler; }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT) &amp;&amp; ENABLE(LLINT)
</span><span class="lines">@@ -432,7 +431,6 @@
</span><span class="cx">         String cachedDateString;
</span><span class="cx">         double cachedDateStringValue;
</span><span class="cx"> 
</span><del>-        LegacyProfiler* m_enabledProfiler;
</del><span class="cx">         OwnPtr&lt;Profiler::Database&gt; m_perBytecodeProfiler;
</span><span class="cx">         RefPtr&lt;TypedArrayController&gt; m_typedArrayController;
</span><span class="cx">         RegExpCache* m_regExpCache;
</span><span class="lines">@@ -524,6 +522,8 @@
</span><span class="cx">         OwnPtr&lt;CodeCache&gt; m_codeCache;
</span><span class="cx">         RefCountedArray&lt;StackFrame&gt; m_exceptionStack;
</span><span class="cx"> 
</span><ins>+        LegacyProfiler* m_enabledProfiler;
+
</ins><span class="cx">         HashMap&lt;String, RefPtr&lt;WatchpointSet&gt;&gt; m_impurePropertyWatchpointSets;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>