Changeset 20351 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Mar 20, 2007, 4:57:01 PM (18 years ago)
Author:
mjs
Message:

Reviewed by Geoff and Adam.



  • fixed a threadsafety bug discovered by testing this


  • enhanced threadsafety assertions in collector
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::~JSCallbackObject): This destructor can't DropAllLocks around the finalize callback, because it gets called from garbage collection and we can't let other threads collect!
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • kjs/JSLock.cpp: (KJS::JSLock::currentThreadIsHoldingLock): Added new function to allow stronger assertions than just that the lock is held by some thread (you can now assert that the current thread is holding it, given the new JSLock design).
  • kjs/JSLock.h:
  • kjs/collector.cpp: Refactored for portability plus added some stronger assertions. (KJS::Collector::allocate): (KJS::currentThreadStackBase): (KJS::Collector::registerAsMainThread): (KJS::onMainThread): (KJS::PlatformThread::PlatformThread): (KJS::getCurrentPlatformThread): (KJS::Collector::Thread::Thread): (KJS::destroyRegisteredThread): (KJS::Collector::registerThread): (KJS::Collector::markCurrentThreadConservatively): (KJS::suspendThread): (KJS::resumeThread): (KJS::getPlatformThreadRegisters): (KJS::otherThreadStackPointer): (KJS::otherThreadStackBase): (KJS::Collector::markOtherThreadConservatively): (KJS::Collector::markStackObjectsConservatively): (KJS::Collector::protect): (KJS::Collector::unprotect): (KJS::Collector::collectOnMainThreadOnly): (KJS::Collector::markMainThreadOnlyObjects): (KJS::Collector::collect):
  • kjs/collector.h:
  • wtf/FastMalloc.cpp: (WTF::fastMallocSetIsMultiThreaded):
  • wtf/FastMallocInternal.h:
  • wtf/Platform.h:
Location:
trunk/JavaScriptCore/wtf
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r20229 r20351  
    6767
    6868#include "Assertions.h"
     69#if USE(MULTIPLE_THREADS)
     70#include <pthread.h>
     71#endif
    6972
    7073#ifndef USE_SYSTEM_MALLOC
     
    160163}
    161164
    162 #if !PLATFORM(WIN_OS)
    163165void fastMallocSetIsMultiThreaded()
    164166{
    165167}
    166 #endif
    167168
    168169} // namespace WTF
  • trunk/JavaScriptCore/wtf/FastMallocInternal.h

    r19209 r20351  
    2424#define WTF_FastMallocInternal_h
    2525
    26 #if !PLATFORM(WIN_OS)
    27 
    28 #include <pthread.h>
    29 
    3026namespace WTF {
    3127    // Clients must call this function before allocating memory on a secondary thread.
     
    3329}
    3430
    35 #endif
    36 
    3731#endif //  WTF_FastMallocInternal_h
  • trunk/JavaScriptCore/wtf/Platform.h

    r19855 r20351  
    173173
    174174/* multiple threads only supported on Mac for now */
    175 #if PLATFORM(MAC)
     175#if PLATFORM(MAC) || PLATFORM(WIN)
    176176#define WTF_USE_MULTIPLE_THREADS 1
    177177#endif
Note: See TracChangeset for help on using the changeset viewer.