fast/profiler tests ASSERTing after moving recompileAllJSFunctions off a timer
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 21:27:42 +0000 (21:27 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 21:27:42 +0000 (21:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127566

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Make the VM handle recompilation as soon as possible after it is requested.

* debugger/Debugger.cpp:
(JSC::Debugger::recompileAllJSFunctions):
When in a JavaScript stack, mark for recompilation when possible.

* runtime/VMEntryScope.h:
(JSC::VMEntryScope::setRecompilationNeeded):
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):
Handle recompilation when the top VMEntryScope is popped.
Pass the needs recompilation flag up the stack if needed.

Source/WebCore:

Covered by existing tests.

* testing/Internals.cpp:
(WebCore::Internals::closeDummyInspectorFrontend):
Now that we don't have to fake that this is a page being destroyed to
avoid recompilation. Use the InspectorDestroyed reason.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162720 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/debugger/Debugger.cpp
Source/JavaScriptCore/runtime/VMEntryScope.cpp
Source/JavaScriptCore/runtime/VMEntryScope.h
Source/WebCore/ChangeLog
Source/WebCore/testing/Internals.cpp

index 655c496..4cccc00 100644 (file)
@@ -1,3 +1,24 @@
+2014-01-24  Joseph Pecoraro  <pecoraro@apple.com>
+
+        fast/profiler tests ASSERTing after moving recompileAllJSFunctions off a timer
+        https://bugs.webkit.org/show_bug.cgi?id=127566
+
+        Reviewed by Oliver Hunt.
+
+        Make the VM handle recompilation as soon as possible after it is requested.
+
+        * debugger/Debugger.cpp:
+        (JSC::Debugger::recompileAllJSFunctions):
+        When in a JavaScript stack, mark for recompilation when possible.
+
+        * runtime/VMEntryScope.h:
+        (JSC::VMEntryScope::setRecompilationNeeded):
+        * runtime/VMEntryScope.cpp:
+        (JSC::VMEntryScope::VMEntryScope):
+        (JSC::VMEntryScope::~VMEntryScope):
+        Handle recompilation when the top VMEntryScope is popped.
+        Pass the needs recompilation flag up the stack if needed.
+
 2014-01-24  Oliver Hunt  <oliver@apple.com>
 
         Generic JSObject::put should handle static properties in the classinfo hierarchy
index a9c6ace..d3f0734 100644 (file)
@@ -322,10 +322,11 @@ void Debugger::recompileAllJSFunctions(VM* vm)
 {
     // If JavaScript is running, it's not safe to recompile, since we'll end
     // up throwing away code that is live on the stack.
-    ASSERT(!vm->entryScope);
-    if (vm->entryScope)
+    if (vm->entryScope) {
+        vm->entryScope->setRecompilationNeeded(true);
         return;
-    
+    }
+
     vm->prepareToDiscardCode();
 
     Recompiler recompiler(this);
index 26b0028..47782ce 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "VMEntryScope.h"
 
+#include "Debugger.h"
 #include "VM.h"
 #include <wtf/StackBounds.h>
 
@@ -37,6 +38,7 @@ VMEntryScope::VMEntryScope(VM& vm, JSGlobalObject* globalObject)
     , m_globalObject(globalObject)
     , m_prev(vm.entryScope)
     , m_prevStackLimit(vm.stackLimit())
+    , m_recompilationNeeded(false)
 {
     if (!vm.entryScope) {
 #if ENABLE(ASSEMBLER)
@@ -60,6 +62,15 @@ VMEntryScope::~VMEntryScope()
 {
     m_vm.entryScope = m_prev;
     m_vm.setStackLimit(m_prevStackLimit);
+
+    if (m_recompilationNeeded) {
+        if (m_vm.entryScope)
+            m_vm.entryScope->setRecompilationNeeded(true);
+        else {
+            if (Debugger* debugger = m_globalObject->debugger())
+                debugger->recompileAllJSFunctions(&m_vm);
+        }
+    }
 }
 
 size_t VMEntryScope::requiredCapacity() const
@@ -78,8 +89,7 @@ size_t VMEntryScope::requiredCapacity() const
 
     size_t requiredCapacity = interpreter->isInErrorHandlingMode() ? errorModeRequiredStack : requiredStack;
     RELEASE_ASSERT(m_stack.size() >= requiredCapacity);
-    return requiredCapacity; 
+    return requiredCapacity;
 }
 
 } // namespace JSC
-
index 8e1c44a..d5ba823 100644 (file)
@@ -42,6 +42,8 @@ public:
 
     JSGlobalObject* globalObject() const { return m_globalObject; }
 
+    void setRecompilationNeeded(bool recompileNeeded) { m_recompilationNeeded = recompileNeeded; }
+
 private:
     size_t requiredCapacity() const;
 
@@ -53,6 +55,7 @@ private:
     // m_prev and m_prevStackLimit may belong to a different thread's stack.
     VMEntryScope* m_prev;
     void* m_prevStackLimit;
+    bool m_recompilationNeeded;
 };
 
 } // namespace JSC
index 1b6a7c5..315ed61 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-24  Joseph Pecoraro  <pecoraro@apple.com>
+
+        fast/profiler tests ASSERTing after moving recompileAllJSFunctions off a timer
+        https://bugs.webkit.org/show_bug.cgi?id=127566
+
+        Reviewed by Oliver Hunt.
+
+        Covered by existing tests.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::closeDummyInspectorFrontend):
+        Now that we don't have to fake that this is a page being destroyed to
+        avoid recompilation. Use the InspectorDestroyed reason.
+
 2014-01-24  Anders Carlsson  <andersca@apple.com>
 
         Get rid of monotonicallyIncreasingTimeMS and start using std::chrono instead
index 7390c2d..28cbb5d 100644 (file)
@@ -1465,8 +1465,7 @@ void Internals::closeDummyInspectorFrontend()
     ASSERT(page);
     ASSERT(m_frontendWindow);
 
-    // Treat this as if the page we are inspecting is closing.
-    page->inspectorController().disconnectFrontend(InspectorDisconnectReason::InspectedTargetDestroyed);
+    page->inspectorController().disconnectFrontend(InspectorDisconnectReason::InspectorDestroyed);
 
     m_frontendChannel.release();