Changeset 73545 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Dec 8, 2010, 1:44:38 PM (14 years ago)
Author:
[email protected]
Message:

2010-12-08 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Marking the active global object re-enters through markConservatively
https://bugs.webkit.org/show_bug.cgi?id=50711

draining of the MarkStack is not allowed to be re-entrant, we got away
with this simply due to the logic in MarkStack::drain implicitly handling
changes that could be triggered by the re-entry.

Just to be safe this patch removes the re-entry through markConservatively
so we don't accidentally introduce such an issue in future. I've also
added an assertion to catch such errors.

  • runtime/Collector.cpp: (JSC::Heap::markConservatively): (JSC::Heap::markCurrentThreadConservativelyInternal): (JSC::Heap::markOtherThreadConservatively):
  • runtime/JSArray.h: (JSC::MarkStack::drain):
  • runtime/MarkStack.h: (JSC::MarkStack::MarkStack):
Location:
trunk/JavaScriptCore/runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Collector.cpp

    r73223 r73545  
    686686                    continue;
    687687                markStack.append(reinterpret_cast<JSCell*>(xAsBits));
    688                 markStack.drain();
    689688            }
    690689        }
     
    698697    void* stackBase = currentThreadStackBase();
    699698    markConservatively(markStack, stackPointer, stackBase);
     699    markStack.drain();
    700700}
    701701
     
    860860    // mark the thread's registers
    861861    markConservatively(markStack, static_cast<void*>(&regs), static_cast<void*>(reinterpret_cast<char*>(&regs) + regSize));
     862    markStack.drain();
    862863
    863864    void* stackPointer = otherThreadStackPointer(regs);
    864865    markConservatively(markStack, stackPointer, thread->stackBase);
     866    markStack.drain();
    865867
    866868    resumeThread(thread->platformThread);
  • trunk/JavaScriptCore/runtime/JSArray.h

    r65588 r73545  
    223223    inline void MarkStack::drain()
    224224    {
     225#if !ASSERT_DISABLED
     226        ASSERT(!m_isDraining);
     227        m_isDraining = true;
     228#endif
    225229        while (!m_markSets.isEmpty() || !m_values.isEmpty()) {
    226230            while (!m_markSets.isEmpty() && m_values.size() < 50) {
     
    261265                markChildren(m_values.removeLast());
    262266        }
     267#if !ASSERT_DISABLED
     268        m_isDraining = false;
     269#endif
    263270    }
    264271
  • trunk/JavaScriptCore/runtime/MarkStack.h

    r73091 r73545  
    4242        MarkStack(void* jsArrayVPtr)
    4343            : m_jsArrayVPtr(jsArrayVPtr)
    44 #ifndef NDEBUG
     44#if !ASSERT_DISABLED
    4545            , m_isCheckingForDefaultMarkViolation(false)
     46            , m_isDraining(false)
    4647#endif
    4748        {
     
    179180        static size_t s_pageSize;
    180181
    181 #ifndef NDEBUG
     182#if !ASSERT_DISABLED
    182183    public:
    183184        bool m_isCheckingForDefaultMarkViolation;
     185        bool m_isDraining;
    184186#endif
    185187    };
Note: See TracChangeset for help on using the changeset viewer.