Reviewed by Geoff.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Sep 2005 06:57:28 +0000 (06:57 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Sep 2005 06:57:28 +0000 (06:57 +0000)
commitf915edf43ebb0c517550ed94c6d9a72b895ebce2
tree94bec94f1fe1bc26255e38b246d721aad2c5c866
parent1b62c723e5348ff6a283f0bc71bc3e34d7a4926b
    Reviewed by Geoff.

- fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)

Make sure to lock using the InterpreterLock class in all places that need it
(including anything that uses the collector, the parser, the protect count hash table,
and anything that allocates via fast_malloc).

Also added assertions to ensure that the locking rules are followed for the relevant
resources.

        * Makefile.am:
        * bindings/NP_jsobject.cpp:
        (identifierFromNPIdentifier):
        (_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:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
        * bindings/runtime.cpp:
        (Instance::createRuntimeObject):
        * bindings/runtime_root.h:
        * bindings/testbindings.cpp:
        (main):
        * bindings/testbindings.mm:
        (main):
        * kjs/fast_malloc.cpp:
        (KJS::kjs_fast_malloc):
        (KJS::kjs_fast_calloc):
        (KJS::kjs_fast_free):
        (KJS::kjs_fast_realloc):
        * kjs/fast_malloc.h:
        * kjs/identifier.h:
        * kjs/internal.cpp:
        (InterpreterImp::InterpreterImp):
        (InterpreterImp::clear):
        (InterpreterImp::mark):
        (InterpreterImp::checkSyntax):
        (InterpreterImp::evaluate):
        * kjs/internal.h:
        (KJS::InterpreterImp::globalObject):
        * kjs/interpreter.cpp:
        (Interpreter::evaluate):
        * kjs/interpreter.h:
        (KJS::InterpreterLock::InterpreterLock):
        (KJS::InterpreterLock::~InterpreterLock):
        * kjs/nodes.h:
        * kjs/protect.h:
        (KJS::ProtectedValue::ProtectedValue):
        (KJS::ProtectedValue::~ProtectedValue):
        (KJS::ProtectedValue::operator=):
        (KJS::ProtectedObject::ProtectedObject):
        (KJS::ProtectedObject::~ProtectedObject):
        (KJS::ProtectedObject::operator=):
        (KJS::ProtectedReference::ProtectedReference):
        (KJS::ProtectedReference::~ProtectedReference):
        (KJS::ProtectedReference::operator=):
        * kjs/protected_object.h:
        * kjs/protected_values.cpp:
        (KJS::ProtectedValues::getProtectCount):
        (KJS::ProtectedValues::increaseProtectCount):
        (KJS::ProtectedValues::decreaseProtectCount):
        * kjs/string_object.cpp:
        (StringObjectImp::StringObjectImp):
        * kjs/testkjs.cpp:
        (main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/bindings/NP_jsobject.cpp
JavaScriptCore/bindings/jni/jni_jsobject.cpp
JavaScriptCore/bindings/objc/WebScriptObject.mm
JavaScriptCore/bindings/runtime.cpp
JavaScriptCore/bindings/runtime_root.h
JavaScriptCore/bindings/testbindings.cpp
JavaScriptCore/bindings/testbindings.mm
JavaScriptCore/kjs/fast_malloc.cpp
JavaScriptCore/kjs/identifier.h
JavaScriptCore/kjs/internal.cpp
JavaScriptCore/kjs/internal.h
JavaScriptCore/kjs/interpreter.cpp
JavaScriptCore/kjs/interpreter.h
JavaScriptCore/kjs/nodes.h
JavaScriptCore/kjs/property_map.cpp
JavaScriptCore/kjs/protect.h
JavaScriptCore/kjs/protected_object.h [deleted file]
JavaScriptCore/kjs/protected_values.cpp
JavaScriptCore/kjs/reference.h
JavaScriptCore/kjs/reference_list.cpp
JavaScriptCore/kjs/string_object.cpp
JavaScriptCore/kjs/testkjs.cpp