Commit f3fe00a7 authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

Objective-C API: scanExternalObjectGraph should not create new JSVirtualMachine wrappers

https://bugs.webkit.org/show_bug.cgi?id=116074

If scanExternalObjectGraph creates a new JSVirtualMachine wrapper during collection, when the 
scanExternalObjectGraph call finishes and the autorelease pool is drained we will dealloc the 
JSVirtualMachine which will cause us to try to take the API lock for the corresponding VM. 
If this happens on a GC thread other than the "main" thread, we will deadlock. The solution 
is to just check the VM cache, and if there is no JSVirtualMachine wrapper, return early.

Reviewed by Darin Adler.

* API/JSVirtualMachine.mm:
(scanExternalObjectGraph):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 08a363f8
......@@ -227,7 +227,9 @@ JSContextGroupRef getGroupFromVirtualMachine(JSVirtualMachine *virtualMachine)
void scanExternalObjectGraph(JSC::VM& vm, JSC::SlotVisitor& visitor, void* root)
{
@autoreleasepool {
JSVirtualMachine *virtualMachine = [JSVirtualMachine virtualMachineWithContextGroupRef:toRef(&vm)];
JSVirtualMachine *virtualMachine = [JSVMWrapperCache wrapperForJSContextGroupRef:toRef(&vm)];
if (!virtualMachine)
return;
NSMapTable *externalObjectGraph = [virtualMachine externalObjectGraph];
Vector<void*> stack;
stack.append(root);
......
2013-05-13 Mark Hahnenberg <mhahnenberg@apple.com>
Objective-C API: scanExternalObjectGraph should not create new JSVirtualMachine wrappers
https://bugs.webkit.org/show_bug.cgi?id=116074
If scanExternalObjectGraph creates a new JSVirtualMachine wrapper during collection, when the
scanExternalObjectGraph call finishes and the autorelease pool is drained we will dealloc the
JSVirtualMachine which will cause us to try to take the API lock for the corresponding VM.
If this happens on a GC thread other than the "main" thread, we will deadlock. The solution
is to just check the VM cache, and if there is no JSVirtualMachine wrapper, return early.
Reviewed by Darin Adler.
* API/JSVirtualMachine.mm:
(scanExternalObjectGraph):
2013-05-13 Benjamin Poulain <benjamin@webkit.org>
Improve stringProtoFuncLastIndexOf for the prefix case
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment