[webkit-help] JSCore and multi-threading : WTF/ThreadRestrictionVerifier single-threaded mode default behaviour

Guy Hermann guy.hermann at 4d.com
Fri Nov 16 02:41:56 PST 2012


Hi all,
all that follows is related to WebKit branch 536.26.
We are currently using JSCore/WTF in a multi-threaded environment and are facing an ASSERT (see backtrace below) mainly due to the fact that DateInstanceData inherits from RefCounted which contains a ThreadRestrictionVerifier (which isSafeToUse method returns false in our case).
This ThreadRestrictionVerifier has only one constructor and that constructor sets (by default) its internal mode to SingleThreadVerificationMode: in other words, all the JSCore RefCounted (by inheritance) instances are assumed to work in a single-threaded environment; so JSCore as a whole is by default customized to work in a single-threaded environment.
Q1: Is JSCore able to work in a multi-threaded environment (with an unchanged codebase)?
Q2.1: if Q1 is yes, is there is a way to set all the RefCounted instances created by JSCore multi-thread compatible with only a slight modification of JSCore codebase. Indeed and as far as I can see, one would need to change the mode of all the  instanciated ThreadVerifiers to MutexVerificationMode.
Q2.2: if Q1 is yes, can NoVerificationMode be used in a multi-threaded environment (I don't think so)
thanks for your help

 JavaScriptCore_Debug.dll!WTF::RefCountedBase::derefBase() Line 129 + 0x38 bytes C++
JavaScriptCore_Debug.dll!WTF::RefCounted<JSC::DateInstanceData>::deref() Line 189 + 0x8 bytes C++
JavaScriptCore_Debug.dll!WTF::derefIfNotNull<JSC::DateInstanceData>(JSC::DateInstanceData * ptr=0xffe28f30) Line 53 C++
JavaScriptCore_Debug.dll!WTF::RefPtr<JSC::DateInstanceData>::~RefPtr<JSC::DateInstanceData>() Line 56 + 0x19 bytes C++
JavaScriptCore_Debug.dll!JSC::DateInstance::~DateInstance() + 0x46 bytes C++
> JavaScriptCore_Debug.dll!JSC::DateInstance::destroy(JSC::JSCell * cell=0x11f7d380) Line 59 C++
JavaScriptCore_Debug.dll!JSC::MarkedBlock::callDestructor(JSC::JSCell * cell=0x11f7d380) Line 74 + 0x12 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedBlock::specializedSweep<3,1,1>() Line 101 C++
JavaScriptCore_Debug.dll!JSC::MarkedBlock::sweepHelper<1>(JSC::MarkedBlock::SweepMode sweepMode=SweepToFreeList) Line 142 + 0x12 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedBlock::sweep(JSC::MarkedBlock::SweepMode sweepMode=SweepToFreeList) Line 121 + 0x10 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedAllocator::tryAllocateHelper() Line 33 + 0x10 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedAllocator::tryAllocate() Line 52 + 0x8 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedAllocator::allocateSlowCase() Line 68 + 0x8 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedAllocator::allocate() Line 77 + 0x8 bytes C++
JavaScriptCore_Debug.dll!JSC::MarkedSpace::allocateWithDestructor(unsigned int bytes=0x00000040) Line 160 C++
JavaScriptCore_Debug.dll!JSC::Heap::allocateWithDestructor(unsigned int bytes=0x00000040) Line 355 C++
JavaScriptCore_Debug.dll!JSC::allocateCell<JSC::JSFinalObject>(JSC::Heap & heap={...}) Line 336 + 0xa bytes C++
JavaScriptCore_Debug.dll!JSC::JSFinalObject::create(JSC::ExecState * exec=0x144e0318, JSC::Structure * structure=0x11eef420) Line 395 + 0xe bytes C++
JavaScriptCore_Debug.dll!JSC::constructEmptyObject(JSC::ExecState * exec=0x144e0318, JSC::Structure * structure=0x11eef420) Line 466 + 0xd bytes C++
JavaScriptCore_Debug.dll!JSC::constructEmptyObject(JSC::ExecState * exec=0x144e0318, JSC::JSGlobalObject * globalObject=0x11f0fc40) Line 431 + 0x12 bytes C++
JavaScriptCore_Debug.dll!JSC::constructEmptyObject(JSC::ExecState * exec=0x144e0318) Line 436 + 0x12 bytes C++
JavaScriptCore_Debug.dll!cti_op_new_object(void * * args=0x11a9f580) Line 1382 + 0xc bytes C++
JavaScriptCore_Debug.dll!@cti_op_create_this at 4<mailto:JavaScriptCore_Debug.dll!@cti_op_create_this at 4>() + 0x20f bytes C++
JavaScriptCore_Debug.dll!JSC::JITCode::execute(JSC::RegisterFile * registerFile=0xffda2bdc, JSC::ExecState * callFrame=0x144e0048, JSC::JSGlobalData * globalData=0xffd9b400) Line 127 + 0x2d bytes C++
JavaScriptCore_Debug.dll!JSC::Interpreter::executeCall(JSC::ExecState * callFrame=0x11f0fcb8, JSC::JSObject * function=0x11f7d600, JSC::CallType callType=CallTypeJS, const JSC::CallData & callData={...}, JSC::JSValue thisValue={...}, const JSC::ArgList & args={...}) Line 1342 + 0x2a bytes C++
JavaScriptCore_Debug.dll!JSC::call(JSC::ExecState * exec=0x11f0fcb8, JSC::JSValue functionObject={...}, JSC::CallType callType=CallTypeJS, const JSC::CallData & callData={...}, JSC::JSValue thisValue={...}, const JSC::ArgList & args={...}) Line 67 + 0x3c bytes C++
JavaScriptCore_Debug.dll!JSObjectCallAsFunction(const OpaqueJSContext * ctx=0x11f0fcb8, OpaqueJSValue * object=0x11f7d600, OpaqueJSValue * thisObject=0x11f0fc40, unsigned int argumentCount=0x00000002, const OpaqueJSValue * const * arguments=0x0f615ce8, const OpaqueJSValue * * exception=0x11a9f904) Line 497 + 0x5c bytes C++
4DJavaScriptDebug.dll!xbox::VJSObject::CallFunction(const xbox::VJSObject & inFunctionObject={...}, const std::vector<xbox::VJSValue,std::allocator<xbox::VJSValue> > * inValues=[0x00000002]({fContext=0x11f0fcb8 fValue=0x11f71c40 },{fContext=0x11f0fcb8 fValue=0x11f71c00 }), xbox::VJSValue * outResult=0x11a9facc, const OpaqueJSValue * * outException=0x11a9f9cc, const xbox::VFilePath * inFullPath=0x00000000) Line 470 + 0x30 bytes C++
4DJavaScriptDebug.dll!xbox::VJSObject::CallMemberFunction(const xbox::VString & inFunctionName={...}, const std::vector<xbox::VJSValue,std::allocator<xbox::VJSValue> > * inValues=[0x00000002]({fContext=0x11f0fcb8 fValue=0x11f71c40 },{fContext=0x11f0fcb8 fValue=0x11f71c00 }), xbox::VJSValue * outResult=0x11a9facc, const OpaqueJSValue * * outException=0x11a9f9cc, const xbox::VFilePath * inFullPath=0x00000000) Line 203 + 0x40 bytes C++
Wakanda Server.exe!VRIAJSCallbackGlobalFunction::Call(xbox::VJSContext & inContext={...}, const std::vector<xbox::VJSValue,std::allocator<xbox::VJSValue> > * inParameters=[0x00000002]({fContext=0x11f0fcb8 fValue=0x11f71c40 },{fContext=0x11f0fcb8 fValue=0x11f71c00 }), xbox::VJSValue * outResult=0x11a9facc) Line 1236 + 0x1e bytes C++
Wakanda Server.exe!VJSRequestHandler::HandleRequest(IHTTPResponse * inResponse=0x0f4ac724) Line 116 + 0x28 bytes C++





[cid:5c96d8.png at 90530495.43bf61b6]
Guy Hermann
Développeur Senior
Email : guy.hermann at 4d.com<mailto:guy.hermann at 4d.com>
Web :   www.4D.com<http://www.4D.com>

4D SAS
60, rue d'Alsace
92110 Clichy -
Standard :      +33 1 40 87 92 00




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20121116/67d2e2d4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5c96d8.png
Type: image/png
Size: 4628 bytes
Desc: 5c96d8.png
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20121116/67d2e2d4/attachment-0001.png>


More information about the webkit-help mailing list