Ignore:
Timestamp:
May 19, 2009, 8:25:47 PM (16 years ago)
Author:
[email protected]
Message:

2009-05-19 Geoffrey Garen <[email protected]>

Reviewed by Sam Weinig.


Fixed <rdar://problem/6885680> CrashTracer: [USER] 1 crash in Install
Mac OS X at <unknown binary> • 0x9274241c


(Original patch by Joe Sokol and Ronnie Misra.)


SunSpider says 1.004x faster.

  • interpreter/RegisterFile.cpp: (JSC::RegisterFile::releaseExcessCapacity): Instead of doing complicated math that sometimes used to overflow, just release the full range of the register file.
  • interpreter/RegisterFile.h: (JSC::isPageAligned): (JSC::RegisterFile::RegisterFile): Added ASSERTs to verify that it's safe to release the full range of the register file.

(JSC::RegisterFile::shrink): No need to releaseExcessCapacity() if the
new end is not smaller than the old end. (Also, doing so used to cause
numeric overflow, unmapping basically the whole process from memory.)

File:
1 edited

Legend:

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

    r42842 r43885  
    157157    };
    158158
     159    // FIXME: Add a generic getpagesize() to WTF, then move this function to WTF as well.
     160    inline bool isPageAligned(size_t size) { return size != 0 && size % (8 * 1024) == 0; }
     161
    159162    inline RegisterFile::RegisterFile(size_t capacity, size_t maxGlobals)
    160163        : m_numGlobals(0)
     
    166169        , m_globalObject(0)
    167170    {
     171        // Verify that our values will play nice with mmap and VirtualAlloc.
     172        ASSERT(isPageAligned(maxGlobals));
     173        ASSERT(isPageAligned(capacity));
     174
    168175        size_t bufferLength = (capacity + maxGlobals) * sizeof(Register);
    169176    #if HAVE(MMAP)
     
    197204    inline void RegisterFile::shrink(Register* newEnd)
    198205    {
    199         if (newEnd < m_end)
    200             m_end = newEnd;
    201         if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity)
     206        if (newEnd >= m_end)
     207            return;
     208        m_end = newEnd;
     209        if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity)
    202210            releaseExcessCapacity();
    203211    }
Note: See TracChangeset for help on using the changeset viewer.