Changeset 11304 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Nov 26, 2005, 11:54:53 PM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Rubber stamped by Eric.

  • renamed InterpreterLock to JSLock
  • bindings/NP_jsobject.cpp: (_NPN_Invoke): (_NPN_Evaluate): (_NPN_GetProperty): (_NPN_SetProperty): (_NPN_RemoveProperty): (_NPN_HasProperty): (_NPN_HasMethod): (_NPN_SetException):
  • bindings/jni/jni_jsobject.cpp: (JSObject::call): (JSObject::eval): (JSObject::getMember): (JSObject::setMember): (JSObject::removeMember): (JSObject::getSlot): (JSObject::setSlot): (JSObject::toString): (JSObject::convertJObjectToValue):
  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject removeWebScriptKey:]): (-[WebScriptObject stringRepresentation]): (-[WebScriptObject webScriptValueAtIndex:]): (-[WebScriptObject setWebScriptValueAtIndex:value:]): (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
  • bindings/runtime.cpp: (Instance::createRuntimeObject):
  • bindings/runtime_root.cpp: (KJS::Bindings::addNativeReference): (KJS::Bindings::removeNativeReference): (RootObject::removeAllNativeReferences):
  • bindings/runtime_root.h: (KJS::Bindings::RootObject::~RootObject): (KJS::Bindings::RootObject::setRootObjectImp):
  • bindings/testbindings.cpp: (main):
  • bindings/testbindings.mm: (main):
  • kjs/JSLock.cpp: (KJS::initializeJSLock): (KJS::JSLock::lock): (KJS::JSLock::unlock): (KJS::JSLock::lockCount): (KJS::JSLock::DropAllLocks::DropAllLocks): (KJS::JSLock::DropAllLocks::~DropAllLocks):
  • kjs/JSLock.h: (KJS::JSLock::JSLock): (KJS::JSLock::~JSLock):
  • kjs/collector.cpp: (KJS::Collector::allocate): (KJS::Collector::collect):
  • kjs/internal.cpp: (KJS::InterpreterImp::InterpreterImp): (KJS::InterpreterImp::clear): (KJS::InterpreterImp::checkSyntax): (KJS::InterpreterImp::evaluate):
  • kjs/interpreter.cpp: (Interpreter::evaluate):
  • kjs/protect.h: (KJS::::ProtectedPtr): (KJS::::~ProtectedPtr): (KJS::::operator):
  • kjs/protected_reference.h: (KJS::ProtectedReference::ProtectedReference): (KJS::ProtectedReference::~ProtectedReference): (KJS::ProtectedReference::operator=):
  • kjs/protected_values.cpp: (KJS::ProtectedValues::getProtectCount): (KJS::ProtectedValues::increaseProtectCount): (KJS::ProtectedValues::decreaseProtectCount):
  • kjs/testkjs.cpp: (TestFunctionImp::callAsFunction): (main):

WebCore:

Rubber stamped by Eric.

  • renamed InterpreterLock to JSLock
  • khtml/ecma/kjs_events.cpp: (KJS::JSAbstractEventListener::handleEvent): (KJS::JSLazyEventListener::parseCode): (KJS::getDOMEvent):
  • khtml/ecma/kjs_proxy.cpp: (KJSProxyImpl::~KJSProxyImpl): (KJSProxyImpl::evaluate): (KJSProxyImpl::createHTMLEventHandler): (KJSProxyImpl::initScript):
  • khtml/ecma/kjs_traversal.cpp: (KJS::JSNodeFilterCondition::acceptNode):
  • khtml/ecma/kjs_window.cpp: (KJS::Window::clear): (KJS::ScheduledAction::execute):
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::send): (KJS::XMLHttpRequest::abort): (KJS::XMLHttpRequest::slotFinished):
  • kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::bindingRootObject): (KWQKHTMLPart::windowScriptObject): (KWQKHTMLPart::saveLocationProperties): (KWQKHTMLPart::restoreLocationProperties): (KWQKHTMLPart::openURLFromPageCache): (KWQKHTMLPart::cleanupPluginRootObjects):
  • kwq/KWQPageState.mm: (-[KWQPageState clear]):
  • kwq/WebCoreBridge.mm: (-[WebCoreBridge saveDocumentToPageCache]):
  • kwq/WebCoreJavaScript.mm: (+[WebCoreJavaScript rootObjectClasses]): (+[WebCoreJavaScript garbageCollect]):
  • kwq/WebCoreScriptDebugger.mm: (-[WebCoreScriptCallFrame evaluateWebScript:]):
Location:
trunk/JavaScriptCore/kjs
Files:
9 edited

Legend:

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

    r11284 r11304  
    3434static int interpreterLockCount = 0;
    3535
    36 static void initializeInterpreterLock()
     36static void initializeJSLock()
    3737{
    3838  pthread_mutexattr_t attr;
     
    4444}
    4545
    46 void InterpreterLock::lock()
     46void JSLock::lock()
    4747{
    48   pthread_once(&interpreterLockOnce, initializeInterpreterLock);
     48  pthread_once(&interpreterLockOnce, initializeJSLock);
    4949  pthread_mutex_lock(&interpreterLock);
    5050  interpreterLockCount++;
     
    5858}
    5959
    60 void InterpreterLock::unlock()
     60void JSLock::unlock()
    6161{
    6262  interpreterLockCount--;
     
    7070const int interpreterLockCount = 1;
    7171
    72 void InterpreterLock::lock()
     72void JSLock::lock()
    7373{
    7474}
    7575
    76 void InterpreterLock::unlock()
     76void JSLock::unlock()
    7777{
    7878}
     
    8080#endif
    8181
    82 int InterpreterLock::lockCount()
     82int JSLock::lockCount()
    8383{
    8484    return interpreterLockCount;
    8585}
    8686       
    87 InterpreterLock::DropAllLocks::DropAllLocks()
     87JSLock::DropAllLocks::DropAllLocks()
    8888{
    89     int lockCount = InterpreterLock::lockCount();
     89    int lockCount = JSLock::lockCount();
    9090    for (int i = 0; i < lockCount; i++) {
    91         InterpreterLock::unlock();
     91        JSLock::unlock();
    9292    }
    9393    m_lockCount = lockCount;
    9494}
    9595
    96 InterpreterLock::DropAllLocks::~DropAllLocks()
     96JSLock::DropAllLocks::~DropAllLocks()
    9797{
    9898    int lockCount = m_lockCount;
    9999    for (int i = 0; i < lockCount; i++) {
    100         InterpreterLock::lock();
     100        JSLock::lock();
    101101    }
    102102}
  • trunk/JavaScriptCore/kjs/JSLock.h

    r11284 r11304  
    3030    // garbage-collected object or which may affect other shared state
    3131    // such as the protect count hash table. The simplest way to do
    32     // this is by having a local InterpreterLock object for the scope
     32    // this is by having a local JSLock object for the scope
    3333    // where the lock must be held. The lock is recursive so nesting
    3434    // is ok.
     
    3939    // code that doesn't require the lock, and reacquire the right
    4040    // number of locks at the end. You can do this by constructing a
    41     // locally scoped InterpreterLock::DropAllLocks object.
     41    // locally scoped JSLock::DropAllLocks object.
    4242
    43     class InterpreterLock
     43    class JSLock
    4444    {
    4545    public:
    46         InterpreterLock()
     46        JSLock()
    4747        {
    4848            lock();
    4949        }
    50         ~InterpreterLock() {
     50        ~JSLock() {
    5151            unlock();
    5252        }
     
    6868       
    6969    private:
    70         InterpreterLock(const InterpreterLock&);
    71         InterpreterLock& operator=(const InterpreterLock&);
     70        JSLock(const JSLock&);
     71        JSLock& operator=(const JSLock&);
    7272    };
    7373
  • trunk/JavaScriptCore/kjs/collector.cpp

    r11284 r11304  
    107107void* Collector::allocate(size_t s)
    108108{
    109   assert(InterpreterLock::lockCount() > 0);
     109  assert(JSLock::lockCount() > 0);
    110110
    111111  // collect if needed
     
    394394bool Collector::collect()
    395395{
    396   assert(InterpreterLock::lockCount() > 0);
     396  assert(JSLock::lockCount() > 0);
    397397
    398398  if (InterpreterImp::s_hook) {
  • trunk/JavaScriptCore/kjs/internal.cpp

    r11284 r11304  
    409409  // add this interpreter to the global chain
    410410  // as a root set for garbage collection
    411   InterpreterLock lock;
     411  JSLock lock;
    412412
    413413  m_interpreter = interp;
     
    564564  //fprintf(stderr,"InterpreterImp::clear\n");
    565565  // remove from global chain (see init())
    566   InterpreterLock lock;
     566  JSLock lock;
    567567
    568568  next->prev = prev;
     
    591591bool InterpreterImp::checkSyntax(const UString &code)
    592592{
    593   InterpreterLock lock;
     593  JSLock lock;
    594594
    595595  // Parser::parse() returns 0 in a syntax error occurs, so we just check for that
     
    600600Completion InterpreterImp::evaluate(const UString &code, ValueImp *thisV, const UString &sourceURL, int startingLineNumber)
    601601{
    602   InterpreterLock lock;
     602  JSLock lock;
    603603
    604604  // prevent against infinite recursion
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r11284 r11304  
    121121#if APPLE_CHANGES
    122122  if (shouldPrintExceptions() && comp.complType() == Throw) {
    123     InterpreterLock lock;
     123    JSLock lock;
    124124    ExecState *exec = rep->globalExec();
    125125    char *f = strdup(sourceURL.ascii());
  • trunk/JavaScriptCore/kjs/protect.h

    r11284 r11304  
    8282    {
    8383        if (ptr) {
    84             InterpreterLock lock;
     84            JSLock lock;
    8585            gcProtect(ptr);
    8686        }
     
    9191    {
    9292        if (T *ptr = m_ptr) {
    93             InterpreterLock lock;
     93            JSLock lock;
    9494            gcProtect(ptr);
    9595        }
     
    9999    {
    100100        if (T *ptr = m_ptr) {
    101             InterpreterLock lock;
     101            JSLock lock;
    102102            gcUnprotect(ptr);
    103103        }
     
    108108    {
    109109        if (T *ptr = m_ptr) {
    110             InterpreterLock lock;
     110            JSLock lock;
    111111            gcProtect(ptr);
    112112        }
     
    115115    template <class T> ProtectedPtr<T> &ProtectedPtr<T>::operator=(const ProtectedPtr<T> &o)
    116116    {
    117         InterpreterLock lock;
     117        JSLock lock;
    118118        T *optr = o.m_ptr;
    119119        gcProtectNullTolerant(optr);
     
    125125    template <class T> inline ProtectedPtr<T> &ProtectedPtr<T>::operator=(T *optr)
    126126    {
    127         InterpreterLock lock;
     127        JSLock lock;
    128128        gcProtectNullTolerant(optr);
    129129        gcUnprotectNullTolerant(m_ptr);
  • trunk/JavaScriptCore/kjs/protected_reference.h

    r10857 r11304  
    3535            : Reference(r)
    3636        {
    37             InterpreterLock lock;
     37            JSLock lock;
    3838            gcProtectNullTolerant(base);
    3939        }
     
    4141        ~ProtectedReference()
    4242        {
    43             InterpreterLock lock;
     43            JSLock lock;
    4444            gcUnprotectNullTolerant(base);
    4545        }
     
    4747        ProtectedReference& operator=(const Reference &r)
    4848        {
    49             InterpreterLock lock;
     49            JSLock lock;
    5050            ValueImp *old = base;
    5151            Reference::operator=(r);
  • trunk/JavaScriptCore/kjs/protected_values.cpp

    r11284 r11304  
    4343{
    4444    assert(k);
    45     assert(InterpreterLock::lockCount() > 0);
     45    assert(JSLock::lockCount() > 0);
    4646
    4747    if (!_table)
     
    7272{
    7373    assert(k);
    74     assert(InterpreterLock::lockCount() > 0);
     74    assert(JSLock::lockCount() > 0);
    7575
    7676    if (SimpleNumber::is(k))
     
    122122{
    123123    assert(k);
    124     assert(InterpreterLock::lockCount() > 0);
     124    assert(JSLock::lockCount() > 0);
    125125
    126126    if (SimpleNumber::is(k))
  • trunk/JavaScriptCore/kjs/testkjs.cpp

    r11284 r11304  
    6565  case GC:
    6666  {
    67     InterpreterLock lock;
     67    JSLock lock;
    6868    Collector::collect();
    6969  }
     
    105105  bool ret = true;
    106106  {
    107     InterpreterLock lock;
     107    JSLock lock;
    108108
    109109    ObjectImp *global(new GlobalImp());
Note: See TracChangeset for help on using the changeset viewer.