Ignore:
Timestamp:
Apr 24, 2009, 2:53:46 PM (16 years ago)
Author:
[email protected]
Message:

<rdar://problem/6050421> JavaScript register file should remap to release physical pages accumulated during deep recursion

Reviewed by Geoff Garen

We now track the maximum extent of the RegisterFile, and when we reach the final
return from JS (so the stack portion of the registerfile becomes empty) we see
if that extent is greater than maxExcessCapacity. If it is we use madvise or
VirtualFree to release the physical pages that were backing the excess.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/RegisterFile.h

    r42705 r42842  
    115115        static const size_t defaultMaxGlobals = 8192;
    116116        static const size_t commitSize = 1 << 14;
     117        // Allow 8k of excess registers before we start trying to reap the registerfile
     118        static const ptrdiff_t maxExcessCapacity = 8 * 1024;
    117119
    118120        RegisterFile(size_t capacity = defaultCapacity, size_t maxGlobals = defaultMaxGlobals);
     
    139141
    140142    private:
     143        void releaseExcessCapacity();
    141144        size_t m_numGlobals;
    142145        const size_t m_maxGlobals;
     
    145148        Register* m_max;
    146149        Register* m_buffer;
     150        Register* m_maxUsed;
     151
    147152#if HAVE(VIRTUALALLOC)
    148153        Register* m_commitEnd;
     
    186191        m_start = m_buffer + maxGlobals;
    187192        m_end = m_start;
     193        m_maxUsed = m_end;
    188194        m_max = m_start + capacity;
    189195    }
     
    193199        if (newEnd < m_end)
    194200            m_end = newEnd;
     201        if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity)
     202            releaseExcessCapacity();
    195203    }
    196204
     
    214222#endif
    215223
     224        if (newEnd > m_maxUsed)
     225            m_maxUsed = newEnd;
     226
    216227        m_end = newEnd;
    217228        return true;
Note: See TracChangeset for help on using the changeset viewer.