Ignore:
Timestamp:
Feb 24, 2011, 1:59:57 PM (14 years ago)
Author:
[email protected]
Message:

2011-02-23 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Make WeakGCMap use new handle infrastructure
https://bugs.webkit.org/show_bug.cgi?id=55100

Remove old WeakGCMap implementation and move over to new handle
based logic.

This has a number of benefits, most notably it makes a WeakGCMap
always reflect the true state of the world by as all entries are
removed at the first gc cycle that makes them dead. This allows
us to get rid of code in a wide variety of objects where the only
purpose was to remove themselves from maps.

It also means that we no longer need to have special "unchecked"
versions of any functions on WeakGCMap. Alas in order to maintain
compatibility with the JSWeakObjectMapClear API it is still
necessary to have an api that resembles uncheckedRemove, this is
now deprecatedRemove and will be dealt with in a later patch.

In order to get correct semantics in WeakGCMap we need more
contextual information in the finalizer, so we've added an
abstract class based finaliser and a context parameter to the
calls.

The new an improved WeakGCMap also results in sigificantly more
churn in the weak handle lists so exposed some potential problems
during the post mark phase which have been rectified as well.

  • API/JSWeakObjectMapRefPrivate.cpp:
  • API/JSWeakObjectMapRefPrivate.h:
  • runtime/Heap.cpp: (JSC::Heap::globalObjectCount): (JSC::Heap::protectedGlobalObjectCount):
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::~JSGlobalObject): (JSC::JSGlobalObject::init):
  • runtime/WeakGCMap.h: (JSC::WeakGCMap::iterator::iterator): (JSC::WeakGCMap::iterator::get): (JSC::WeakGCMap::iterator::getSlot): (JSC::WeakGCMap::iterator::operator++): (JSC::WeakGCMap::iterator::operator==): (JSC::WeakGCMap::iterator::operator!=): (JSC::WeakGCMap::WeakGCMap): (JSC::WeakGCMap::isEmpty): (JSC::WeakGCMap::clear): (JSC::WeakGCMap::get): (JSC::WeakGCMap::getSlot): (JSC::WeakGCMap::set): (JSC::WeakGCMap::take): (JSC::WeakGCMap::size): (JSC::WeakGCMap::deprecatedRemove): (JSC::WeakGCMap::begin): (JSC::WeakGCMap::end): (JSC::WeakGCMap::~WeakGCMap): (JSC::WeakGCMap::finalize):
  • runtime/WeakGCPtr.h: (JSC::WeakGCPtr::WeakGCPtr): (JSC::WeakGCPtr::set):

2011-02-23 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Make WeakGCMap use new handle infrastructure
https://bugs.webkit.org/show_bug.cgi?id=55100

Update to new WeakGCMap APIs, this requires threading global
data to a few functions that did not need it in the past, but
also gets rid of a large number of destructors, as well as the
forgetDOMNode, etc APIs.

We can also drop the JSDebugWrapperSet as its only purpose was
to ensure that we retained correct semantics in the old WeakGCMap,
but happilly these semantics are now guaranteed by the map itself.

  • CMakeLists.txt:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDOMBinding.cpp: (WebCore::hasCachedDOMObjectWrapperUnchecked): (WebCore::cacheDOMObjectWrapper): (WebCore::hasCachedDOMNodeWrapperUnchecked): (WebCore::cacheDOMNodeWrapper): (WebCore::isObservableThroughDOM): (WebCore::markDOMNodesForDocument): (WebCore::takeWrappers): (WebCore::updateDOMNodeDocument): (WebCore::markDOMObjectWrapper): (WebCore::markDOMNodeWrapper): (WebCore::stringWrapperDestroyed): (WebCore::jsStringSlowCase):
  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMWrapper.cpp: (WebCore::DOMObject::~DOMObject):
  • bindings/js/JSDebugWrapperSet.cpp: Removed.
  • bindings/js/JSDebugWrapperSet.h: Removed.
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/jsc/BridgeJSC.cpp: (JSC::Bindings::Instance::createRuntimeObject):
  • bridge/jsc/BridgeJSC.h:
  • bridge/runtime_object.cpp: (JSC::Bindings::RuntimeObject::~RuntimeObject):
  • bridge/runtime_root.cpp: (JSC::Bindings::RootObject::invalidate): (JSC::Bindings::RootObject::addRuntimeObject): (JSC::Bindings::RootObject::removeRuntimeObject):
  • bridge/runtime_root.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r79177 r79616  
    4040#include "Terminator.h"
    4141#include "TimeoutChecker.h"
    42 #include "WeakGCMap.h"
    4342#include "WeakRandom.h"
    4443#include <wtf/BumpPointerAllocator.h>
     
    7776    struct Instruction;
    7877
    79     typedef WeakGCMap<JSGlobalObject*, JSGlobalObject> GlobalObjectMap; // FIXME: Would be nice to use a WeakGCSet here.
    80 
    8178    struct DSTOffsetCache {
    8279        DSTOffsetCache()
     
    216213        HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
    217214
    218         GlobalObjectMap globalObjects;
     215        unsigned globalObjectCount;
    219216        JSGlobalObject* dynamicGlobalObject;
    220217
Note: See TracChangeset for help on using the changeset viewer.