Changeset 161030 in webkit
- Timestamp:
- Dec 23, 2013, 3:42:52 PM (11 years ago)
- Location:
- branches/jsCStack/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/jsCStack/Source/JavaScriptCore/ChangeLog
r161027 r161030 1 2013-12-23 Mark Lam <mark.lam@apple.com> 2 3 CStack: Cosmetic: rename JSStack::m_commitEnd to m_commitTop. 4 https://bugs.webkit.org/show_bug.cgi?id=126186 5 6 Not yet reviewed. 7 8 In the JSStack constructor, m_commitEnd is initialized to highAddress() 9 which is the address just above the start of the stack. This is 10 appropriate because no memory has been committed for the stack yet i.e. 11 highAddress() - m_commitEnd should equal 0. 12 13 When we grow the stack in growSlowCase, we set m_commitEnd to 14 m_commitEnd - delta, where delta is some even multiple of commitSize 15 (some units of page size). This means that if there is memory committed, 16 m_commitEnd would point to an allocatable slot in the stack, not past it. 17 Hence, m_commitEnd should more appropriately be named m_commitTop. 18 19 * interpreter/JSStack.cpp: 20 (JSC::JSStack::JSStack): 21 (JSC::JSStack::~JSStack): 22 (JSC::JSStack::growSlowCase): 23 (JSC::JSStack::releaseExcessCapacity): 24 * interpreter/JSStack.h: 25 * interpreter/JSStackInlines.h: 26 (JSC::JSStack::shrink): 27 (JSC::JSStack::installTrapsAfterFrame): 28 1 29 2013-12-23 Mark Lam <mark.lam@apple.com> 2 30 -
branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp
r161027 r161030 59 59 m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages); 60 60 setStackLimit(highAddress()); 61 m_commit End= highAddress();61 m_commitTop = highAddress(); 62 62 63 63 m_lastStackTop = baseOfStack(); … … 73 73 { 74 74 void* highAddress = reinterpret_cast<void*>(static_cast<char*>(m_reservation.base()) + m_reservation.size()); 75 m_reservation.decommit(reinterpret_cast<void*>(m_commit End), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd));76 addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commit End)));75 m_reservation.decommit(reinterpret_cast<void*>(m_commitTop), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitTop)); 76 addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitTop))); 77 77 m_reservation.deallocate(); 78 78 } … … 82 82 // If we have already committed enough memory to satisfy this request, 83 83 // just update the end pointer and return. 84 if (newEnd >= m_commit End) {84 if (newEnd >= m_commitTop) { 85 85 setStackLimit(newEnd); 86 86 return true; … … 90 90 // have it is still within our budget. If not, we'll fail to grow and 91 91 // return false. 92 long delta = roundUpAllocationSize(reinterpret_cast<char*>(m_commit End) - reinterpret_cast<char*>(newEnd), commitSize);93 if (reinterpret_cast<char*>(m_commit End) - delta <= reinterpret_cast<char*>(m_useableTop))92 long delta = roundUpAllocationSize(reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newEnd), commitSize); 93 if (reinterpret_cast<char*>(m_commitTop) - delta <= reinterpret_cast<char*>(m_useableTop)) 94 94 return false; 95 95 96 96 // Otherwise, the growth is still within our budget. Go ahead and commit 97 97 // it and return true. 98 m_reservation.commit(reinterpret_cast<char*>(m_commit End) - delta, delta);98 m_reservation.commit(reinterpret_cast<char*>(m_commitTop) - delta, delta); 99 99 addToCommittedByteCount(delta); 100 m_commit End = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) - delta);100 m_commitTop = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitTop) - delta); 101 101 setStackLimit(newEnd); 102 102 return true; … … 128 128 void JSStack::releaseExcessCapacity() 129 129 { 130 ptrdiff_t delta = reinterpret_cast<uintptr_t>(highAddress()) - reinterpret_cast<uintptr_t>(m_commit End);131 m_reservation.decommit(m_commit End, delta);130 ptrdiff_t delta = reinterpret_cast<uintptr_t>(highAddress()) - reinterpret_cast<uintptr_t>(m_commitTop); 131 m_reservation.decommit(m_commitTop, delta); 132 132 addToCommittedByteCount(-delta); 133 m_commit End= highAddress();133 m_commitTop = highAddress(); 134 134 } 135 135 -
branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.h
r161027 r161030 177 177 #if ENABLE(LLINT_C_LOOP) 178 178 Register* m_end; 179 Register* m_commit End;179 Register* m_commitTop; 180 180 Register* m_useableTop; 181 181 PageReservation m_reservation; -
branches/jsCStack/Source/JavaScriptCore/interpreter/JSStackInlines.h
r160982 r161030 177 177 return; 178 178 setStackLimit(newEnd); 179 if (m_end == baseOfStack() && (m_commit End- baseOfStack()) >= maxExcessCapacity)179 if (m_end == baseOfStack() && (m_commitTop - baseOfStack()) >= maxExcessCapacity) 180 180 releaseExcessCapacity(); 181 181 } … … 286 286 int32_t* startOfTrap = reinterpret_cast<int32_t*>(topOfFrame); 287 287 int32_t* endOfTrap = startOfTrap - sizeOfTrap; 288 int32_t* endOfCommitedMemory = reinterpret_cast<int32_t*>(m_commit End);288 int32_t* endOfCommitedMemory = reinterpret_cast<int32_t*>(m_commitTop); 289 289 290 290 // Make sure we're not exceeding the amount of available memory to write to:
Note:
See TracChangeset
for help on using the changeset viewer.