diff options
Diffstat (limited to 'Source/JavaScriptCore/API/JSContextRef.cpp')
-rw-r--r-- | Source/JavaScriptCore/API/JSContextRef.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp index 92e03a671..7a57287de 100644 --- a/Source/JavaScriptCore/API/JSContextRef.cpp +++ b/Source/JavaScriptCore/API/JSContextRef.cpp @@ -78,7 +78,6 @@ JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) // If the application was linked before JSGlobalContextCreate was changed to use a unique JSGlobalData, // we use a shared one for backwards compatibility. if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) { - JSLock lock(LockForReal); return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); } #endif // OS(DARWIN) @@ -90,11 +89,9 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass { initializeThreading(); - JSLock lock(LockForReal); RefPtr<JSGlobalData> globalData = group ? PassRefPtr<JSGlobalData>(toJS(group)) : JSGlobalData::createContextGroup(ThreadStackTypeSmall); APIEntryShim entryShim(globalData.get(), false); - globalData->makeUsableFromMultipleThreads(); if (!globalObjectClass) { @@ -124,18 +121,19 @@ JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx) void JSGlobalContextRelease(JSGlobalContextRef ctx) { + IdentifierTable* savedIdentifierTable; ExecState* exec = toJS(ctx); - JSLock lock(exec); + { + JSLockHolder lock(exec); - JSGlobalData& globalData = exec->globalData(); - IdentifierTable* savedIdentifierTable = wtfThreadData().setCurrentIdentifierTable(globalData.identifierTable); + JSGlobalData& globalData = exec->globalData(); + savedIdentifierTable = wtfThreadData().setCurrentIdentifierTable(globalData.identifierTable); - bool protectCountIsZero = Heap::heap(exec->dynamicGlobalObject())->unprotect(exec->dynamicGlobalObject()); - if (protectCountIsZero) { - globalData.heap.activityCallback()->synchronize(); - globalData.heap.reportAbandonedObjectGraph(); + bool protectCountIsZero = Heap::heap(exec->dynamicGlobalObject())->unprotect(exec->dynamicGlobalObject()); + if (protectCountIsZero) + globalData.heap.reportAbandonedObjectGraph(); + globalData.deref(); } - globalData.deref(); wtfThreadData().setCurrentIdentifierTable(savedIdentifierTable); } @@ -166,7 +164,7 @@ JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) JSStringRef JSContextCreateBacktrace(JSContextRef ctx, unsigned maxStackSize) { ExecState* exec = toJS(ctx); - JSLock lock(exec); + JSLockHolder lock(exec); unsigned count = 0; UStringBuilder builder; |