Changeset 160981 in webkit


Ignore:
Timestamp:
Dec 22, 2013, 2:26:23 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

CStack: Fixed some JSStack on C Stack boundary computations.
https://bugs.webkit.org/show_bug.cgi?id=126139.

Not yet reviewed.

  1. Implement committedByteCount() for JSStack on the C stack using the current stack usage as an estimate of committed stack memory.
  2. Implement lowAddress() and highAddress() for JSStack on the C stack for containsAddress(). lowAddress() will be the top of the JS stack. highAddress() will be 1 past the end of the JS stack.
  3. Moved some functions around in preparation for an upcoming patch to #if out code which is only used when ENABLE(LLINT_C_LOOP)
  • interpreter/JSStack.cpp:

(JSC::JSStack::lowAddress):
(JSC::JSStack::highAddress):
(JSC::JSStack::committedByteCount):

  • interpreter/JSStack.h:

(JSC::JSStack::containsAddress):
(JSC::JSStack::lowAddress):

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

Legend:

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

    r160980 r160981  
     12013-12-22  Mark Lam  <mark.lam@apple.com>
     2
     3        CStack: Fixed some JSStack on C Stack boundary computations.
     4        https://bugs.webkit.org/show_bug.cgi?id=126139.
     5
     6        Not yet reviewed.
     7
     8        1. Implement committedByteCount() for JSStack on the C stack using the
     9           current stack usage as an estimate of committed stack memory.
     10        2. Implement lowAddress() and highAddress() for JSStack on the C stack
     11           for containsAddress(). lowAddress() will be the top of the JS stack.
     12           highAddress() will be 1 past the end of the JS stack.
     13        3. Moved some functions around in preparation for an upcoming patch to
     14           #if out code which is only used when ENABLE(LLINT_C_LOOP)
     15
     16        * interpreter/JSStack.cpp:
     17        (JSC::JSStack::lowAddress):
     18        (JSC::JSStack::highAddress):
     19        (JSC::JSStack::committedByteCount):
     20        * interpreter/JSStack.h:
     21        (JSC::JSStack::containsAddress):
     22        (JSC::JSStack::lowAddress):
     23
    1242013-12-22  Filip Pizlo  <fpizlo@apple.com>
    225
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp

    r160967 r160981  
    143143}
    144144
    145 size_t JSStack::committedByteCount()
    146 {
    147     MutexLocker locker(stackStatisticsMutex());
    148     return committedBytesCount;
    149 }
    150 
    151145void JSStack::addToCommittedByteCount(long byteCount)
    152146{
     
    177171}
    178172
     173#if !ENABLE(LLINT_C_LOOP)
     174Register* JSStack::lowAddress() const
     175{
     176    ASSERT(wtfThreadData().stack().isGrowingDownward());
     177    return reinterpret_cast<Register*>(m_vm.jsStackLimit());
     178}
     179
     180Register* JSStack::highAddress() const
     181{
     182    ASSERT(wtfThreadData().stack().isGrowingDownward());
     183    return reinterpret_cast<Register*>(wtfThreadData().stack().origin());
     184}
     185#endif // !ENABLE(LLINT_C_LOOP)
     186
     187size_t JSStack::committedByteCount()
     188{
     189#if ENABLE(LLINT_C_LOOP)
     190    MutexLocker locker(stackStatisticsMutex());
     191    return committedBytesCount;
     192#else
     193    // When using the C stack, we don't know how many stack pages are actually
     194    // committed. So, we use the current stack usage as an estimate.
     195    ASSERT(wtfThreadData().stack().isGrowingDownward());
     196    int8_t* current = reinterpret_cast<int8_t*>(&current);
     197    int8_t* high = reinterpret_cast<int8_t*>(wtfThreadData().stack().origin());
     198    return high - current;
     199#endif
     200}
     201
    179202void JSStack::updateStackLimit()
    180203{
  • branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.h

    r160967 r160981  
    8686        void updateStackLimit();
    8787
     88        bool containsAddress(Register* address) { return (lowAddress() <= address && address < highAddress()); }
     89        static size_t committedByteCount();
     90
    8891        void gatherConservativeRoots(ConservativeRoots&);
    8992        void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&);
     
    97100        size_t size() const { return highAddress() - lowAddress(); }
    98101
    99         static size_t committedByteCount();
    100102        static void initializeThreading();
    101103
     
    105107
    106108        void popFrame(CallFrame*);
    107 
    108         bool containsAddress(Register* address) { return (lowAddress() <= address && address <= highAddress()); }
    109109
    110110#if ENABLE(DEBUG_JSSTACK)
     
    123123        inline Register* topOfStackForCapacityCheck();
    124124
     125#if ENABLE(LLINT_C_LOOP)
    125126        Register* lowAddress() const
    126127        {
    127             return m_end;
     128            return m_end + 1;
    128129        }
    129130
     
    132133            return reinterpret_cast_ptr<Register*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
    133134        }
     135#else
     136        Register* lowAddress() const;
     137        Register* highAddress() const;
     138#endif // ENABLE(LLINT_C_LOOP)
    134139
    135140        Register* reservationEnd() const
Note: See TracChangeset for help on using the changeset viewer.