Changeset 161174 in webkit


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

CStack: Introduce tracking of the top VMEntryScope.
https://bugs.webkit.org/show_bug.cgi?id=126334.

Not yet reviewed.

When we start measuring the stack usage of each VMEntryScope, we'll need
to know which VMEntryScope is the top (most recent) one, not just the
first one.

Also, for correctness, in JSStack::updateStackLimit(), when we set a new
jsStackLimit, we should set it on the top VMEntryScope, and not on the
first (oldest) one. This is because the 2 scopes may be on 2 different
thread stacks, and the most present stack limits only apply to the most
recent scope. That said, presently, VMEntryScope::updateStackLimits()
does not rely on any scope specific data yet. So, calling updateStackLimits()
on the oldest VMEntryScope hasn't manifested any issues yet. Regardless,
this is now fixed.

  • interpreter/JSStack.cpp:

(JSC::JSStack::updateStackLimit):

  • runtime/VM.cpp:

(JSC::VM::VM):

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

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

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

Legend:

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

    r161172 r161174  
     12013-12-30  Mark Lam  <mark.lam@apple.com>
     2
     3        CStack: Introduce tracking of the top VMEntryScope.
     4        https://bugs.webkit.org/show_bug.cgi?id=126334.
     5
     6        Not yet reviewed.
     7
     8        When we start measuring the stack usage of each VMEntryScope, we'll need
     9        to know which VMEntryScope is the top (most recent) one, not just the
     10        first one.
     11
     12        Also, for correctness, in JSStack::updateStackLimit(), when we set a new
     13        jsStackLimit, we should set it on the top VMEntryScope, and not on the
     14        first (oldest) one. This is because the 2 scopes may be on 2 different
     15        thread stacks, and the most present stack limits only apply to the most
     16        recent scope. That said, presently, VMEntryScope::updateStackLimits()
     17        does not rely on any scope specific data yet. So, calling updateStackLimits()
     18        on the oldest VMEntryScope hasn't manifested any issues yet. Regardless,
     19        this is now fixed.
     20
     21        * interpreter/JSStack.cpp:
     22        (JSC::JSStack::updateStackLimit):
     23        * runtime/VM.cpp:
     24        (JSC::VM::VM):
     25        * runtime/VM.h:
     26        * runtime/VMEntryScope.cpp:
     27        (JSC::VMEntryScope::VMEntryScope):
     28        (JSC::VMEntryScope::~VMEntryScope):
     29        * runtime/VMEntryScope.h:
     30
    1312013-12-30  Mark Lam  <mark.lam@apple.com>
    232
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp

    r161172 r161174  
    205205        disableErrorStackReserve();
    206206#endif
    207     if (m_vm.firstEntryScope)
    208         m_vm.firstEntryScope->updateStackLimits();
     207    if (m_vm.topEntryScope)
     208        m_vm.topEntryScope->updateStackLimits();
    209209}
    210210
  • branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp

    r161104 r161174  
    200200    , sizeOfLastScratchBuffer(0)
    201201    , firstEntryScope(0)
     202    , topEntryScope(0)
    202203    , m_enabledProfiler(0)
    203204    , m_regExpCache(new RegExpCache(this))
  • branches/jsCStack/Source/JavaScriptCore/runtime/VM.h

    r161172 r161174  
    428428
    429429        VMEntryScope* firstEntryScope;
     430        VMEntryScope* topEntryScope;
    430431
    431432        HashSet<JSObject*> stringRecursionCheckVisitedObjects;
  • branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp

    r161172 r161174  
    3737    , m_globalObject(globalObject)
    3838    , m_prevFirstEntryScope(vm.firstEntryScope)
     39    , m_prevTopEntryScope(vm.topEntryScope)
    3940    , m_prevStackLimit(vm.stackLimit())
    4041#if !ENABLE(LLINT_C_LOOP)
     
    5455        vm.resetDateCache();
    5556    }
    56     // Clear the exception stack between entries
     57    vm.topEntryScope = this;
     58
     59    // Clear the captured exception stack between entries
    5760    vm.clearExceptionStack();
    5861
     
    6467{
    6568    m_vm.firstEntryScope = m_prevFirstEntryScope;
     69    m_vm.topEntryScope = m_prevTopEntryScope;
    6670    m_vm.setStackLimit(m_prevStackLimit);
    6771#if !ENABLE(LLINT_C_LOOP)
  • branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.h

    r161172 r161174  
    5858    // The following pointers may point to a different thread's stack.
    5959    VMEntryScope* m_prevFirstEntryScope;
     60    VMEntryScope* m_prevTopEntryScope;
    6061    void* m_prevStackLimit;
    6162#if !ENABLE(LLINT_C_LOOP)
Note: See TracChangeset for help on using the changeset viewer.