Ignore:
Timestamp:
Nov 22, 2005, 9:41:23 PM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Geoff.

<rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used

Also factored locking code completely into a separate class, and
added a convenient packaged way to temporarily drop locks.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • kjs/JSLock.cpp: Added. (KJS::initializeInterpreterLock): (KJS::InterpreterLock::lock): (KJS::InterpreterLock::unlock): (KJS::InterpreterLock::lockCount): (KJS::InterpreterLock::DropAllLocks::DropAllLocks): (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
  • kjs/JSLock.h: Added. (KJS::InterpreterLock::InterpreterLock): (KJS::InterpreterLock::~InterpreterLock):
  • kjs/internal.cpp:
  • kjs/internal.h:
  • kjs/interpreter.cpp:
  • kjs/interpreter.h:
  • kjs/protect.h:
  • kjs/testkjs.cpp: (TestFunctionImp::callAsFunction):

WebCore:

Reviewed by Geoff.

<rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used

  • khtml/ecma/kjs_events.cpp: (KJS::JSLazyEventListener::parseCode):
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::send):
  • kwq/WebCoreJavaScript.mm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/internal.cpp

    r11213 r11284  
    7474 
    7575#endif // APPLE_CHANGES
    76 
    77 #if defined(KJS_MULTIPLE_THREADS) && KJS_MULTIPLE_THREADS
    78 
    79 static pthread_once_t interpreterLockOnce = PTHREAD_ONCE_INIT;
    80 static pthread_mutex_t interpreterLock;
    81 static int interpreterLockCount = 0;
    82 
    83 static void initializeInterpreterLock()
    84 {
    85   pthread_mutexattr_t attr;
    86 
    87   pthread_mutexattr_init(&attr);
    88   pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
    89 
    90   pthread_mutex_init(&interpreterLock, &attr);
    91 }
    92 
    93 static inline void lockInterpreter()
    94 {
    95   pthread_once(&interpreterLockOnce, initializeInterpreterLock);
    96   pthread_mutex_lock(&interpreterLock);
    97   interpreterLockCount++;
    98   Collector::registerThread();
    99 }
    100 
    101 static inline void unlockInterpreter()
    102 {
    103   interpreterLockCount--;
    104   pthread_mutex_unlock(&interpreterLock);
    105 }
    106 
    107 #else
    108 
    109 static inline void initializeInterpreterLock() { }
    110 static inline void lockInterpreter() { }
    111 static inline void unlockInterpreter() { }
    112 
    113 const int interpreterLockCount = 1;
    114 
    115 #endif
    11676
    11777// ------------------------------ UndefinedImp ---------------------------------
     
    472432
    473433  recursion = 0;
    474 }
    475 
    476 void InterpreterImp::lock()
    477 {
    478   lockInterpreter();
    479 
    480   // FIXME: Hack-o-rama. To prevent construction of a global object with a null prototype (4342216),
    481   // we need to intialize our constants before the first object is constructed. InterpreterImp::lock()
    482   // is a good place to do this because you have to call it before doing any allocations. Once we change our
    483   // implementation to use immediate values, we should remove this code.
    484   ConstantValues::initIfNeeded();
    485 }
    486 
    487 int InterpreterImp::lockCount()
    488 {
    489   return interpreterLockCount;
    490 }
    491 
    492 void InterpreterImp::unlock()
    493 {
    494   unlockInterpreter();
    495434}
    496435
Note: See TracChangeset for help on using the changeset viewer.