Changeset 43885 in webkit
- Timestamp:
- May 19, 2009 8:25:47 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r43881 r43885 1 2009-05-19 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Fixed <rdar://problem/6885680> CrashTracer: [USER] 1 crash in Install 6 Mac OS X at <unknown binary> • 0x9274241c 7 8 (Original patch by Joe Sokol and Ronnie Misra.) 9 10 SunSpider says 1.004x faster. 11 12 * interpreter/RegisterFile.cpp: 13 (JSC::RegisterFile::releaseExcessCapacity): Instead of doing complicated 14 math that sometimes used to overflow, just release the full range of the 15 register file. 16 17 * interpreter/RegisterFile.h: 18 (JSC::isPageAligned): 19 (JSC::RegisterFile::RegisterFile): Added ASSERTs to verify that it's 20 safe to release the full range of the register file. 21 22 (JSC::RegisterFile::shrink): No need to releaseExcessCapacity() if the 23 new end is not smaller than the old end. (Also, doing so used to cause 24 numeric overflow, unmapping basically the whole process from memory.) 25 1 26 2009-05-19 Oliver Hunt <oliver@apple.com> 2 27 -
trunk/JavaScriptCore/interpreter/RegisterFile.cpp
r42862 r43885 45 45 void RegisterFile::releaseExcessCapacity() 46 46 { 47 #if HAVE(MMAP) && HAVE(MADV_FREE) && !HAVE(VIRTUALALLOC) 48 while (madvise(m_start, (m_max - m_start) * sizeof(Register), MADV_FREE) == -1 && errno == EAGAIN) { } 49 #elif HAVE(VIRTUALALLOC) 50 VirtualFree(madvise(m_start, (m_max - m_start) * sizeof(Register), MEM_DECOMMIT); 51 m_commitEnd = m_start; 52 #endif 47 53 m_maxUsed = m_start; 48 void* memoryToRelease = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(reinterpret_cast<char*>(m_start) + commitSize * 2 - 1) & ~(commitSize - 1));49 ptrdiff_t size = reinterpret_cast<char*>(m_end) - reinterpret_cast<char*>(memoryToRelease);50 #if HAVE(MMAP) && HAVE(MADV_FREE) && !HAVE(VIRTUALALLOC)51 while (madvise(memoryToRelease, size, MADV_FREE) == -1 && errno == EAGAIN) { }52 #elif HAVE(VIRTUALALLOC)53 VirtualFree(memoryToRelease, size, MEM_DECOMMIT);54 m_commitEnd = reinterpret_cast<Register*>(memoryToRelease);55 #endif56 54 } 57 55 -
trunk/JavaScriptCore/interpreter/RegisterFile.h
r42842 r43885 157 157 }; 158 158 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 159 162 inline RegisterFile::RegisterFile(size_t capacity, size_t maxGlobals) 160 163 : m_numGlobals(0) … … 166 169 , m_globalObject(0) 167 170 { 171 // Verify that our values will play nice with mmap and VirtualAlloc. 172 ASSERT(isPageAligned(maxGlobals)); 173 ASSERT(isPageAligned(capacity)); 174 168 175 size_t bufferLength = (capacity + maxGlobals) * sizeof(Register); 169 176 #if HAVE(MMAP) … … 197 204 inline void RegisterFile::shrink(Register* newEnd) 198 205 { 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) 202 210 releaseExcessCapacity(); 203 211 }
Note: See TracChangeset
for help on using the changeset viewer.