Title: [160931] branches/jsCStack/Source/_javascript_Core
Revision
160931
Author
msab...@apple.com
Date
2013-12-20 15:04:25 -0800 (Fri, 20 Dec 2013)

Log Message

CStack Branch: CodeBlocks aren't being marked by garbage collector
https://bugs.webkit.org/show_bug.cgi?id=126084

Reviewed by Filip Pizlo.

Changed the native stack marking to include marking CodeBlocks and JITStubRoutines.
Patterned the code after what was in JSStack::gatherConservativeRoots()

* heap/Heap.cpp:
(JSC::Heap::markRoots):
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::gatherFromCurrentThread):
(JSC::MachineThreads::gatherFromOtherThread):
(JSC::MachineThreads::gatherConservativeRoots):
* heap/MachineStackMarker.h:

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (160930 => 160931)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-20 23:01:10 UTC (rev 160930)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-20 23:04:25 UTC (rev 160931)
@@ -1,5 +1,23 @@
 2013-12-20  Michael Saboff  <msab...@apple.com>
 
+        CStack Branch: CodeBlocks aren't being marked by garbage collector
+        https://bugs.webkit.org/show_bug.cgi?id=126084
+
+        Reviewed by Filip Pizlo.
+
+        Changed the native stack marking to include marking CodeBlocks and JITStubRoutines.
+        Patterned the code after what was in JSStack::gatherConservativeRoots()
+
+        * heap/Heap.cpp:
+        (JSC::Heap::markRoots):
+        * heap/MachineStackMarker.cpp:
+        (JSC::MachineThreads::gatherFromCurrentThread):
+        (JSC::MachineThreads::gatherFromOtherThread):
+        (JSC::MachineThreads::gatherConservativeRoots):
+        * heap/MachineStackMarker.h:
+
+2013-12-20  Michael Saboff  <msab...@apple.com>
+
         Unreviewed build fix for building without the FTL.
 
         * jit/RegisterPreservationWrapperGenerator.cpp:

Modified: branches/jsCStack/Source/_javascript_Core/heap/Heap.cpp (160930 => 160931)


--- branches/jsCStack/Source/_javascript_Core/heap/Heap.cpp	2013-12-20 23:01:10 UTC (rev 160930)
+++ branches/jsCStack/Source/_javascript_Core/heap/Heap.cpp	2013-12-20 23:04:25 UTC (rev 160931)
@@ -447,20 +447,20 @@
     double gcStartTime = WTF::monotonicallyIncreasingTime();
 #endif
 
+    m_codeBlocks.clearMarks();
     void* dummy;
-    
+
     // We gather conservative roots before clearing mark bits because conservative
     // gathering uses the mark bits to determine whether a reference is valid.
     ConservativeRoots machineThreadRoots(&m_objectSpace.blocks(), &m_storageSpace);
     m_jitStubRoutines.clearMarks();
     {
         GCPHASE(GatherConservativeRoots);
-        m_machineThreads.gatherConservativeRoots(machineThreadRoots, &dummy);
+        m_machineThreads.gatherConservativeRoots(machineThreadRoots, m_jitStubRoutines, m_codeBlocks, &dummy);
     }
 
 #if ENABLE(LLINT_CLOOP)
     ConservativeRoots stackRoots(&m_objectSpace.blocks(), &m_storageSpace);
-    m_codeBlocks.clearMarks();
     {
         GCPHASE(GatherStackRoots);
         stack().gatherConservativeRoots(stackRoots, m_jitStubRoutines, m_codeBlocks);

Modified: branches/jsCStack/Source/_javascript_Core/heap/MachineStackMarker.cpp (160930 => 160931)


--- branches/jsCStack/Source/_javascript_Core/heap/MachineStackMarker.cpp	2013-12-20 23:01:10 UTC (rev 160930)
+++ branches/jsCStack/Source/_javascript_Core/heap/MachineStackMarker.cpp	2013-12-20 23:04:25 UTC (rev 160931)
@@ -239,7 +239,7 @@
 #define REGISTER_BUFFER_ALIGNMENT
 #endif
 
-void MachineThreads::gatherFromCurrentThread(ConservativeRoots& conservativeRoots, void* stackCurrent)
+void MachineThreads::gatherFromCurrentThread(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks, void* stackCurrent)
 {
     // setjmp forces volatile registers onto the stack
     jmp_buf registers REGISTER_BUFFER_ALIGNMENT;
@@ -255,12 +255,12 @@
     void* registersBegin = &registers;
     void* registersEnd = reinterpret_cast<void*>(roundUpToMultipleOf<sizeof(void*)>(reinterpret_cast<uintptr_t>(&registers + 1)));
     swapIfBackwards(registersBegin, registersEnd);
-    conservativeRoots.add(registersBegin, registersEnd);
+    conservativeRoots.add(registersBegin, registersEnd, jitStubRoutines, codeBlocks);
 
     void* stackBegin = stackCurrent;
     void* stackEnd = wtfThreadData().stack().origin();
     swapIfBackwards(stackBegin, stackEnd);
-    conservativeRoots.add(stackBegin, stackEnd);
+    conservativeRoots.add(stackBegin, stackEnd, jitStubRoutines, codeBlocks);
 }
 
 static inline void suspendThread(const PlatformThread& platformThread)
@@ -462,24 +462,24 @@
 #endif
 }
 
-void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread)
+void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks)
 {
     PlatformThreadRegisters regs;
     size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
 
-    conservativeRoots.add(static_cast<void*>(&regs), static_cast<void*>(reinterpret_cast<char*>(&regs) + regSize));
+    conservativeRoots.add(static_cast<void*>(&regs), static_cast<void*>(reinterpret_cast<char*>(&regs) + regSize), jitStubRoutines, codeBlocks);
 
     void* stackPointer = otherThreadStackPointer(regs);
     void* stackBase = thread->stackBase;
     swapIfBackwards(stackPointer, stackBase);
-    conservativeRoots.add(stackPointer, stackBase);
+    conservativeRoots.add(stackPointer, stackBase, jitStubRoutines, codeBlocks);
 
     freePlatformThreadRegisters(regs);
 }
 
-void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoots, void* stackCurrent)
+void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks, void* stackCurrent)
 {
-    gatherFromCurrentThread(conservativeRoots, stackCurrent);
+    gatherFromCurrentThread(conservativeRoots, jitStubRoutines, codeBlocks, stackCurrent);
 
     if (m_threadSpecific) {
         PlatformThread currentPlatformThread = getCurrentPlatformThread();
@@ -501,7 +501,7 @@
         // and since this is a shared heap, they are real locks.
         for (Thread* thread = m_registeredThreads; thread; thread = thread->next) {
             if (!equalThread(thread->platformThread, currentPlatformThread))
-                gatherFromOtherThread(conservativeRoots, thread);
+                gatherFromOtherThread(conservativeRoots, thread, jitStubRoutines, codeBlocks);
         }
 
         for (Thread* thread = m_registeredThreads; thread; thread = thread->next) {

Modified: branches/jsCStack/Source/_javascript_Core/heap/MachineStackMarker.h (160930 => 160931)


--- branches/jsCStack/Source/_javascript_Core/heap/MachineStackMarker.h	2013-12-20 23:01:10 UTC (rev 160930)
+++ branches/jsCStack/Source/_javascript_Core/heap/MachineStackMarker.h	2013-12-20 23:04:25 UTC (rev 160931)
@@ -28,8 +28,10 @@
 
 namespace JSC {
 
+    class CodeBlockSet;
     class ConservativeRoots;
     class Heap;
+    class JITStubRoutineSet;
 
     class MachineThreads {
         WTF_MAKE_NONCOPYABLE(MachineThreads);
@@ -37,20 +39,20 @@
         MachineThreads(Heap*);
         ~MachineThreads();
 
-        void gatherConservativeRoots(ConservativeRoots&, void* stackCurrent);
+        void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&, void* stackCurrent);
 
         JS_EXPORT_PRIVATE void makeUsableFromMultipleThreads();
         JS_EXPORT_PRIVATE void addCurrentThread(); // Only needs to be called by clients that can use the same heap from multiple threads.
 
     private:
-        void gatherFromCurrentThread(ConservativeRoots&, void* stackCurrent);
+        void gatherFromCurrentThread(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&, void* stackCurrent);
 
         class Thread;
 
         static void removeThread(void*);
         void removeCurrentThread();
 
-        void gatherFromOtherThread(ConservativeRoots&, Thread*);
+        void gatherFromOtherThread(ConservativeRoots&, Thread*, JITStubRoutineSet&, CodeBlockSet&);
 
         Mutex m_registeredThreadsMutex;
         Thread* m_registeredThreads;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to