Changeset 161030 in webkit


Ignore:
Timestamp:
Dec 23, 2013, 3:42:52 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

CStack: Cosmetic: rename JSStack::m_commitEnd to m_commitTop.
https://bugs.webkit.org/show_bug.cgi?id=126186

Not yet reviewed.

In the JSStack constructor, m_commitEnd is initialized to highAddress()
which is the address just above the start of the stack. This is
appropriate because no memory has been committed for the stack yet i.e.
highAddress() - m_commitEnd should equal 0.

When we grow the stack in growSlowCase, we set m_commitEnd to
m_commitEnd - delta, where delta is some even multiple of commitSize
(some units of page size). This means that if there is memory committed,
m_commitEnd would point to an allocatable slot in the stack, not past it.
Hence, m_commitEnd should more appropriately be named m_commitTop.

  • interpreter/JSStack.cpp:

(JSC::JSStack::JSStack):
(JSC::JSStack::~JSStack):
(JSC::JSStack::growSlowCase):
(JSC::JSStack::releaseExcessCapacity):

  • interpreter/JSStack.h:
  • interpreter/JSStackInlines.h:

(JSC::JSStack::shrink):
(JSC::JSStack::installTrapsAfterFrame):

Location:
branches/jsCStack/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/jsCStack/Source/JavaScriptCore/ChangeLog

    r161027 r161030  
     12013-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
    1292013-12-23  Mark Lam  <mark.lam@apple.com>
    230
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp

    r161027 r161030  
    5959    m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages);
    6060    setStackLimit(highAddress());
    61     m_commitEnd = highAddress();
     61    m_commitTop = highAddress();
    6262   
    6363    m_lastStackTop = baseOfStack();
     
    7373{
    7474    void* highAddress = reinterpret_cast<void*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
    75     m_reservation.decommit(reinterpret_cast<void*>(m_commitEnd), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd));
    76     addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd)));
     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)));
    7777    m_reservation.deallocate();
    7878}
     
    8282    // If we have already committed enough memory to satisfy this request,
    8383    // just update the end pointer and return.
    84     if (newEnd >= m_commitEnd) {
     84    if (newEnd >= m_commitTop) {
    8585        setStackLimit(newEnd);
    8686        return true;
     
    9090    // have it is still within our budget. If not, we'll fail to grow and
    9191    // return false.
    92     long delta = roundUpAllocationSize(reinterpret_cast<char*>(m_commitEnd) - reinterpret_cast<char*>(newEnd), commitSize);
    93     if (reinterpret_cast<char*>(m_commitEnd) - 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))
    9494        return false;
    9595
    9696    // Otherwise, the growth is still within our budget. Go ahead and commit
    9797    // it and return true.
    98     m_reservation.commit(reinterpret_cast<char*>(m_commitEnd) - delta, delta);
     98    m_reservation.commit(reinterpret_cast<char*>(m_commitTop) - delta, delta);
    9999    addToCommittedByteCount(delta);
    100     m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) - delta);
     100    m_commitTop = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitTop) - delta);
    101101    setStackLimit(newEnd);
    102102    return true;
     
    128128void JSStack::releaseExcessCapacity()
    129129{
    130     ptrdiff_t delta = reinterpret_cast<uintptr_t>(highAddress()) - reinterpret_cast<uintptr_t>(m_commitEnd);
    131     m_reservation.decommit(m_commitEnd, delta);
     130    ptrdiff_t delta = reinterpret_cast<uintptr_t>(highAddress()) - reinterpret_cast<uintptr_t>(m_commitTop);
     131    m_reservation.decommit(m_commitTop, delta);
    132132    addToCommittedByteCount(-delta);
    133     m_commitEnd = highAddress();
     133    m_commitTop = highAddress();
    134134}
    135135
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.h

    r161027 r161030  
    177177#if ENABLE(LLINT_C_LOOP)
    178178        Register* m_end;
    179         Register* m_commitEnd;
     179        Register* m_commitTop;
    180180        Register* m_useableTop;
    181181        PageReservation m_reservation;
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStackInlines.h

    r160982 r161030  
    177177        return;
    178178    setStackLimit(newEnd);
    179     if (m_end == baseOfStack() && (m_commitEnd - baseOfStack()) >= maxExcessCapacity)
     179    if (m_end == baseOfStack() && (m_commitTop - baseOfStack()) >= maxExcessCapacity)
    180180        releaseExcessCapacity();
    181181}
     
    286286    int32_t* startOfTrap = reinterpret_cast<int32_t*>(topOfFrame);
    287287    int32_t* endOfTrap = startOfTrap - sizeOfTrap;
    288     int32_t* endOfCommitedMemory = reinterpret_cast<int32_t*>(m_commitEnd);
     288    int32_t* endOfCommitedMemory = reinterpret_cast<int32_t*>(m_commitTop);
    289289
    290290    // Make sure we're not exceeding the amount of available memory to write to:
Note: See TracChangeset for help on using the changeset viewer.