Title: [188810] trunk/Source
Revision
188810
Author
[email protected]
Date
2015-08-21 17:53:55 -0700 (Fri, 21 Aug 2015)

Log Message

Unreviewed, rolling out r188792 and r188803.
https://bugs.webkit.org/show_bug.cgi?id=148347

broke lots of tests, ggaren is going to investigate and reland
(Requested by thorton on #webkit).

Reverted changesets:

"Unify code paths for manually deleting all code"
https://bugs.webkit.org/show_bug.cgi?id=148280
http://trac.webkit.org/changeset/188792

"Debugger's VM should never be null"
https://bugs.webkit.org/show_bug.cgi?id=148341
http://trac.webkit.org/changeset/188803

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (188809 => 188810)


--- trunk/Source/_javascript_Core/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-08-22 00:53:55 UTC (rev 188810)
@@ -1,3 +1,21 @@
+2015-08-21  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r188792 and r188803.
+        https://bugs.webkit.org/show_bug.cgi?id=148347
+
+        broke lots of tests, ggaren is going to investigate and reland
+        (Requested by thorton on #webkit).
+
+        Reverted changesets:
+
+        "Unify code paths for manually deleting all code"
+        https://bugs.webkit.org/show_bug.cgi?id=148280
+        http://trac.webkit.org/changeset/188792
+
+        "Debugger's VM should never be null"
+        https://bugs.webkit.org/show_bug.cgi?id=148341
+        http://trac.webkit.org/changeset/188803
+
 2015-08-21  Sukolsak Sakshuwong  <[email protected]>
 
         Parse control flow statements in WebAssembly

Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (188809 => 188810)


--- trunk/Source/_javascript_Core/debugger/Debugger.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -35,6 +35,72 @@
 #include "Protect.h"
 #include "VMEntryScope.h"
 
+namespace {
+
+using namespace JSC;
+
+class Recompiler : public MarkedBlock::VoidFunctor {
+public:
+    Recompiler(JSC::Debugger*);
+    ~Recompiler();
+    IterationStatus operator()(JSCell*);
+
+private:
+    typedef HashSet<FunctionExecutable*> FunctionExecutableSet;
+    typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;
+    
+    void visit(JSCell*);
+    
+    JSC::Debugger* m_debugger;
+    FunctionExecutableSet m_functionExecutables;
+    SourceProviderMap m_sourceProviders;
+};
+
+inline Recompiler::Recompiler(JSC::Debugger* debugger)
+    : m_debugger(debugger)
+{
+}
+
+inline Recompiler::~Recompiler()
+{
+    // Call sourceParsed() after reparsing all functions because it will execute
+    // _javascript_ in the inspector.
+    SourceProviderMap::const_iterator end = m_sourceProviders.end();
+    for (SourceProviderMap::const_iterator iter = m_sourceProviders.begin(); iter != end; ++iter)
+        m_debugger->sourceParsed(iter->value, iter->key, -1, String());
+}
+
+inline void Recompiler::visit(JSCell* cell)
+{
+    if (!cell->inherits(JSFunction::info()))
+        return;
+
+    JSFunction* function = jsCast<JSFunction*>(cell);
+    if (function->executable()->isHostFunction())
+        return;
+
+    FunctionExecutable* executable = function->jsExecutable();
+
+    // Check if the function is already in the set - if so,
+    // we've already retranslated it, nothing to do here.
+    if (!m_functionExecutables.add(executable).isNewEntry)
+        return;
+
+    ExecState* exec = function->scope()->globalObject()->JSGlobalObject::globalExec();
+    executable->clearCode();
+    executable->clearUnlinkedCodeForRecompilation();
+    if (m_debugger == function->scope()->globalObject()->debugger())
+        m_sourceProviders.add(executable->source().provider(), exec);
+}
+
+inline IterationStatus Recompiler::operator()(JSCell* cell)
+{
+    visit(cell);
+    return IterationStatus::Continue;
+}
+
+} // namespace
+
 namespace JSC {
 
 class DebuggerPausedScope {
@@ -79,8 +145,8 @@
     Debugger& m_debugger;
 };
 
-Debugger::Debugger(VM& vm, bool isInWorkerThread)
-    : m_vm(vm)
+Debugger::Debugger(bool isInWorkerThread)
+    : m_vm(nullptr)
     , m_pauseOnExceptionsState(DontPauseOnExceptions)
     , m_pauseOnNextStatement(false)
     , m_isPaused(false)
@@ -108,17 +174,12 @@
 void Debugger::attach(JSGlobalObject* globalObject)
 {
     ASSERT(!globalObject->debugger());
+    if (!m_vm)
+        m_vm = &globalObject->vm();
+    else
+        ASSERT(m_vm == &globalObject->vm());
     globalObject->setDebugger(this);
     m_globalObjects.add(globalObject);
-
-    // Call sourceParsed() because it will execute _javascript_ in the inspector.
-    for (size_t i = 0; i < m_vm.heap.compiledCode().size(); ++i) {
-        ExecutableBase* base = m_vm.heap.compiledCode()[i];
-        if (!base->isFunctionExecutable())
-            continue;
-        FunctionExecutable* executable = static_cast<FunctionExecutable*>(base);
-        sourceParsed(globalObject->globalExec(), executable->source().provider(), -1, String());
-    }
 }
 
 void Debugger::detach(JSGlobalObject* globalObject, ReasonForDetach reason)
@@ -142,6 +203,8 @@
         clearDebuggerRequests(globalObject);
 
     globalObject->setDebugger(0);
+    if (!m_globalObjects.size())
+        m_vm = nullptr;
 }
 
 bool Debugger::isAttached(JSGlobalObject* globalObject)
@@ -175,12 +238,12 @@
 
 void Debugger::setSteppingMode(SteppingMode mode)
 {
-    if (mode == m_steppingMode)
+    if (mode == m_steppingMode || !m_vm)
         return;
 
     m_steppingMode = mode;
     SetSteppingModeFunctor functor(this, mode);
-    m_vm.heap.forEachCodeBlock(functor);
+    m_vm->heap.forEachCodeBlock(functor);
 }
 
 void Debugger::registerCodeBlock(CodeBlock* codeBlock)
@@ -265,13 +328,34 @@
 
 void Debugger::toggleBreakpoint(Breakpoint& breakpoint, Debugger::BreakpointState enabledOrNot)
 {
+    if (!m_vm)
+        return;
     ToggleBreakpointFunctor functor(this, breakpoint, enabledOrNot);
-    m_vm.heap.forEachCodeBlock(functor);
+    m_vm->heap.forEachCodeBlock(functor);
 }
 
-void Debugger::recompileAllJSFunctions()
+void Debugger::recompileAllJSFunctions(VM* vm)
 {
-    m_vm.deleteAllCode();
+    // If _javascript_ is running, it's not safe to recompile, since we'll end
+    // up throwing away code that is live on the stack.
+    if (vm->entryScope) {
+        auto listener = [] (VM& vm, JSGlobalObject* globalObject) 
+        {
+            if (Debugger* debugger = globalObject->debugger())
+                debugger->recompileAllJSFunctions(&vm);
+        };
+
+        vm->entryScope->setEntryScopeDidPopListener(this, listener);
+        return;
+    }
+
+#if ENABLE(DFG_JIT)
+    DFG::completeAllPlansForVM(*vm);
+#endif
+
+    Recompiler recompiler(this);
+    HeapIterationScope iterationScope(vm->heap);
+    vm->heap.objectSpace().forEachLiveCell(iterationScope, recompiler);
 }
 
 BreakpointID Debugger::setBreakpoint(Breakpoint breakpoint, unsigned& actualLine, unsigned& actualColumn)
@@ -436,8 +520,10 @@
     m_breakpointIDToBreakpoint.clear();
     m_sourceIDToBreakpoints.clear();
 
+    if (!m_vm)
+        return;
     ClearCodeBlockDebuggerRequestsFunctor functor(this);
-    m_vm.heap.forEachCodeBlock(functor);
+    m_vm->heap.forEachCodeBlock(functor);
 }
 
 class Debugger::ClearDebuggerRequestsFunctor {
@@ -460,8 +546,9 @@
 
 void Debugger::clearDebuggerRequests(JSGlobalObject* globalObject)
 {
+    ASSERT(m_vm);
     ClearDebuggerRequestsFunctor functor(globalObject);
-    m_vm.heap.forEachCodeBlock(functor);
+    m_vm->heap.forEachCodeBlock(functor);
 }
 
 void Debugger::setBreakpointsActivated(bool activated)
@@ -488,7 +575,7 @@
 
     m_pauseOnNextStatement = true;
     setSteppingMode(SteppingModeEnabled);
-    m_currentCallFrame = m_vm.topCallFrame;
+    m_currentCallFrame = m_vm->topCallFrame;
     ASSERT(m_currentCallFrame);
     pauseIfNeeded(m_currentCallFrame);
 }
@@ -526,7 +613,7 @@
     if (!m_isPaused)
         return;
 
-    VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
+    VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
     m_pauseOnCallFrame = m_currentCallFrame ? m_currentCallFrame->callerFrame(topVMEntryFrame) : 0;
     notifyDoneProcessingDebuggerEvents();
 }
@@ -650,11 +737,11 @@
 
     // Treat stepping over a return statement like stepping out.
     if (m_currentCallFrame == m_pauseOnCallFrame) {
-        VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
+        VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
         m_pauseOnCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
     }
 
-    VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
+    VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
     m_currentCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
 }
 
@@ -685,12 +772,12 @@
     if (!m_currentCallFrame)
         return;
     if (m_currentCallFrame == m_pauseOnCallFrame) {
-        VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
+        VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
         m_pauseOnCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
         if (!m_currentCallFrame)
             return;
     }
-    VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
+    VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
     m_currentCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
 }
 

Modified: trunk/Source/_javascript_Core/debugger/Debugger.h (188809 => 188810)


--- trunk/Source/_javascript_Core/debugger/Debugger.h	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/debugger/Debugger.h	2015-08-22 00:53:55 UTC (rev 188810)
@@ -44,11 +44,9 @@
 
 class JS_EXPORT_PRIVATE Debugger {
 public:
-    Debugger(VM&, bool isInWorkerThread = false);
+    Debugger(bool isInWorkerThread = false);
     virtual ~Debugger();
 
-    VM& vm() { return m_vm; }
-
     JSC::DebuggerCallFrame* currentDebuggerCallFrame() const;
     bool hasHandlerForExceptionCallback() const
     {
@@ -120,7 +118,7 @@
     void didExecuteProgram(CallFrame*);
     void didReachBreakpoint(CallFrame*);
 
-    virtual void recompileAllJSFunctions();
+    void recompileAllJSFunctions(VM*);
 
     void registerCodeBlock(CodeBlock*);
 
@@ -187,7 +185,7 @@
 
     void clearDebuggerRequests(JSGlobalObject*);
 
-    VM& m_vm;
+    VM* m_vm;
     HashSet<JSGlobalObject*> m_globalObjects;
 
     PauseOnExceptionsState m_pauseOnExceptionsState;

Modified: trunk/Source/_javascript_Core/heap/Heap.h (188809 => 188810)


--- trunk/Source/_javascript_Core/heap/Heap.h	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2015-08-22 00:53:55 UTC (rev 188810)
@@ -237,8 +237,6 @@
 
     void addLogicallyEmptyWeakBlock(WeakBlock*);
 
-    Vector<ExecutableBase*>& compiledCode() { return m_compiledCode; }
-
 private:
     friend class CodeBlock;
     friend class CopiedBlock;

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.cpp (188809 => 188810)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -35,7 +35,7 @@
 namespace Inspector {
 
 JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer(JSGlobalObject& globalObject)
-    : ScriptDebugServer(globalObject.vm(), false)
+    : ScriptDebugServer(false)
     , m_globalObject(globalObject)
 {
 }
@@ -70,6 +70,11 @@
     }
 }
 
+void JSGlobalObjectScriptDebugServer::recompileAllJSFunctions()
+{
+    JSC::Debugger::recompileAllJSFunctions(&m_globalObject.vm());
+}
+
 void JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused()
 {
     // Drop all locks so another thread can work in the VM while we are nested.

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.h (188809 => 188810)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.h	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.h	2015-08-22 00:53:55 UTC (rev 188810)
@@ -42,6 +42,8 @@
 
     JSC::JSGlobalObject& globalObject() const { return m_globalObject; }
 
+    virtual void recompileAllJSFunctions() override;
+
 private:
     virtual ListenerSet& getListeners() override { return m_listeners; }
     virtual void didPause(JSC::JSGlobalObject*) override { }

Modified: trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp (188809 => 188810)


--- trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -47,8 +47,8 @@
 
 namespace Inspector {
 
-ScriptDebugServer::ScriptDebugServer(VM& vm, bool isInWorkerThread)
-    : Debugger(vm, isInWorkerThread)
+ScriptDebugServer::ScriptDebugServer(bool isInWorkerThread)
+    : Debugger(isInWorkerThread)
 {
 }
 

Modified: trunk/Source/_javascript_Core/inspector/ScriptDebugServer.h (188809 => 188810)


--- trunk/Source/_javascript_Core/inspector/ScriptDebugServer.h	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/inspector/ScriptDebugServer.h	2015-08-22 00:53:55 UTC (rev 188810)
@@ -44,7 +44,6 @@
 namespace JSC {
 class ExecState;
 class JSGlobalObject;
-class VM;
 }
 
 namespace Inspector {
@@ -57,6 +56,8 @@
     void removeBreakpoint(JSC::BreakpointID);
     void clearBreakpoints();
 
+    virtual void recompileAllJSFunctions() = 0;
+
     const BreakpointActions& getActionsForBreakpoint(JSC::BreakpointID);
 
     class Task {
@@ -70,7 +71,7 @@
     typedef HashSet<ScriptDebugListener*> ListenerSet;
     typedef void (ScriptDebugServer::*_javascript_ExecutionCallback)(ScriptDebugListener*);
 
-    ScriptDebugServer(JSC::VM&, bool isInWorkerThread = false);
+    ScriptDebugServer(bool isInWorkerThread = false);
     ~ScriptDebugServer();
 
     virtual ListenerSet& getListeners() = 0;

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp (188809 => 188810)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -308,6 +308,40 @@
         dataLogF("Inspector::getRuntimeTypesForVariablesAtOffsets took %lfms\n", end - start);
 }
 
+class TypeRecompiler : public MarkedBlock::VoidFunctor {
+public:
+    inline void visit(JSCell* cell)
+    {
+        if (!cell->inherits(FunctionExecutable::info()))
+            return;
+
+        FunctionExecutable* executable = jsCast<FunctionExecutable*>(cell);
+        executable->clearCode();
+        executable->clearUnlinkedCodeForRecompilation();
+    }
+    inline IterationStatus operator()(JSCell* cell)
+    {
+        visit(cell);
+        return IterationStatus::Continue;
+    }
+};
+
+static void recompileAllJSFunctionsForTypeProfiling(VM& vm, bool shouldEnableTypeProfiling)
+{
+    bool shouldRecompileFromTypeProfiler = (shouldEnableTypeProfiling ? vm.enableTypeProfiler() : vm.disableTypeProfiler());
+    bool shouldRecompileFromControlFlowProfiler = (shouldEnableTypeProfiling ? vm.enableControlFlowProfiler() : vm.disableControlFlowProfiler());
+    bool needsToRecompile = shouldRecompileFromTypeProfiler || shouldRecompileFromControlFlowProfiler;
+
+    if (needsToRecompile) {
+#if ENABLE(DFG_JIT)
+        DFG::completeAllPlansForVM(vm);
+#endif
+        TypeRecompiler recompiler;
+        HeapIterationScope iterationScope(vm.heap);
+        vm.heap.objectSpace().forEachLiveCell(iterationScope, recompiler);
+    }
+}
+
 void InspectorRuntimeAgent::willDestroyFrontendAndBackend(DisconnectReason reason)
 {
     if (reason != DisconnectReason::InspectedTargetDestroyed && m_isTypeProfilingEnabled)
@@ -324,21 +358,25 @@
     setTypeProfilerEnabledState(false);
 }
 
-void InspectorRuntimeAgent::setTypeProfilerEnabledState(bool isTypeProfilingEnabled)
+void InspectorRuntimeAgent::setTypeProfilerEnabledState(bool shouldEnableTypeProfiling)
 {
-    if (m_isTypeProfilingEnabled == isTypeProfilingEnabled)
+    if (m_isTypeProfilingEnabled == shouldEnableTypeProfiling)
         return;
-    m_isTypeProfilingEnabled = isTypeProfilingEnabled;
 
+    m_isTypeProfilingEnabled = shouldEnableTypeProfiling;
+
     VM& vm = globalVM();
-    vm.whenIdle([&vm, isTypeProfilingEnabled] () {
-        bool shouldRecompileFromTypeProfiler = (isTypeProfilingEnabled ? vm.enableTypeProfiler() : vm.disableTypeProfiler());
-        bool shouldRecompileFromControlFlowProfiler = (isTypeProfilingEnabled ? vm.enableControlFlowProfiler() : vm.disableControlFlowProfiler());
-        bool needsToRecompile = shouldRecompileFromTypeProfiler || shouldRecompileFromControlFlowProfiler;
 
-        if (needsToRecompile)
-            vm.deleteAllCode();
-    });
+    // If _javascript_ is running, it's not safe to recompile, since we'll end
+    // up throwing away code that is live on the stack.
+    if (vm.entryScope) {
+        vm.entryScope->setEntryScopeDidPopListener(this,
+            [=] (VM& vm, JSGlobalObject*) {
+                recompileAllJSFunctionsForTypeProfiling(vm, shouldEnableTypeProfiling);
+            }
+        );
+    } else
+        recompileAllJSFunctionsForTypeProfiling(vm, shouldEnableTypeProfiling);
 }
 
 void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks)

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (188809 => 188810)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -86,7 +86,6 @@
 #include "TypeProfiler.h"
 #include "TypeProfilerLog.h"
 #include "UnlinkedCodeBlock.h"
-#include "VMEntryScope.h"
 #include "Watchdog.h"
 #include "WeakGCMapInlines.h"
 #include "WeakMapData.h"
@@ -472,28 +471,16 @@
     interpreter->stopSampling();
 }
 
-void VM::whenIdle(std::function<void()> callback)
-{
-    if (!entryScope) {
-        callback();
-        return;
-    }
-
-    entryScope->addDidPopListener(callback);
-}
-
 void VM::deleteAllCode()
 {
-    whenIdle([this]() {
-        m_codeCache->clear();
-        m_regExpCache->deleteAllCode();
+    m_codeCache->clear();
+    m_regExpCache->deleteAllCode();
 #if ENABLE(DFG_JIT)
-        DFG::completeAllPlansForVM(*this);
+    DFG::completeAllPlansForVM(*this);
 #endif
-        heap.deleteAllCompiledCode();
-        heap.deleteAllUnlinkedFunctionCode();
-        heap.reportAbandonedObjectGraph();
-    });
+    heap.deleteAllCompiledCode();
+    heap.deleteAllUnlinkedFunctionCode();
+    heap.reportAbandonedObjectGraph();
 }
 
 void VM::dumpSampleData(ExecState* exec)

Modified: trunk/Source/_javascript_Core/runtime/VM.h (188809 => 188810)


--- trunk/Source/_javascript_Core/runtime/VM.h	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2015-08-22 00:53:55 UTC (rev 188810)
@@ -541,8 +541,6 @@
     JSLock& apiLock() { return *m_apiLock; }
     CodeCache* codeCache() { return m_codeCache.get(); }
 
-    void whenIdle(std::function<void()>);
-
     JS_EXPORT_PRIVATE void deleteAllCode();
 
     void registerWatchpointForImpureProperty(const Identifier&, Watchpoint*);

Modified: trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp (188809 => 188810)


--- trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -57,9 +57,9 @@
     vm.clearLastException();
 }
 
-void VMEntryScope::addDidPopListener(std::function<void ()> listener)
+void VMEntryScope::setEntryScopeDidPopListener(void* key, EntryScopeDidPopListener listener)
 {
-    m_didPopListeners.append(listener);
+    m_allEntryScopeDidPopListeners.set(key, listener);
 }
 
 VMEntryScope::~VMEntryScope()
@@ -72,8 +72,8 @@
 
     m_vm.entryScope = nullptr;
 
-    for (auto& listener : m_didPopListeners)
-        listener();
+    for (auto& listener : m_allEntryScopeDidPopListeners.values())
+        listener(m_vm, m_globalObject);
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/VMEntryScope.h (188809 => 188810)


--- trunk/Source/_javascript_Core/runtime/VMEntryScope.h	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/_javascript_Core/runtime/VMEntryScope.h	2015-08-22 00:53:55 UTC (rev 188810)
@@ -27,9 +27,9 @@
 #define VMEntryScope_h
 
 #include "Interpreter.h"
+#include <wtf/HashMap.h>
 #include <wtf/StackBounds.h>
 #include <wtf/StackStats.h>
-#include <wtf/Vector.h>
 
 namespace JSC {
 
@@ -43,12 +43,13 @@
 
     JSGlobalObject* globalObject() const { return m_globalObject; }
 
-    void addDidPopListener(std::function<void ()>);
+    typedef std::function<void (VM&, JSGlobalObject*)> EntryScopeDidPopListener;
+    void setEntryScopeDidPopListener(void*, EntryScopeDidPopListener);
 
 private:
     VM& m_vm;
     JSGlobalObject* m_globalObject;
-    Vector<std::function<void ()>> m_didPopListeners;
+    HashMap<void*, EntryScopeDidPopListener> m_allEntryScopeDidPopListeners;
 };
 
 } // namespace JSC

Modified: trunk/Source/WebCore/ChangeLog (188809 => 188810)


--- trunk/Source/WebCore/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/WebCore/ChangeLog	2015-08-22 00:53:55 UTC (rev 188810)
@@ -1,3 +1,21 @@
+2015-08-21  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r188792 and r188803.
+        https://bugs.webkit.org/show_bug.cgi?id=148347
+
+        broke lots of tests, ggaren is going to investigate and reland
+        (Requested by thorton on #webkit).
+
+        Reverted changesets:
+
+        "Unify code paths for manually deleting all code"
+        https://bugs.webkit.org/show_bug.cgi?id=148280
+        http://trac.webkit.org/changeset/188792
+
+        "Debugger's VM should never be null"
+        https://bugs.webkit.org/show_bug.cgi?id=148341
+        http://trac.webkit.org/changeset/188803
+
 2015-08-21  Chris Dumez  <[email protected]>
 
         document.getElementsByTagName should return an HTMLCollection

Modified: trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp (188809 => 188810)


--- trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -45,7 +45,7 @@
 namespace WebCore {
 
 WorkerScriptDebugServer::WorkerScriptDebugServer(WorkerGlobalScope* context, const String& mode)
-    : ScriptDebugServer(context->script()->vm(), true)
+    : ScriptDebugServer(true)
     , m_workerGlobalScope(context)
     , m_debuggerTaskMode(mode)
 {
@@ -82,8 +82,10 @@
 
 void WorkerScriptDebugServer::recompileAllJSFunctions()
 {
-    JSC::JSLockHolder lock(vm());
-    JSC::Debugger::recompileAllJSFunctions();
+    JSC::VM& vm = m_workerGlobalScope->script()->vm();
+
+    JSC::JSLockHolder lock(vm);
+    JSC::Debugger::recompileAllJSFunctions(&vm);
 }
 
 void WorkerScriptDebugServer::runEventLoopWhilePaused()

Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (188809 => 188810)


--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp	2015-08-22 00:53:55 UTC (rev 188810)
@@ -52,7 +52,7 @@
 namespace WebCore {
 
 PageScriptDebugServer::PageScriptDebugServer(Page& page)
-    : ScriptDebugServer(WebCore::JSDOMWindowBase::commonVM(), false)
+    : ScriptDebugServer(false)
     , m_page(page)
 {
 }
@@ -87,8 +87,8 @@
 
 void PageScriptDebugServer::recompileAllJSFunctions()
 {
-    JSLockHolder lock(vm());
-    Debugger::recompileAllJSFunctions();
+    JSLockHolder lock(JSDOMWindow::commonVM());
+    Debugger::recompileAllJSFunctions(&JSDOMWindow::commonVM());
 }
 
 void PageScriptDebugServer::didPause(JSGlobalObject*)
@@ -109,7 +109,7 @@
     // we need to gracefully handle releasing and reacquiring the lock.
     if (WebThreadIsEnabled()) {
         ASSERT(WebThreadIsLockedOrDisabled());
-        JSC::JSLock::DropAllLocks dropAllLocks(vm());
+        JSC::JSLock::DropAllLocks dropAllLocks(WebCore::JSDOMWindowBase::commonVM());
         WebRunLoopEnableNested();
 
         runEventLoopWhilePausedInternal();

Modified: trunk/Source/WebKit/mac/ChangeLog (188809 => 188810)


--- trunk/Source/WebKit/mac/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-08-22 00:53:55 UTC (rev 188810)
@@ -1,3 +1,21 @@
+2015-08-21  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r188792 and r188803.
+        https://bugs.webkit.org/show_bug.cgi?id=148347
+
+        broke lots of tests, ggaren is going to investigate and reland
+        (Requested by thorton on #webkit).
+
+        Reverted changesets:
+
+        "Unify code paths for manually deleting all code"
+        https://bugs.webkit.org/show_bug.cgi?id=148280
+        http://trac.webkit.org/changeset/188792
+
+        "Debugger's VM should never be null"
+        https://bugs.webkit.org/show_bug.cgi?id=148341
+        http://trac.webkit.org/changeset/188803
+
 2015-08-21  Chris Dumez  <[email protected]>
 
         document.getElementsByTagName should return an HTMLCollection

Modified: trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm (188809 => 188810)


--- trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm	2015-08-22 00:50:13 UTC (rev 188809)
+++ trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm	2015-08-22 00:53:55 UTC (rev 188810)
@@ -72,8 +72,7 @@
 }
 
 WebScriptDebugger::WebScriptDebugger(JSGlobalObject* globalObject)
-    : Debugger(globalObject->vm())
-    , m_callingDelegate(false)
+    : m_callingDelegate(false)
     , m_globalObject(globalObject->vm(), globalObject)
 {
     setPauseOnExceptionsState(PauseOnAllExceptions);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to