Example #1
0
inline void* MarkedAllocator::tryAllocate()
{
    m_heap->m_operationInProgress = Allocation;
    void* result = tryAllocateHelper();
    m_heap->m_operationInProgress = NoOperation;
    return result;
}
Example #2
0
inline void* MarkedAllocator::tryAllocate(size_t bytes)
{
    ASSERT(!m_heap->isBusy());
    m_heap->m_operationInProgress = Allocation;
    void* result = tryAllocateHelper(bytes);
    m_heap->m_operationInProgress = NoOperation;
    return result;
}
Example #3
0
inline void* MarkedAllocator::tryAllocate(size_t bytes)
{
    ASSERT(!m_heap->isBusy());
    m_heap->m_operationInProgress = Allocation;
    void* result = tryAllocateHelper(bytes);

    // Due to the DelayedReleaseScope in tryAllocateHelper, some other thread might have
    // created a new block after we thought we didn't find any free cells. 
    while (!result && m_currentBlock) {
        // A new block was added by another thread so try popping the free list.
        result = tryPopFreeList(bytes);
        if (result)
            break;
        // The free list was empty, so call tryAllocateHelper to do the normal sweeping stuff.
        result = tryAllocateHelper(bytes);
    }

    m_heap->m_operationInProgress = NoOperation;
    ASSERT(result || !m_currentBlock);
    return result;
}