⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 161582 in webkit


Ignore:
Timestamp:
Jan 9, 2014, 2:07:31 PM (13 years ago)
Author:
mark.lam@apple.com
Message:

CStack: Rename "host zone" to "reserved zone".
https://bugs.webkit.org/show_bug.cgi?id=126716.

Reviewed by Michael Saboff.

The "zone" is used as a reserve of stack memory for:

  1. nominal host code stack usage.
  2. stack space for error handling.
  3. initial stack space for pushing VMEntrySentinel frames.

The "zone" may reside on the C stack and on the C loop JSStack depending
on context. Hence, the name "host zone" is not quite accurate, and we'll
rename it to "reserved zone".

  • interpreter/JSStack.cpp:

(JSC::JSStack::JSStack):
(JSC::JSStack::growSlowCase):
(JSC::JSStack::releaseExcessCapacity):
(JSC::JSStack::setReservedZoneSize):

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

(JSC::JSStack::shrink):

  • runtime/ErrorHandlingScope.cpp:

(JSC::ErrorHandlingScope::ErrorHandlingScope):
(JSC::ErrorHandlingScope::~ErrorHandlingScope):

  • runtime/ErrorHandlingScope.h:
  • runtime/JSLock.cpp:

(JSC::JSLock::DropAllLocks::DropAllLocks):
(JSC::JSLock::DropAllLocks::~DropAllLocks):

  • runtime/JSLock.h:
  • runtime/Options.h:
  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::updateStackLimitWithReservedZoneSize):

  • runtime/VM.h:

(JSC::VM::reservedZoneSize):

  • runtime/VMEntryScope.cpp:

(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):

  • runtime/VMEntryScope.h:
Location:
branches/jsCStack/Source/JavaScriptCore
Files:
15 edited

Legend:

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

    r161575 r161582  
     12014-01-09  Mark Lam  <mark.lam@apple.com>
     2
     3        CStack: Rename "host zone" to "reserved zone".
     4        https://bugs.webkit.org/show_bug.cgi?id=126716.
     5
     6        Reviewed by Michael Saboff.
     7
     8        The "zone" is used as a reserve of stack memory for:
     9        1. nominal host code stack usage.
     10        2. stack space for error handling.
     11        3. initial stack space for pushing VMEntrySentinel frames.
     12
     13        The "zone" may reside on the C stack and on the C loop JSStack depending
     14        on context. Hence, the name "host zone" is not quite accurate, and we'll
     15        rename it to "reserved zone".
     16
     17        * interpreter/JSStack.cpp:
     18        (JSC::JSStack::JSStack):
     19        (JSC::JSStack::growSlowCase):
     20        (JSC::JSStack::releaseExcessCapacity):
     21        (JSC::JSStack::setReservedZoneSize):
     22        * interpreter/JSStack.h:
     23        * interpreter/JSStackInlines.h:
     24        (JSC::JSStack::shrink):
     25        * runtime/ErrorHandlingScope.cpp:
     26        (JSC::ErrorHandlingScope::ErrorHandlingScope):
     27        (JSC::ErrorHandlingScope::~ErrorHandlingScope):
     28        * runtime/ErrorHandlingScope.h:
     29        * runtime/JSLock.cpp:
     30        (JSC::JSLock::DropAllLocks::DropAllLocks):
     31        (JSC::JSLock::DropAllLocks::~DropAllLocks):
     32        * runtime/JSLock.h:
     33        * runtime/Options.h:
     34        * runtime/VM.cpp:
     35        (JSC::VM::VM):
     36        (JSC::VM::updateStackLimitWithReservedZoneSize):
     37        * runtime/VM.h:
     38        (JSC::VM::reservedZoneSize):
     39        * runtime/VMEntryScope.cpp:
     40        (JSC::VMEntryScope::VMEntryScope):
     41        (JSC::VMEntryScope::~VMEntryScope):
     42        * runtime/VMEntryScope.h:
     43
    1442014-01-09  Mark Lam  <mark.lam@apple.com>
    245
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp

    r161575 r161582  
    5151#if ENABLE(LLINT_C_LOOP)
    5252    , m_end(0)
    53     , m_hostZoneSizeInRegisters(0)
     53    , m_reservedZoneSizeInRegisters(0)
    5454#endif
    5555{
     
    7979bool JSStack::growSlowCase(Register* newTopOfStack)
    8080{
    81     Register* newTopOfStackWithHostZone = newTopOfStack - m_hostZoneSizeInRegisters;
     81    Register* newTopOfStackWithReservedZone = newTopOfStack - m_reservedZoneSizeInRegisters;
    8282
    8383    // If we have already committed enough memory to satisfy this request,
    8484    // just update the end pointer and return.
    85     if (newTopOfStackWithHostZone >= m_commitTop) {
     85    if (newTopOfStackWithReservedZone >= m_commitTop) {
    8686        setStackLimit(newTopOfStack);
    8787        return true;
     
    9191    // have it is still within our budget. If not, we'll fail to grow and
    9292    // return false.
    93     ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithHostZone);
     93    ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithReservedZone);
    9494    delta = WTF::roundUpToMultipleOf(commitSize, delta);
    9595    Register* newCommitTop = m_commitTop - (delta / sizeof(Register));
     
    131131void JSStack::releaseExcessCapacity()
    132132{
    133     Register* highAddressWithHostZone = highAddress() - m_hostZoneSizeInRegisters;
    134     ptrdiff_t delta = reinterpret_cast<char*>(highAddressWithHostZone) - reinterpret_cast<char*>(m_commitTop);
     133    Register* highAddressWithReservedZone = highAddress() - m_reservedZoneSizeInRegisters;
     134    ptrdiff_t delta = reinterpret_cast<char*>(highAddressWithReservedZone) - reinterpret_cast<char*>(m_commitTop);
    135135    m_reservation.decommit(m_commitTop, delta);
    136136    addToCommittedByteCount(-delta);
    137     m_commitTop = highAddressWithHostZone;
     137    m_commitTop = highAddressWithReservedZone;
    138138}
    139139
     
    150150}
    151151
    152 void JSStack::setHostZoneSize(size_t hostZoneSize)
     152void JSStack::setReservedZoneSize(size_t reservedZoneSize)
    153153{
    154     m_hostZoneSizeInRegisters = hostZoneSize / sizeof(Register);
    155     if (m_commitTop >= (m_end + 1) - m_hostZoneSizeInRegisters)
     154    m_reservedZoneSizeInRegisters = reservedZoneSize / sizeof(Register);
     155    if (m_commitTop >= (m_end + 1) - m_reservedZoneSizeInRegisters)
    156156        growSlowCase(m_end + 1);
    157157}
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.h

    r161575 r161582  
    108108        static void initializeThreading();
    109109
    110         void setHostZoneSize(size_t);
     110        void setReservedZoneSize(size_t);
    111111
    112112        CallFrame* pushFrame(class CodeBlock*, JSScope*, int argsCount, JSObject* callee);
     
    175175        PageReservation m_reservation;
    176176        Register* m_lastStackTop;
    177         ptrdiff_t m_hostZoneSizeInRegisters;
     177        ptrdiff_t m_reservedZoneSizeInRegisters;
    178178#endif // ENABLE(LLINT_C_LOOP)
    179179
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStackInlines.h

    r161575 r161582  
    162162    // assign the constant to a local variable, and use the local instead.
    163163    ptrdiff_t maxExcessCapacity = JSStack::maxExcessCapacity;
    164     ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_hostZoneSizeInRegisters);
     164    ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_reservedZoneSizeInRegisters);
    165165    if (m_end == baseOfStack() && (highAddress() - m_commitTop) >= maxExcessInRegisters)
    166166        releaseExcessCapacity();
  • branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r161409 r161582  
    231231    storep sp, VM::stackPointerAtVMEntry[vm]
    232232
    233     # The stack host zone ensures that we have adequate space for the
     233    # The stack reserved zone ensures that we have adequate space for the
    234234    # VMEntrySentinelFrame. Proceed with allocating and initializing the
    235235    # sentinel frame.
  • branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r161575 r161582  
    122122    checkStackPointerAlignment(temp2, 0xbad0dc01)
    123123
    124     # The stack host zone ensures that we have adequate space for the
     124    # The stack reserved zone ensures that we have adequate space for the
    125125    # VMEntrySentinelFrame. Proceed with allocating and initializing the
    126126    # sentinel frame.
  • branches/jsCStack/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp

    r161575 r161582  
    3838    if (!m_vm.stackPointerAtVMEntry)
    3939        m_vm.stackPointerAtVMEntry = this;
    40     size_t newHostZoneSize = Options::errorModeHostZoneSize();
    41     m_savedHostZoneSize = m_vm.updateStackLimitWithHostZoneSize(newHostZoneSize);
     40    size_t newReservedZoneSize = Options::errorModeReservedZoneSize();
     41    m_savedReservedZoneSize = m_vm.updateStackLimitWithReservedZoneSize(newReservedZoneSize);
    4242#if ENABLE(LLINT_C_LOOP)
    43     m_vm.interpreter->stack().setHostZoneSize(newHostZoneSize);
     43    m_vm.interpreter->stack().setReservedZoneSize(newReservedZoneSize);
    4444#endif
    4545}
     
    4949    if (m_vm.stackPointerAtVMEntry == this)
    5050        m_vm.stackPointerAtVMEntry = nullptr;
    51     m_vm.updateStackLimitWithHostZoneSize(m_savedHostZoneSize);
     51    m_vm.updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize);
    5252#if ENABLE(LLINT_C_LOOP)
    53     m_vm.interpreter->stack().setHostZoneSize(m_savedHostZoneSize);
     53    m_vm.interpreter->stack().setReservedZoneSize(m_savedReservedZoneSize);
    5454#endif
    5555}
  • branches/jsCStack/Source/JavaScriptCore/runtime/ErrorHandlingScope.h

    r161575 r161582  
    3737private:
    3838    VM& m_vm;
    39     size_t m_savedHostZoneSize;
     39    size_t m_savedReservedZoneSize;
    4040};
    4141
  • branches/jsCStack/Source/JavaScriptCore/runtime/JSLock.cpp

    r161575 r161582  
    291291    SpinLockHolder holder(&spinLock);
    292292#endif
    293     m_savedHostZoneSize = m_vm->hostZoneSize();
     293    m_savedReservedZoneSize = m_vm->reservedZoneSize();
    294294    m_savedStackPointerAtVMEntry = m_vm->stackPointerAtVMEntry;
    295295    m_vm->stackPointerAtVMEntry = nullptr;
     
    311311    SpinLockHolder holder(&spinLock);
    312312#endif
    313     m_savedHostZoneSize = m_vm->hostZoneSize();
     313    m_savedReservedZoneSize = m_vm->reservedZoneSize();
    314314    m_savedStackPointerAtVMEntry = m_vm->stackPointerAtVMEntry;
    315315    m_vm->stackPointerAtVMEntry = nullptr;
     
    332332
    333333    m_vm->stackPointerAtVMEntry = m_savedStackPointerAtVMEntry;
    334     m_vm->updateStackLimitWithHostZoneSize(m_savedHostZoneSize);
     334    m_vm->updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize);
    335335}
    336336
  • branches/jsCStack/Source/JavaScriptCore/runtime/JSLock.h

    r161575 r161582  
    111111            intptr_t m_lockCount;
    112112            RefPtr<VM> m_vm;
    113             size_t m_savedHostZoneSize;
     113            size_t m_savedReservedZoneSize;
    114114            void* m_savedStackPointerAtVMEntry;
    115115        };
  • branches/jsCStack/Source/JavaScriptCore/runtime/Options.h

    r161575 r161582  
    9797    \
    9898    v(unsigned, maxPerThreadStackUsage, 4 * MB) \
    99     v(unsigned, hostZoneSize, 128 * KB) \
    100     v(unsigned, errorModeHostZoneSize, 64 * KB) \
     99    v(unsigned, reservedZoneSize, 128 * KB) \
     100    v(unsigned, errorModeReservedZoneSize, 64 * KB) \
    101101    \
    102102    v(bool, crashIfCantAllocateJITMemory, false) \
  • branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp

    r161575 r161582  
    230230    interpreter = new Interpreter(*this);
    231231    StackBounds stack = wtfThreadData().stack();
    232     updateStackLimitWithHostZoneSize(Options::hostZoneSize());
     232    updateStackLimitWithReservedZoneSize(Options::reservedZoneSize());
    233233#if ENABLE(LLINT_C_LOOP)
    234     interpreter->stack().setHostZoneSize(Options::hostZoneSize());
     234    interpreter->stack().setReservedZoneSize(Options::reservedZoneSize());
    235235#endif
    236236    setLastStackTop(stack.origin());
     
    716716}
    717717
    718 size_t VM::updateStackLimitWithHostZoneSize(size_t hostZoneSize)
    719 {
    720     size_t oldHostZoneSize = m_hostZoneSize;
    721     m_hostZoneSize = hostZoneSize;
     718size_t VM::updateStackLimitWithReservedZoneSize(size_t reservedZoneSize)
     719{
     720    size_t oldReservedZoneSize = m_reservedZoneSize;
     721    m_reservedZoneSize = reservedZoneSize;
    722722
    723723    void* stackLimit;
     
    725725        ASSERT(wtfThreadData().stack().isGrowingDownward());
    726726        char* startOfStack = reinterpret_cast<char*>(stackPointerAtVMEntry);
    727         char* desiredStackLimit = startOfStack - Options::maxPerThreadStackUsage() + hostZoneSize;
    728         stackLimit = wtfThreadData().stack().recursionLimit(hostZoneSize, desiredStackLimit);
     727        char* desiredStackLimit = startOfStack - Options::maxPerThreadStackUsage() + reservedZoneSize;
     728        stackLimit = wtfThreadData().stack().recursionLimit(reservedZoneSize, desiredStackLimit);
    729729    } else
    730         stackLimit = wtfThreadData().stack().recursionLimit(hostZoneSize);
     730        stackLimit = wtfThreadData().stack().recursionLimit(reservedZoneSize);
    731731
    732732    setStackLimit(stackLimit);
    733     return oldHostZoneSize;
     733    return oldReservedZoneSize;
    734734}
    735735
  • branches/jsCStack/Source/JavaScriptCore/runtime/VM.h

    r161575 r161582  
    376376        JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
    377377       
    378         size_t hostZoneSize() const { return m_hostZoneSize; }
    379         size_t updateStackLimitWithHostZoneSize(size_t hostZoneSize);
     378        size_t reservedZoneSize() const { return m_reservedZoneSize; }
     379        size_t updateStackLimitWithReservedZoneSize(size_t reservedZoneSize);
    380380
    381381        void** addressOfJSStackLimit() { return &m_jsStackLimit; }
     
    514514        const ClassInfo* m_initializingObjectClass;
    515515#endif
    516         size_t m_hostZoneSize;
     516        size_t m_reservedZoneSize;
    517517#if ENABLE(LLINT_C_LOOP)
    518518        struct {
  • branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp

    r161575 r161582  
    5252    if (!vm.stackPointerAtVMEntry) {
    5353        vm.stackPointerAtVMEntry = this;
    54         m_savedHostZoneSize = vm.updateStackLimitWithHostZoneSize(Options::hostZoneSize());
     54        m_savedReservedZoneSize = vm.updateStackLimitWithReservedZoneSize(Options::reservedZoneSize());
    5555    }
    5656
     
    6565    if (m_vm.stackPointerAtVMEntry == this) {
    6666        m_vm.stackPointerAtVMEntry = nullptr;
    67         m_vm.updateStackLimitWithHostZoneSize(m_savedHostZoneSize);
     67        m_vm.updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize);
    6868    }
    6969}
  • branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.h

    r161575 r161582  
    4747    StackStats::CheckPoint m_stackCheckPoint;
    4848    JSGlobalObject* m_globalObject;
    49     size_t m_savedHostZoneSize;
     49    size_t m_savedReservedZoneSize;
    5050};
    5151
Note: See TracChangeset for help on using the changeset viewer.