Changeset 161172 in webkit


Ignore:
Timestamp:
Dec 30, 2013, 10:49:49 PM (12 years ago)
Author:
mark.lam@apple.com
Message:

CStack: Refactor to split the tracking of the jsStackLimit from the native stackLimit.
https://bugs.webkit.org/show_bug.cgi?id=126331.

Not yet reviewed.

Previously, when using the C stack for the JS stack, VM::m_jsStackLimit is a union
with VM::m_stackLimit. We now separate them into 2 distinct fields but haven't yet
changed the computation of the limit values to set them with.

  • interpreter/JSStack.cpp:

(JSC::JSStack::updateStackLimit):

  • runtime/VM.h:
  • runtime/VMEntryScope.cpp:

(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):
(JSC::VMEntryScope::updateStackLimits):
(JSC::VMEntryScope::requiredCapacity):

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

Legend:

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

    r161170 r161172  
     12013-12-30  Mark Lam  <mark.lam@apple.com>
     2
     3        CStack: Refactor to split the tracking of the jsStackLimit from the native stackLimit.
     4        https://bugs.webkit.org/show_bug.cgi?id=126331.
     5
     6        Not yet reviewed.
     7
     8        Previously, when using the C stack for the JS stack, VM::m_jsStackLimit is a union
     9        with VM::m_stackLimit. We now separate them into 2 distinct fields but haven't yet
     10        changed the computation of the limit values to set them with.
     11
     12        * interpreter/JSStack.cpp:
     13        (JSC::JSStack::updateStackLimit):
     14        * runtime/VM.h:
     15        * runtime/VMEntryScope.cpp:
     16        (JSC::VMEntryScope::VMEntryScope):
     17        (JSC::VMEntryScope::~VMEntryScope):
     18        (JSC::VMEntryScope::updateStackLimits):
     19        (JSC::VMEntryScope::requiredCapacity):
     20        * runtime/VMEntryScope.h:
     21
    1222013-12-30  Mark Lam  <mark.lam@apple.com>
    223
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp

    r161169 r161172  
    206206#endif
    207207    if (m_vm.firstEntryScope)
    208         m_vm.firstEntryScope->updateStackLimit();
     208        m_vm.firstEntryScope->updateStackLimits();
    209209}
    210210
  • branches/jsCStack/Source/JavaScriptCore/runtime/VM.h

    r161104 r161172  
    506506        const ClassInfo* m_initializingObjectClass;
    507507#endif
    508 
    509 #if ENABLE(LLINT_C_LOOP)
    510         struct {
    511             void* m_stackLimit;
    512             void* m_jsStackLimit;
    513         };
    514 #else
    515         union {
    516             void* m_stackLimit;
    517             void* m_jsStackLimit;
    518         };
    519 #endif
     508        void* m_stackLimit;
     509        void* m_jsStackLimit;
    520510        void* m_lastStackTop;
    521511        JSValue m_exception;
  • branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp

    r161104 r161172  
    3838    , m_prevFirstEntryScope(vm.firstEntryScope)
    3939    , m_prevStackLimit(vm.stackLimit())
     40#if !ENABLE(LLINT_C_LOOP)
     41    , m_prevJSStackLimit(vm.jsStackLimit())
     42#endif
    4043    , m_prevLastStackTop(vm.lastStackTop())
    4144{
     
    5457    vm.clearExceptionStack();
    5558
    56     updateStackLimit();
     59    updateStackLimits();
    5760    vm.setLastStackTop(m_stack.origin());
    5861}
     
    6265    m_vm.firstEntryScope = m_prevFirstEntryScope;
    6366    m_vm.setStackLimit(m_prevStackLimit);
     67#if !ENABLE(LLINT_C_LOOP)
     68    m_vm.setJSStackLimit(m_prevJSStackLimit);
     69#endif
    6470    m_vm.setLastStackTop(m_prevLastStackTop);
    6571}
    6672
    67 void VMEntryScope::updateStackLimit()
     73void VMEntryScope::updateStackLimits()
    6874{
    69     void* limit = m_stack.recursionLimit(requiredCapacity());
    70     m_vm.setStackLimit(limit);
     75#if !ENABLE(LLINT_C_LOOP)
     76    void* jsStackLimit = m_stack.recursionLimit(requiredCapacity(JSStackCapacity));
     77    m_vm.setJSStackLimit(jsStackLimit);
     78#endif
     79    void* nativeStackLimit = m_stack.recursionLimit(requiredCapacity(NativeStackCapacity));
     80    m_vm.setStackLimit(nativeStackLimit);
    7181}
    7282
    73 size_t VMEntryScope::requiredCapacity() const
     83size_t VMEntryScope::requiredCapacity(CapacityType type) const
    7484{
    75     Interpreter* interpreter = m_vm.interpreter;
     85    UNUSED_PARAM(type);
    7686
    7787    // We require a smaller stack budget for the error stack. This is to allow
     
    8595    const size_t errorModeRequiredStack = 64 * KB;
    8696
     97    Interpreter* interpreter = m_vm.interpreter;
    8798    size_t requiredCapacity = interpreter->isInErrorHandlingMode() ? errorModeRequiredStack : requiredStack;
    8899    RELEASE_ASSERT(m_stack.size() >= requiredCapacity);
  • branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.h

    r161104 r161172  
    4141    JS_EXPORT_PRIVATE ~VMEntryScope();
    4242
    43     void updateStackLimit();
     43    void updateStackLimits();
    4444    JSGlobalObject* globalObject() const { return m_globalObject; }
    4545
    4646private:
    47     size_t requiredCapacity() const;
     47    enum CapacityType {
     48        JSStackCapacity,
     49        NativeStackCapacity,
     50    };
     51    size_t requiredCapacity(CapacityType) const;
    4852
    4953    VM& m_vm;
     
    5256    JSGlobalObject* m_globalObject;
    5357
    54     // m_prevFirstEntryScope, m_prevStackLimit & m_prevLastStackTop may belong to a different thread's stack.
     58    // The following pointers may point to a different thread's stack.
    5559    VMEntryScope* m_prevFirstEntryScope;
    5660    void* m_prevStackLimit;
     61#if !ENABLE(LLINT_C_LOOP)
     62    void* m_prevJSStackLimit;
     63#endif
    5764    void* m_prevLastStackTop;
    5865};
Note: See TracChangeset for help on using the changeset viewer.