Ignore:
Timestamp:
Apr 15, 2014, 2:05:09 PM (11 years ago)
Author:
[email protected]
Message:

Objective-C API external object graphs don't handle generational collection properly
https://bugs.webkit.org/show_bug.cgi?id=131634

Reviewed by Geoffrey Garen.

If the set of Objective-C objects transitively reachable through an object changes, we
need to update the set of opaque roots accordingly. If we don't, the next EdenCollection
won't rescan the external object graph, which would lead us to consider a newly allocated
JSManagedValue to be dead.

  • API/JSBase.cpp:

(JSSynchronousEdenCollectForDebugging):

  • API/JSVirtualMachine.mm:

(-[JSVirtualMachine initWithContextGroupRef:]):
(-[JSVirtualMachine dealloc]):
(-[JSVirtualMachine isOldExternalObject:]):
(-[JSVirtualMachine addExternalRememberedObject:]):
(-[JSVirtualMachine addManagedReference:withOwner:]):
(-[JSVirtualMachine removeManagedReference:withOwner:]):
(-[JSVirtualMachine externalRememberedSet]):
(scanExternalObjectGraph):
(scanExternalRememberedSet):

  • API/JSVirtualMachineInternal.h:
  • API/tests/testapi.mm:
  • heap/Heap.cpp:

(JSC::Heap::markRoots):

  • heap/Heap.h:

(JSC::Heap::slotVisitor):

  • heap/SlotVisitor.h:
  • heap/SlotVisitorInlines.h:

(JSC::SlotVisitor::containsOpaqueRoot):
(JSC::SlotVisitor::containsOpaqueRootTriState):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSBase.cpp

    r165676 r167326  
    143143
    144144extern "C" JS_EXPORT void JSSynchronousGarbageCollectForDebugging(JSContextRef);
     145extern "C" JS_EXPORT void JSSynchronousEdenCollectForDebugging(JSContextRef);
    145146
    146147void JSSynchronousGarbageCollectForDebugging(JSContextRef ctx)
     
    152153    JSLockHolder locker(exec);
    153154    exec->vm().heap.collectAllGarbage();
     155}
     156
     157void JSSynchronousEdenCollectForDebugging(JSContextRef ctx)
     158{
     159    if (!ctx)
     160        return;
     161
     162    ExecState* exec = toJS(ctx);
     163    JSLockHolder locker(exec);
     164    exec->vm().heap.collect(EdenCollection);
    154165}
    155166
Note: See TracChangeset for help on using the changeset viewer.