Changeset 38101 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Nov 4, 2008, 10:57:01 AM (17 years ago)
Author:
Darin Adler
Message:

2008-11-03 Darin Adler <Darin Adler>

Reviewed by Tim Hatcher.

  • JavaScriptCore.exp: Changed to export functions rather than a global for the atomically initialized static mutex.
  • JavaScriptCore.xcodeproj/project.pbxproj: Added a script phase that runs the check-for-exit-time-destructors script.
  • wtf/MainThread.cpp: (WTF::mainThreadFunctionQueueMutex): Changed to leak an object rather than using an exit time destructor. (WTF::functionQueue): Ditto.
  • wtf/unicode/icu/CollatorICU.cpp: (WTF::cachedCollatorMutex): Ditto.
  • wtf/Threading.h: Changed other platforms to share the Windows approach where the mutex is internal and the functions are exported.
  • wtf/ThreadingGtk.cpp: (WTF::lockAtomicallyInitializedStaticMutex): Ditto. (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
  • wtf/ThreadingNone.cpp: (WTF::lockAtomicallyInitializedStaticMutex): Ditto. (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
  • wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): Changed to leak an object rather than using an exit time destructor. (WTF::lockAtomicallyInitializedStaticMutex): Mutex change. (WTF::unlockAtomicallyInitializedStaticMutex): Ditto. (WTF::threadMap): Changed to leak an object rather than using an exit time destructor.
  • wtf/ThreadingQt.cpp: (WTF::lockAtomicallyInitializedStaticMutex): Mutex change. (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
  • wtf/ThreadingWin.cpp: (WTF::lockAtomicallyInitializedStaticMutex): Added an assertion.
Location:
trunk/JavaScriptCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r38096 r38101  
     12008-11-03  Darin Adler  <[email protected]>
     2
     3        Reviewed by Tim Hatcher.
     4
     5        - https://bugs.webkit.org/show_bug.cgi?id=22061
     6          create script to check for exit-time destructors
     7
     8        * JavaScriptCore.exp: Changed to export functions rather than
     9        a global for the atomically initialized static mutex.
     10
     11        * JavaScriptCore.xcodeproj/project.pbxproj: Added a script
     12        phase that runs the check-for-exit-time-destructors script.
     13
     14        * wtf/MainThread.cpp:
     15        (WTF::mainThreadFunctionQueueMutex): Changed to leak an object
     16        rather than using an exit time destructor.
     17        (WTF::functionQueue): Ditto.
     18        * wtf/unicode/icu/CollatorICU.cpp:
     19        (WTF::cachedCollatorMutex): Ditto.
     20
     21        * wtf/Threading.h: Changed other platforms to share the Windows
     22        approach where the mutex is internal and the functions are exported.
     23        * wtf/ThreadingGtk.cpp:
     24        (WTF::lockAtomicallyInitializedStaticMutex): Ditto.
     25        (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
     26        * wtf/ThreadingNone.cpp:
     27        (WTF::lockAtomicallyInitializedStaticMutex): Ditto.
     28        (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
     29        * wtf/ThreadingPthreads.cpp:
     30        (WTF::threadMapMutex): Changed to leak an object rather than using
     31        an exit time destructor.
     32        (WTF::lockAtomicallyInitializedStaticMutex): Mutex change.
     33        (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
     34        (WTF::threadMap): Changed to leak an object rather than using
     35        an exit time destructor.
     36        * wtf/ThreadingQt.cpp:
     37        (WTF::lockAtomicallyInitializedStaticMutex): Mutex change.
     38        (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
     39        * wtf/ThreadingWin.cpp:
     40        (WTF::lockAtomicallyInitializedStaticMutex): Added an assertion.
     41
    1422008-11-04  Adam Roben  <[email protected]>
    243
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r38060 r38101  
    290290__ZN3WTF27releaseFastMallocFreeMemoryEv
    291291__ZN3WTF28setMainThreadCallbacksPausedEb
    292 __ZN3WTF32atomicallyInitializedStaticMutexE
     292__ZN3WTF36lockAtomicallyInitializedStaticMutexEv
     293__ZN3WTF38unlockAtomicallyInitializedStaticMutexEv
    293294__ZN3WTF5Mutex4lockEv
    294295__ZN3WTF5Mutex6unlockEv
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r38095 r38101  
    16181618                                932F5B910822A1C700736975 /* Sources */,
    16191619                                9319586B09D9F91A00A56FD4 /* Check For Global Initializers */,
     1620                                933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */,
    16201621                                5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables */,
    16211622                                932F5BD20822A1C700736975 /* Frameworks */,
     
    18071808                        shellPath = /bin/sh;
    18081809                        shellScript = "if [ -f ../WebKitTools/Scripts/check-for-global-initializers ]; then\n    ../WebKitTools/Scripts/check-for-global-initializers || exit $?\nfi";
     1810                };
     1811                933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */ = {
     1812                        isa = PBXShellScriptBuildPhase;
     1813                        buildActionMask = 2147483647;
     1814                        files = (
     1815                        );
     1816                        inputPaths = (
     1817                        );
     1818                        name = "Check For Exit Time Destructors";
     1819                        outputPaths = (
     1820                        );
     1821                        runOnlyForDeploymentPostprocessing = 0;
     1822                        shellPath = /bin/sh;
     1823                        shellScript = "if [ -f ../WebKitTools/Scripts/check-for-exit-time-destructors ]; then\n    ../WebKitTools/Scripts/check-for-exit-time-destructors || exit $?\nfi";
    18091824                };
    18101825/* End PBXShellScriptBuildPhase section */
  • trunk/JavaScriptCore/wtf/MainThread.cpp

    r36056 r38101  
    5050typedef Vector<FunctionWithContext> FunctionQueue;
    5151
    52 static bool callbacksPaused; // This global varialble is only accessed from main thread.
     52static bool callbacksPaused; // This global variable is only accessed from main thread.
    5353
    5454Mutex& mainThreadFunctionQueueMutex()
    5555{
    56     static Mutex staticMutex;
     56    static Mutex& staticMutex = *new Mutex;
    5757    return staticMutex;
    5858}
     
    6060static FunctionQueue& functionQueue()
    6161{
    62     static FunctionQueue staticFunctionQueue;
     62    static FunctionQueue& staticFunctionQueue = *new FunctionQueue;
    6363    return staticFunctionQueue;
    6464}
  • trunk/JavaScriptCore/wtf/Threading.h

    r38053 r38101  
    252252void initializeThreading();
    253253
    254 #if !PLATFORM(WIN_OS) || PLATFORM(WX)
    255 extern Mutex* atomicallyInitializedStaticMutex;
    256 inline void lockAtomicallyInitializedStaticMutex() { atomicallyInitializedStaticMutex->lock(); }
    257 inline void unlockAtomicallyInitializedStaticMutex() { atomicallyInitializedStaticMutex->unlock(); }
    258 #else
    259254void lockAtomicallyInitializedStaticMutex();
    260255void unlockAtomicallyInitializedStaticMutex();
    261 #endif
    262256
    263257} // namespace WTF
  • trunk/JavaScriptCore/wtf/ThreadingGtk.cpp

    r37732 r38101  
    4141namespace WTF {
    4242
    43 Mutex* atomicallyInitializedStaticMutex;
     43static Mutex* atomicallyInitializedStaticMutex;
    4444
    4545static ThreadIdentifier mainThreadIdentifier;
     
    6464        initializeMainThread();
    6565    }
     66}
     67
     68void lockAtomicallyInitializedStaticMutex()
     69{
     70    ASSERT(atomicallyInitializedStaticMutex);
     71    atomicallyInitializedStaticMutex->lock();
     72}
     73
     74void unlockAtomicallyInitializedStaticMutex()
     75{
     76    atomicallyInitializedStaticMutex->unlock();
    6677}
    6778
  • trunk/JavaScriptCore/wtf/ThreadingNone.cpp

    r35419 r38101  
    2727 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828 */
     29
    2930#include "config.h"
    3031#include "Threading.h"
    3132
    3233namespace WTF {
    33 
    34 Mutex* atomicallyInitializedStaticMutex;
    3534
    3635void initializeThreading() {}
     
    4544void Mutex::lock() {}
    4645bool Mutex::tryLock() { return false; }
    47 void Mutex::unlock() {};
     46void Mutex::unlock() {}
    4847
    4948ThreadCondition::ThreadCondition() {}
     
    5453void ThreadCondition::broadcast() {}
    5554
     55void lockAtomicallyInitializedStaticMutex() {}
     56void unlockAtomicallyInitializedStaticMutex() { }
     57
    5658} // namespace WebCore
  • trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp

    r37732 r38101  
    4141namespace WTF {
    4242
    43 Mutex* atomicallyInitializedStaticMutex;
     43static Mutex* atomicallyInitializedStaticMutex;
    4444
    4545#if !PLATFORM(DARWIN)
     
    4949static Mutex& threadMapMutex()
    5050{
    51     static Mutex mutex;
     51    static Mutex& mutex = *new Mutex;
    5252    return mutex;
    5353}
     
    6666}
    6767
     68void lockAtomicallyInitializedStaticMutex()
     69{
     70    ASSERT(atomicallyInitializedStaticMutex);
     71    atomicallyInitializedStaticMutex->lock();
     72}
     73
     74void unlockAtomicallyInitializedStaticMutex()
     75{
     76    atomicallyInitializedStaticMutex->unlock();
     77}
     78
    6879static HashMap<ThreadIdentifier, pthread_t>& threadMap()
    6980{
    70     static HashMap<ThreadIdentifier, pthread_t> map;
     81    static HashMap<ThreadIdentifier, pthread_t>& map = *new HashMap<ThreadIdentifier, pthread_t>;
    7182    return map;
    7283}
  • trunk/JavaScriptCore/wtf/ThreadingQt.cpp

    r37040 r38101  
    6565
    6666
    67 Mutex* atomicallyInitializedStaticMutex;
     67static Mutex* atomicallyInitializedStaticMutex;
    6868
    6969static ThreadIdentifier mainThreadIdentifier;
     
    123123void initializeThreading()
    124124{
    125     if(!atomicallyInitializedStaticMutex) {
     125    if (!atomicallyInitializedStaticMutex) {
    126126        atomicallyInitializedStaticMutex = new Mutex;
    127127        threadMapMutex();
     
    135135}
    136136
     137void lockAtomicallyInitializedStaticMutex()
     138{
     139    ASSERT(atomicallyInitializedStaticMutex);
     140    atomicallyInitializedStaticMutex->lock();
     141}
     142
     143void unlockAtomicallyInitializedStaticMutex()
     144{
     145    atomicallyInitializedStaticMutex->unlock();
     146}
     147
    137148ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char*)
    138149{
  • trunk/JavaScriptCore/wtf/ThreadingWin.cpp

    r37990 r38101  
    112112void lockAtomicallyInitializedStaticMutex()
    113113{
     114    ASSERT(atomicallyInitializedStaticMutex);
    114115    atomicallyInitializedStaticMutex->lock();
    115116}
  • trunk/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp

    r31575 r38101  
    4646static Mutex& cachedCollatorMutex()
    4747{
    48     AtomicallyInitializedStatic(Mutex, mutex);
     48    AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
    4949    return mutex;
    5050}
Note: See TracChangeset for help on using the changeset viewer.