Title: [198600] trunk
Revision
198600
Author
[email protected]
Date
2016-03-23 15:33:17 -0700 (Wed, 23 Mar 2016)

Log Message

Unreviewed, rolling out r198582.
https://bugs.webkit.org/show_bug.cgi?id=155812

"It broke debugging in the web inspector" (Requested by
saamyjoon on #webkit).

Reverted changeset:

"We should not disable inlining when the debugger is enabled"
https://bugs.webkit.org/show_bug.cgi?id=155741
http://trac.webkit.org/changeset/198582

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198599 => 198600)


--- trunk/LayoutTests/ChangeLog	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/LayoutTests/ChangeLog	2016-03-23 22:33:17 UTC (rev 198600)
@@ -1,3 +1,17 @@
+2016-03-23  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r198582.
+        https://bugs.webkit.org/show_bug.cgi?id=155812
+
+        "It broke debugging in the web inspector" (Requested by
+        saamyjoon on #webkit).
+
+        Reverted changeset:
+
+        "We should not disable inlining when the debugger is enabled"
+        https://bugs.webkit.org/show_bug.cgi?id=155741
+        http://trac.webkit.org/changeset/198582
+
 2016-03-23  Zalan Bujtas  <[email protected]>
 
         ASSERTION FAILED: y2 >= y1 in WebCore::RenderElement::drawLineForBoxSide

Deleted: trunk/LayoutTests/inspector/debugger/breakpoint-with-inlining-expected.txt (198599 => 198600)


--- trunk/LayoutTests/inspector/debugger/breakpoint-with-inlining-expected.txt	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-with-inlining-expected.txt	2016-03-23 22:33:17 UTC (rev 198600)
@@ -1,7 +0,0 @@
-Debugger.setBreakpoint on line:column in <script>
-
-Found <script>
-Running testInlining() without a breakpoint to get it DFG or FTL compiled with foo() inlined.
-Running testInlining() again with a breakpoint set at foo().
-We paused all 10 times as expected!
-

Deleted: trunk/LayoutTests/inspector/debugger/breakpoint-with-inlining.html (198599 => 198600)


--- trunk/LayoutTests/inspector/debugger/breakpoint-with-inlining.html	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-with-inlining.html	2016-03-23 22:33:17 UTC (rev 198600)
@@ -1,62 +0,0 @@
-<html>
-<head>
-<script src=""
-<script>
-// Put this here instead of on <body onload> to prevent an extra Debugger.scriptParsed event.
-window._onload_ = runTest;
-
-function test()
-{
-    // This test sets a breakpoint on line:column in the <script> below.
-    // We first warm the function up to get foo inlined. Then we set a breakpoint
-    // and make sure that we hit it.
-
-    InspectorProtocol.sendCommand("Debugger.enable", {});
-
-    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
-    {
-        if (/breakpoint-with-inlining\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
-            ProtocolTest.log("Found <script>");
-            var scriptIdentifier = messageObject.params.scriptId;
-            var lineNumber = messageObject.params.startLine + 2;
-            var columnNumber = 4;
-            var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
-
-            ProtocolTest.log("Running testInlining() without a breakpoint to get it DFG or FTL compiled with foo() inlined.");
-
-            InspectorProtocol.sendCommand("Runtime.evaluate", {_expression_: "testInlining(100000)"}, function() {
-                InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                    ProtocolTest.log("Running testInlining() again with a breakpoint set at foo().");
-                    InspectorProtocol.sendCommand("Runtime.evaluate", {_expression_: "testInlining(10)"});
-                });
-            });
-        }
-    }
-
-    let iters = 0;
-    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
-    {
-        InspectorProtocol.sendCommand("Debugger.resume", {});
-
-        iters++;
-        if (iters === 10) {
-            ProtocolTest.log("We paused all 10 times as expected!");
-            ProtocolTest.completeTest();
-        }
-    }
-}
-</script>
-</head>
-<body>
-<p>Debugger.setBreakpoint on line:column in &lt;script&gt;</p>
-<script>          // Line 0
-function foo(i) { // Line 1;
-    return i*2;   // Line 2;
-}
-function testInlining(iters) {
-    for (let i = 0; i < iters; i++)
-        foo(i);
-}
-</script>
-</body>
-</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (198599 => 198600)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-23 22:33:17 UTC (rev 198600)
@@ -1,3 +1,17 @@
+2016-03-23  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r198582.
+        https://bugs.webkit.org/show_bug.cgi?id=155812
+
+        "It broke debugging in the web inspector" (Requested by
+        saamyjoon on #webkit).
+
+        Reverted changeset:
+
+        "We should not disable inlining when the debugger is enabled"
+        https://bugs.webkit.org/show_bug.cgi?id=155741
+        http://trac.webkit.org/changeset/198582
+
 2016-03-23  Michael Saboff  <[email protected]>
 
         _javascript_Core ArrayPrototype::join shouldn't cache butterfly when it makes effectful calls

Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (198599 => 198600)


--- trunk/Source/_javascript_Core/debugger/Debugger.cpp	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp	2016-03-23 22:33:17 UTC (rev 198600)
@@ -23,11 +23,9 @@
 #include "Debugger.h"
 
 #include "CodeBlock.h"
-#include "DFGCommonData.h"
 #include "DebuggerCallFrame.h"
 #include "Error.h"
 #include "HeapIterationScope.h"
-#include "InlineCallFrame.h"
 #include "Interpreter.h"
 #include "JSCJSValueInlines.h"
 #include "JSFunction.h"
@@ -250,64 +248,40 @@
 
 void Debugger::toggleBreakpoint(CodeBlock* codeBlock, Breakpoint& breakpoint, BreakpointState enabledOrNot)
 {
-    auto isBreakpointInCodeBlock = [&] (CodeBlock* codeBlock) -> bool {
-        ScriptExecutable* executable = codeBlock->ownerScriptExecutable();
+    ScriptExecutable* executable = codeBlock->ownerScriptExecutable();
 
-        SourceID sourceID = static_cast<SourceID>(executable->sourceID());
-        if (breakpoint.sourceID != sourceID)
-            return false;
+    SourceID sourceID = static_cast<SourceID>(executable->sourceID());
+    if (breakpoint.sourceID != sourceID)
+        return;
 
-        unsigned line = breakpoint.line;
-        unsigned column = breakpoint.column;
-        
-        unsigned startLine = executable->firstLine();
-        unsigned startColumn = executable->startColumn();
-        unsigned endLine = executable->lastLine();
-        unsigned endColumn = executable->endColumn();
-        line += 1;
-        column = column ? column + 1 : Breakpoint::unspecifiedColumn;
+    unsigned line = breakpoint.line;
+    unsigned column = breakpoint.column;
 
-        if (line < startLine || line > endLine)
-            return false;
-        if (column != Breakpoint::unspecifiedColumn) {
-            if (line == startLine && column < startColumn)
-                return false;
-            if (line == endLine && column > endColumn)
-                return false;
-        }
+    unsigned startLine = executable->firstLine();
+    unsigned startColumn = executable->startColumn();
+    unsigned endLine = executable->lastLine();
+    unsigned endColumn = executable->endColumn();
 
-        if (!codeBlock->hasOpDebugForLineAndColumn(line, column))
-            return false;
+    // Inspector breakpoint line and column values are zero-based but the executable
+    // and CodeBlock line and column values are one-based.
+    line += 1;
+    column = column ? column + 1 : Breakpoint::unspecifiedColumn;
 
-        return true;
-    };
-
-    if (isBreakpointInCodeBlock(codeBlock)) {
-        if (enabledOrNot == BreakpointEnabled)
-            codeBlock->addBreakpoint(1);
-        else
-            codeBlock->removeBreakpoint(1);
-
+    if (line < startLine || line > endLine)
         return;
-    } 
-
-#if ENABLE(DFG_JIT)
-    if (enabledOrNot == BreakpointEnabled) {
-        // See if any of our inlinees contain the breakpoint. We only care about this
-        // when we set a breakpoint.
-        if (!JITCode::isOptimizingJIT(codeBlock->jitType()))
+    if (column != Breakpoint::unspecifiedColumn) {
+        if (line == startLine && column < startColumn)
             return;
-        InlineCallFrameSet* inlineCallFrameSet = codeBlock->jitCode()->dfgCommon()->inlineCallFrames.get();
-        if (!inlineCallFrameSet)
+        if (line == endLine && column > endColumn)
             return;
-        for (InlineCallFrame* inlineCallFrame : *inlineCallFrameSet) {
-            if (isBreakpointInCodeBlock(inlineCallFrame->baselineCodeBlock.get())) {
-                codeBlock->jettison(Profiler::JettisonDueToDebuggerBreakpoint);
-                break;
-            }
-        }
     }
-#endif // ENABLE(DFG_JIT)
+    if (!codeBlock->hasOpDebugForLineAndColumn(line, column))
+        return;
+
+    if (enabledOrNot == BreakpointEnabled)
+        codeBlock->addBreakpoint(1);
+    else
+        codeBlock->removeBreakpoint(1);
 }
 
 void Debugger::applyBreakpoints(CodeBlock* codeBlock)

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (198599 => 198600)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2016-03-23 22:33:17 UTC (rev 198600)
@@ -150,6 +150,7 @@
         , m_numPassedVarArgs(0)
         , m_inlineStackTop(0)
         , m_currentInstruction(0)
+        , m_hasDebuggerEnabled(graph.hasDebuggerEnabled())
     {
         ASSERT(m_profiledBlock);
     }
@@ -446,6 +447,8 @@
             ArgumentPosition* argumentPosition = findArgumentPositionForLocal(operand);
             if (argumentPosition)
                 flushDirect(operand, argumentPosition);
+            else if (m_hasDebuggerEnabled && operand == m_codeBlock->scopeRegister())
+                flush(operand);
         }
 
         VariableAccessData* variableAccessData = newVariableAccessData(operand);
@@ -583,6 +586,7 @@
     {
         int numArguments;
         if (InlineCallFrame* inlineCallFrame = inlineStackEntry->m_inlineCallFrame) {
+            ASSERT(!m_hasDebuggerEnabled);
             numArguments = inlineCallFrame->arguments.size();
             if (inlineCallFrame->isClosureCall)
                 flushDirect(inlineStackEntry->remapOperand(VirtualRegister(JSStack::Callee)));
@@ -592,6 +596,8 @@
             numArguments = inlineStackEntry->m_codeBlock->numParameters();
         for (unsigned argument = numArguments; argument-- > 1;)
             flushDirect(inlineStackEntry->remapOperand(virtualRegisterForArgument(argument)));
+        if (m_hasDebuggerEnabled)
+            flush(m_codeBlock->scopeRegister());
     }
 
     void flushForTerminal()
@@ -1115,6 +1121,7 @@
     StubInfoMap m_dfgStubInfos;
     
     Instruction* m_currentInstruction;
+    bool m_hasDebuggerEnabled;
 };
 
 #define NEXT_OPCODE(name) \
@@ -1287,6 +1294,12 @@
     if (verbose)
         dataLog("Considering inlining ", callee, " into ", currentCodeOrigin(), "\n");
     
+    if (m_hasDebuggerEnabled) {
+        if (verbose)
+            dataLog("    Failing because the debugger is in use.\n");
+        return UINT_MAX;
+    }
+
     FunctionExecutable* executable = callee.functionExecutable();
     if (!executable) {
         if (verbose)

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (198599 => 198600)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2016-03-23 22:33:17 UTC (rev 198600)
@@ -77,6 +77,9 @@
     , m_refCountState(EverythingIsLive)
 {
     ASSERT(m_profiledBlock);
+    
+    m_hasDebuggerEnabled = m_profiledBlock->globalObject()->hasDebugger()
+        || Options::forceDebuggerBytecodeGeneration();
 }
 
 Graph::~Graph()

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (198599 => 198600)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.h	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h	2016-03-23 22:33:17 UTC (rev 198600)
@@ -797,6 +797,8 @@
         BasicBlock*, const char* file, int line, const char* function,
         const char* assertion);
 
+    bool hasDebuggerEnabled() const { return m_hasDebuggerEnabled; }
+
     void ensureDominators();
     void ensurePrePostNumbering();
     void ensureNaturalLoops();
@@ -894,6 +896,7 @@
     UnificationState m_unificationState;
     PlanStage m_planStage { PlanStage::Initial };
     RefCountState m_refCountState;
+    bool m_hasDebuggerEnabled;
     bool m_hasExceptionHandlers { false };
 private:
 

Modified: trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp (198599 => 198600)


--- trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp	2016-03-23 22:33:17 UTC (rev 198600)
@@ -173,7 +173,10 @@
             data->machineLocal = assign(allocation, data->local);
         }
         
-        codeBlock()->setScopeRegister(VirtualRegister());
+        if (LIKELY(!m_graph.hasDebuggerEnabled()))
+            codeBlock()->setScopeRegister(VirtualRegister());
+        else
+            codeBlock()->setScopeRegister(assign(allocation, codeBlock()->scopeRegister()));
 
         for (unsigned i = m_graph.m_inlineVariableData.size(); i--;) {
             InlineVariableData data = ""

Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (198599 => 198600)


--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2016-03-23 22:27:42 UTC (rev 198599)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2016-03-23 22:33:17 UTC (rev 198600)
@@ -102,6 +102,9 @@
             inlineCallFrame->calleeRecovery =
                 inlineCallFrame->calleeRecovery.withLocalsOffset(localsOffset);
         }
+
+        if (graph.hasDebuggerEnabled())
+            codeBlock->setScopeRegister(codeBlock->scopeRegister() + localsOffset);
     }
     for (OSRExitDescriptor& descriptor : state.jitCode->osrExitDescriptors) {
         for (unsigned i = descriptor.m_values.size(); i--;)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to