Ignore:
Timestamp:
Apr 27, 2012, 10:57:46 PM (13 years ago)
Author:
[email protected]
Message:

Made WeakSet::allocate() static and removed its JSGlobalData argument
https://bugs.webkit.org/show_bug.cgi?id=85128

Reviewed by Anders Carlsson.

../JavaScriptCore:

This is a step toward faster finalization.

WeakSet::allocate() now deduces which WeakSet to allocate from based on
its JSCell* argument. (Currently, there's only one WeakSet, but soon
there will be many.)

This was a global replace of "globalData.heap.weakSet()->allocate" with
"WeakSet::allocate", plus by-hand removal of the JSGlobalData argument.

  • heap/WeakSetInlines.h: Copied from Source/JavaScriptCore/heap/WeakSet.h.

I had to split out WeakSet::allocate() in to a separate header to avoid
a cycle.

(JSC::WeakSet::allocate): We can mask the pointer we're passed to
figure out where to allocate our WeakImpl. (Soon, we'll use this to
associate the WeakImpl with the GC block it references.)

../WebCore:

Mechanically removed JSGlobalData arguments from PassWeak<T> and Weak<T> allocation.

  • bindings/js/JSDOMBinding.cpp:

(WebCore::jsStringSlowCase):

  • bindings/js/JSEventListener.h:

(WebCore::JSEventListener::setWrapper):

  • bindings/js/JSNodeFilterCondition.cpp:

(WebCore::JSNodeFilterCondition::JSNodeFilterCondition):

  • bindings/js/ScriptWrappable.h:

(WebCore::ScriptWrappable::setWrapper):

  • bridge/jsc/BridgeJSC.cpp:

(JSC::Bindings::Instance::createRuntimeObject):

  • bridge/qt/qt_runtime.cpp:

(JSC::Bindings::QtRuntimeMethod::finishCreation):

  • bridge/runtime_root.cpp:

(JSC::Bindings::RootObject::addRuntimeObject):

../WebKit2:

Mechanically removed JSGlobalData arguments from PassWeak<T> and Weak<T> allocation.

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::getOrCreateJSObject):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/PassWeak.h

    r115534 r115545  
    2828
    2929#include "JSCell.h"
     30#include "WeakSetInlines.h"
    3031#include <wtf/Assertions.h>
    3132#include <wtf/NullPtr.h>
     
    5859    PassWeak();
    5960    PassWeak(std::nullptr_t);
    60     PassWeak(JSGlobalData&, GetType, WeakHandleOwner* = 0, void* context = 0);
     61    PassWeak(GetType, WeakHandleOwner* = 0, void* context = 0);
    6162
    6263    // It somewhat breaks the type system to allow transfer of ownership out of
     
    119120}
    120121
    121 template<typename T> inline PassWeak<T>::PassWeak(JSGlobalData& globalData, typename PassWeak<T>::GetType getType, WeakHandleOwner* weakOwner, void* context)
    122     : m_impl(getType ? globalData.heap.weakSet()->allocate(getType, weakOwner, context) : 0)
     122template<typename T> inline PassWeak<T>::PassWeak(typename PassWeak<T>::GetType getType, WeakHandleOwner* weakOwner, void* context)
     123    : m_impl(getType ? WeakSet::allocate(getType, weakOwner, context) : 0)
    123124{
    124125}
Note: See TracChangeset for help on using the changeset viewer.