Changeset 160822 in webkit


Ignore:
Timestamp:
Dec 18, 2013 8:30:02 PM (10 years ago)
Author:
mhahnenberg@apple.com
Message:

DelayedReleaseScope is in the wrong place
https://bugs.webkit.org/show_bug.cgi?id=125876

Reviewed by Geoffrey Garen.

The DelayedReleaseScope needs to be around the free list sweeping in MarkedAllocator::tryAllocateHelper.
This location gives us a good safe point between getting ready to allocate (i.e. identifying a non-empty
free list) and doing the actual allocation (popping the free list).

  • heap/MarkedAllocator.cpp:

(JSC::MarkedAllocator::tryAllocateHelper):
(JSC::MarkedAllocator::allocateSlowCase):
(JSC::MarkedAllocator::addBlock):

  • runtime/JSCellInlines.h:

(JSC::allocateCell):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r160812 r160822  
     12013-12-18  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        DelayedReleaseScope is in the wrong place
     4        https://bugs.webkit.org/show_bug.cgi?id=125876
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The DelayedReleaseScope needs to be around the free list sweeping in MarkedAllocator::tryAllocateHelper.
     9        This location gives us a good safe point between getting ready to allocate  (i.e. identifying a non-empty
     10        free list) and doing the actual allocation (popping the free list).
     11
     12        * heap/MarkedAllocator.cpp:
     13        (JSC::MarkedAllocator::tryAllocateHelper):
     14        (JSC::MarkedAllocator::allocateSlowCase):
     15        (JSC::MarkedAllocator::addBlock):
     16        * runtime/JSCellInlines.h:
     17        (JSC::allocateCell):
     18
    1192013-12-18  Gustavo Noronha Silva  <gns@gnome.org>
    220
  • trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp

    r159351 r160822  
    3131inline void* MarkedAllocator::tryAllocateHelper(size_t bytes)
    3232{
    33     if (!m_freeList.head) {
     33    // We need a while loop to check the free list because the DelayedReleaseScope
     34    // could cause arbitrary code to execute and exhaust the free list that we
     35    // thought had elements in it.
     36    while (!m_freeList.head) {
     37        DelayedReleaseScope delayedReleaseScope(*m_markedSpace);
    3438        if (m_currentBlock) {
    3539            ASSERT(m_currentBlock == m_blocksToSweep);
     
    6064        }
    6165    }
    62    
     66
     67    ASSERT(m_freeList.head);
    6368    MarkedBlock::FreeCell* head = m_freeList.head;
    6469    m_freeList.head = head->next;
     
    7984{
    8085    ASSERT(m_heap->vm()->currentThreadIsHoldingAPILock());
    81     DelayedReleaseScope delayedReleaseScope(*m_markedSpace);
    8286#if COLLECT_ON_EVERY_ALLOCATION
    8387    if (!m_heap->isDeferred())
     
    127131void MarkedAllocator::addBlock(MarkedBlock* block)
    128132{
     133    // Satisfy the ASSERT in MarkedBlock::sweep.
     134    DelayedReleaseScope delayedReleaseScope(*m_markedSpace);
    129135    ASSERT(!m_currentBlock);
    130136    ASSERT(!m_freeList.head);
  • trunk/Source/JavaScriptCore/runtime/JSCellInlines.h

    r157539 r160822  
    8989    ASSERT(!DisallowGC::isGCDisallowedOnCurrentThread());
    9090    ASSERT(size >= sizeof(T));
    91 #if ENABLE(GC_VALIDATION)
    92     ASSERT(!heap.vm()->isInitializingObject());
    93     heap.vm()->setInitializingObjectClass(T::info());
    94 #endif
    9591    JSCell* result = 0;
    9692    if (T::needsDestruction && T::hasImmortalStructure)
     
    10096    else
    10197        result = static_cast<JSCell*>(heap.allocateWithoutDestructor(size));
     98#if ENABLE(GC_VALIDATION)
     99    ASSERT(!heap.vm()->isInitializingObject());
     100    heap.vm()->setInitializingObjectClass(T::info());
     101#endif
    102102    result->clearStructure();
    103103    return result;
Note: See TracChangeset for help on using the changeset viewer.