Title: [110138] trunk/Source/_javascript_Core
Revision
110138
Author
[email protected]
Date
2012-03-07 20:04:40 -0800 (Wed, 07 Mar 2012)

Log Message

Unreviewed, rolling out r110127.
http://trac.webkit.org/changeset/110127
https://bugs.webkit.org/show_bug.cgi?id=80562

compile failed on AppleWin (Requested by ukai on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-03-07

* heap/Heap.cpp:
(JSC::Heap::collectAllGarbage):
* heap/Heap.h:
(JSC):
(Heap):
* runtime/Executable.cpp:
(JSC::FunctionExecutable::FunctionExecutable):
(JSC::FunctionExecutable::finalize):
* runtime/Executable.h:
(FunctionExecutable):
(JSC::FunctionExecutable::create):
* runtime/JSGlobalData.cpp:
(WTF):
(Recompiler):
(WTF::Recompiler::operator()):
(JSC::JSGlobalData::recompileAllJSFunctions):
(JSC):
* runtime/JSGlobalData.h:
(JSGlobalData):
* runtime/JSGlobalObject.cpp:
(JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (110137 => 110138)


--- trunk/Source/_javascript_Core/ChangeLog	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-03-08 04:04:40 UTC (rev 110138)
@@ -1,3 +1,33 @@
+2012-03-07  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r110127.
+        http://trac.webkit.org/changeset/110127
+        https://bugs.webkit.org/show_bug.cgi?id=80562
+
+        compile failed on AppleWin (Requested by ukai on #webkit).
+
+        * heap/Heap.cpp:
+        (JSC::Heap::collectAllGarbage):
+        * heap/Heap.h:
+        (JSC):
+        (Heap):
+        * runtime/Executable.cpp:
+        (JSC::FunctionExecutable::FunctionExecutable):
+        (JSC::FunctionExecutable::finalize):
+        * runtime/Executable.h:
+        (FunctionExecutable):
+        (JSC::FunctionExecutable::create):
+        * runtime/JSGlobalData.cpp:
+        (WTF):
+        (Recompiler):
+        (WTF::Recompiler::operator()):
+        (JSC::JSGlobalData::recompileAllJSFunctions):
+        (JSC):
+        * runtime/JSGlobalData.h:
+        (JSGlobalData):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
+
 2012-03-07  Hojong Han  <[email protected]>
 
         The end atom of the marked block considered to filter invalid cells

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (110137 => 110138)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2012-03-08 04:04:40 UTC (rev 110138)
@@ -764,22 +764,12 @@
     return m_objectSpace.forEachCell<RecordType>();
 }
 
-void Heap::discardAllCompiledCode()
-{
-    // 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(!m_globalData->dynamicGlobalObject);
-    
-    for (FunctionExecutable* current = m_functions.head(); current; current = current->next())
-        current->discardCode();
-}
-
 void Heap::collectAllGarbage()
 {
     if (!m_isSafeToCollect)
         return;
     if (!m_globalData->dynamicGlobalObject)
-        discardAllCompiledCode();
+        m_globalData->recompileAllJSFunctions();
 
     collect(DoSweep);
 }
@@ -934,14 +924,4 @@
     finalizer(weak.get());
 }
 
-void Heap::addFunctionExecutable(FunctionExecutable* executable)
-{
-    m_functions.append(executable);
-}
-
-void Heap::removeFunctionExecutable(FunctionExecutable* executable)
-{
-    m_functions.remove(executable);
-}
-
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/heap/Heap.h (110137 => 110138)


--- trunk/Source/_javascript_Core/heap/Heap.h	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2012-03-08 04:04:40 UTC (rev 110138)
@@ -42,7 +42,6 @@
 
     class CopiedSpace;
     class CodeBlock;
-    class FunctionExecutable;
     class GCActivityCallback;
     class GlobalCodeBlock;
     class Heap;
@@ -106,8 +105,6 @@
 
         typedef void (*Finalizer)(JSCell*);
         JS_EXPORT_PRIVATE void addFinalizer(JSCell*, Finalizer);
-        void addFunctionExecutable(FunctionExecutable*);
-        void removeFunctionExecutable(FunctionExecutable*);
 
         void notifyIsSafeToCollect() { m_isSafeToCollect = true; }
         JS_EXPORT_PRIVATE void collectAllGarbage();
@@ -143,8 +140,6 @@
 
         double lastGCLength() { return m_lastGCLength; }
 
-        void discardAllCompiledCode();
-
     private:
         friend class CodeBlock;
         friend class LLIntOffsetsExtractor;
@@ -244,8 +239,6 @@
 
         JSGlobalData* m_globalData;
         double m_lastGCLength;
-
-        DoublyLinkedList<FunctionExecutable> m_functions;
     };
 
     bool Heap::isBusy()

Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (110137 => 110138)


--- trunk/Source/_javascript_Core/runtime/Executable.cpp	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp	2012-03-08 04:04:40 UTC (rev 110138)
@@ -146,8 +146,6 @@
     , m_name(name)
     , m_inferredName(inferredName.isNull() ? globalData.propertyNames->emptyIdentifier : inferredName)
     , m_symbolTable(0)
-    , m_next(0)
-    , m_prev(0)
 {
 }
 
@@ -159,8 +157,6 @@
     , m_name(name)
     , m_inferredName(inferredName.isNull() ? exec->globalData().propertyNames->emptyIdentifier : inferredName)
     , m_symbolTable(0)
-    , m_next(0)
-    , m_prev(0)
 {
 }
 
@@ -658,9 +654,7 @@
 
 void FunctionExecutable::finalize(JSCell* cell)
 {
-    FunctionExecutable* executable = jsCast<FunctionExecutable*>(cell);
-    Heap::heap(executable)->removeFunctionExecutable(executable);
-    executable->clearCode();
+    jsCast<FunctionExecutable*>(cell)->clearCode();
 }
 
 inline void FunctionExecutable::clearCode()

Modified: trunk/Source/_javascript_Core/runtime/Executable.h (110137 => 110138)


--- trunk/Source/_javascript_Core/runtime/Executable.h	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/runtime/Executable.h	2012-03-08 04:04:40 UTC (rev 110138)
@@ -463,10 +463,9 @@
         OwnPtr<ProgramCodeBlock> m_programCodeBlock;
     };
 
-    class FunctionExecutable : public ScriptExecutable, public DoublyLinkedListNode<FunctionExecutable> {
+    class FunctionExecutable : public ScriptExecutable {
         friend class JIT;
         friend class LLIntOffsetsExtractor;
-        friend class DoublyLinkedListNode<FunctionExecutable>;
     public:
         typedef ScriptExecutable Base;
 
@@ -474,7 +473,6 @@
         {
             FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, inferredName, source, forceUsesArguments, parameters, isInStrictContext);
             executable->finishCreation(exec->globalData(), name, firstLine, lastLine);
-            exec->globalData().heap.addFunctionExecutable(executable);
             exec->globalData().heap.addFinalizer(executable, &finalize);
             return executable;
         }
@@ -483,7 +481,6 @@
         {
             FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, inferredName, source, forceUsesArguments, parameters, isInStrictContext);
             executable->finishCreation(globalData, name, firstLine, lastLine);
-            globalData.heap.addFunctionExecutable(executable);
             globalData.heap.addFinalizer(executable, &finalize);
             return executable;
         }
@@ -691,8 +688,6 @@
         Identifier m_inferredName;
         WriteBarrier<JSString> m_nameValue;
         SharedSymbolTable* m_symbolTable;
-        FunctionExecutable* m_next;
-        FunctionExecutable* m_prev;
     };
 
     inline FunctionExecutable* JSFunction::jsExecutable() const

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp (110137 => 110138)


--- trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp	2012-03-08 04:04:40 UTC (rev 110138)
@@ -68,6 +68,27 @@
 
 using namespace WTF;
 
+namespace {
+
+using namespace JSC;
+
+class Recompiler : public MarkedBlock::VoidFunctor {
+public:
+    void operator()(JSCell*);
+};
+
+inline void Recompiler::operator()(JSCell* cell)
+{
+    if (!cell->inherits(&JSFunction::s_info))
+        return;
+    JSFunction* function = asFunction(cell);
+    if (!function->executable() || function->executable()->isHostFunction())
+        return;
+    function->jsExecutable()->discardCode();
+}
+
+} // namespace
+
 namespace JSC {
 
 extern const HashTable arrayConstructorTable;
@@ -422,6 +443,15 @@
 #endif
 }
 
+void JSGlobalData::recompileAllJSFunctions()
+{
+    // 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(!dynamicGlobalObject);
+    
+    heap.objectSpace().forEachCell<Recompiler>();
+}
+
 struct StackPreservingRecompiler : public MarkedBlock::VoidFunctor {
     HashSet<FunctionExecutable*> currentlyExecutingFunctions;
     void operator()(JSCell* cell)

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.h (110137 => 110138)


--- trunk/Source/_javascript_Core/runtime/JSGlobalData.h	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.h	2012-03-08 04:04:40 UTC (rev 110138)
@@ -324,7 +324,7 @@
         JS_EXPORT_PRIVATE void startSampling();
         JS_EXPORT_PRIVATE void stopSampling();
         JS_EXPORT_PRIVATE void dumpSampleData(ExecState* exec);
-        void discardAllCompiledCode();
+        void recompileAllJSFunctions();
         RegExpCache* regExpCache() { return m_regExpCache; }
 #if ENABLE(REGEXP_TRACING)
         void addRegExpToTrace(PassRefPtr<RegExp> regExp);

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (110137 => 110138)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2012-03-08 04:02:26 UTC (rev 110137)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2012-03-08 04:04:40 UTC (rev 110138)
@@ -460,7 +460,7 @@
     if (!m_dynamicGlobalObjectSlot) {
 #if ENABLE(ASSEMBLER)
         if (ExecutableAllocator::underMemoryPressure())
-            globalData.heap.discardAllCompiledCode();
+            globalData.recompileAllJSFunctions();
 #endif
 
         m_dynamicGlobalObjectSlot = dynamicGlobalObject;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to