void
ExecutableAllocator::reprotectAll(ProtectionSetting protection)
{
    if (!m_pools.initialized())
        return;

    for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront())
        reprotectPool(rt_, r.front(), protection);
}
void
ExecutableAllocator::toggleAllCodeAsAccessible(bool accessible)
{
    if (!m_pools.initialized())
        return;

    for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront()) {
        ExecutablePool* pool = r.front();
        pool->toggleAllCodeAsAccessible(accessible);
    }
}
void
ExecutableAllocator::reprotectAll(ProtectionSetting protection)
{
#ifdef NON_WRITABLE_JIT_CODE
    if (!m_pools.initialized())
        return;

    for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront())
        reprotectPool(rt_, r.front(), protection);
#endif
}
bool
ExecutableAllocator::codeContains(char* address)
{
    if (!m_pools.initialized())
        return false;

    for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront()) {
        ExecutablePool* pool = r.front();
        if (pool->codeContains(address))
            return true;
    }

    return false;
}
void
ExecutableAllocator::addSizeOfCode(JS::CodeSizes* sizes) const
{
    if (m_pools.initialized()) {
        for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront()) {
            ExecutablePool* pool = r.front();
            sizes->ion      += pool->m_ionCodeBytes;
            sizes->baseline += pool->m_baselineCodeBytes;
            sizes->regexp   += pool->m_regexpCodeBytes;
            sizes->other    += pool->m_otherCodeBytes;
            sizes->unused   += pool->m_allocation.size - pool->m_ionCodeBytes
                                                       - pool->m_baselineCodeBytes
                                                       - pool->m_regexpCodeBytes
                                                       - pool->m_otherCodeBytes;
        }
    }
}
void
ExecutableAllocator::sizeOfCode(size_t *jaeger, size_t *ion, size_t *asmJS, size_t *regexp, size_t *unused) const
{
    *jaeger = 0;
    *ion    = 0;
    *asmJS  = 0;
    *regexp = 0;
    *unused = 0;

    if (m_pools.initialized()) {
        for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront()) {
            ExecutablePool* pool = r.front();
            *jaeger += pool->m_jaegerCodeBytes;
            *ion    += pool->m_ionCodeBytes;
            *asmJS  += pool->m_asmJSCodeBytes;
            *regexp += pool->m_regexpCodeBytes;
            *unused += pool->m_allocation.size - pool->m_jaegerCodeBytes - pool->m_ionCodeBytes
                                               - pool->m_asmJSCodeBytes - pool->m_regexpCodeBytes;
        }
    }
}