Changeset 34990 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 3, 2008, 4:22:06 PM (17 years ago)
Author:
[email protected]
Message:

Fix the 64-bit build.

Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34985 r34990  
     12008-07-02  Mark Rowe  <[email protected]>
     2
     3        Fix the 64-bit build.  pthread_getspecific works with pointer-sized values,
     4        so use ssize_t rather than int to track the lock count to avoid warnings about
     5        truncating the result of pthread_getspecific.
     6
     7        * kjs/JSLock.cpp:
     8        (KJS::JSLock::lockCount):
     9        (KJS::JSLock::lock):
     10        (KJS::JSLock::unlock):
     11        (KJS::JSLock::DropAllLocks::DropAllLocks):
     12        * kjs/JSLock.h:
     13
    1142008-07-03  Geoffrey Garen  <[email protected]>
    215
  • trunk/JavaScriptCore/kjs/JSLock.cpp

    r34954 r34990  
    4949
    5050// Lock nesting count.
    51 int JSLock::lockCount()
    52 {
    53     pthread_once(&createJSLockCountOnce, createJSLockCount);
    54 
    55     return reinterpret_cast<int>(pthread_getspecific(JSLockCount));
    56 }
    57 
    58 static void setLockCount(int count)
    59 {
     51ssize_t JSLock::lockCount()
     52{
     53    pthread_once(&createJSLockCountOnce, createJSLockCount);
     54
     55    return reinterpret_cast<ssize_t>(pthread_getspecific(JSLockCount));
     56}
     57
     58static void setLockCount(ssize_t count)
     59{
     60    ASSERT(count >= 0);
    6061    pthread_setspecific(JSLockCount, reinterpret_cast<void*>(count));
    6162}
     
    7980    pthread_once(&createJSLockCountOnce, createJSLockCount);
    8081
    81     int currentLockCount = lockCount();
     82    ssize_t currentLockCount = lockCount();
    8283    if (!currentLockCount && lockForReal) {
    8384        int result;
     
    9899#endif
    99100
    100     int newLockCount = lockCount() - 1;
     101    ssize_t newLockCount = lockCount() - 1;
    101102    setLockCount(newLockCount);
    102103    if (!newLockCount && lockForReal) {
     
    134135
    135136    m_lockCount = JSLock::lockCount();
    136     for (int i = 0; i < m_lockCount; i++)
     137    for (ssize_t i = 0; i < m_lockCount; i++)
    137138        JSLock::unlock(m_lockingForReal);
    138139}
     
    147148
    148149    m_lockCount = JSLock::lockCount();
    149     for (int i = 0; i < m_lockCount; i++)
     150    for (ssize_t i = 0; i < m_lockCount; i++)
    150151        JSLock::unlock(m_lockingForReal);
    151152}
     
    153154JSLock::DropAllLocks::~DropAllLocks()
    154155{
    155     for (int i = 0; i < m_lockCount; i++)
     156    for (ssize_t i = 0; i < m_lockCount; i++)
    156157        JSLock::lock(m_lockingForReal);
    157158}
     
    166167// If threading support is off, set the lock count to a constant value of 1 so assertions
    167168// that the lock is held don't fail
    168 int JSLock::lockCount()
     169ssize_t JSLock::lockCount()
    169170{
    170171    return 1;
  • trunk/JavaScriptCore/kjs/JSLock.h

    r34947 r34990  
    8585        static void unlock(ExecState*);
    8686
    87         static int lockCount();
     87        static ssize_t lockCount();
    8888        static bool currentThreadIsHoldingLock();
    8989
     
    9999           
    100100        private:
    101             int m_lockCount;
     101            ssize_t m_lockCount;
    102102            bool m_lockingForReal;
    103103        };
Note: See TracChangeset for help on using the changeset viewer.