Changeset 189616 in webkit


Ignore:
Timestamp:
Sep 11, 2015, 2:16:37 AM (10 years ago)
Author:
[email protected]
Message:

[JSC] Weak should only accept cell pointees.
<https://webkit.org/b/148955>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Since WeakImpls only support pointing to JSCell derived objects,
enforce that at compile time by having the API use JSCell* instead of JSValue.

WeakHandleOwner callbacks now get JSCell& and JSCell*& respectively instead
of wrapping the cell pointer in a Handle<Unknown>.

Also added a static_assert so Weak<T> can't be instantiated with a T that's
not convertible to JSCell.

  • API/JSAPIWrapperObject.mm:

(JSAPIWrapperObjectHandleOwner::finalize):
(JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots):
(JSC::JSAPIWrapperObject::finishCreation):

  • API/JSManagedValue.mm:

(JSManagedValueHandleOwner::isReachableFromOpaqueRoots):
(JSManagedValueHandleOwner::finalize):

  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::finalize):

  • builtins/BuiltinExecutables.h:
  • heap/Heap.cpp:

(JSC::Heap::addFinalizer):
(JSC::Heap::FinalizerOwner::finalize):

  • heap/Heap.h:
  • heap/WeakBlock.cpp:

(JSC::WeakBlock::visit):
(JSC::WeakBlock::reap):

  • heap/WeakHandleOwner.cpp:

(JSC::WeakHandleOwner::isReachableFromOpaqueRoots):
(JSC::WeakHandleOwner::finalize):

  • heap/WeakHandleOwner.h:
  • heap/WeakImpl.h:

(JSC::WeakImpl::WeakImpl):
(JSC::WeakImpl::state):
(JSC::WeakImpl::cell):
(JSC::WeakImpl::asWeakImpl):
(JSC::WeakImpl::jsValue): Deleted.

  • heap/WeakInlines.h:

(JSC::Weak<T>::Weak):
(JSC::>):
(JSC::Weak<T>::operator):
(JSC::Weak<T>::get):
(JSC::Weak<T>::was):

  • heap/WeakSet.h:
  • heap/WeakSetInlines.h:

(JSC::WeakSet::allocate):
(JSC::WeakBlock::finalize):

  • jit/JITThunks.cpp:

(JSC::JITThunks::finalize):

  • jit/JITThunks.h:
  • jsc.cpp:

(WTF::ElementHandleOwner::isReachableFromOpaqueRoots): Deleted.

  • runtime/JSCell.h:

(JSC::jsCast):

  • runtime/RegExpCache.cpp:

(JSC::RegExpCache::finalize):

  • runtime/RegExpCache.h:
  • runtime/Structure.cpp:

(JSC::StructureTransitionTable::singleTransition):
(JSC::StructureTransitionTable::setSingleTransition):

Source/WebCore:

Update WebCore bindings for the new Weak and Weak-related signatures.

  • bindings/js/JSCSSRuleListCustom.cpp:

(WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):

  • bindings/js/JSCSSValueCustom.cpp:

(WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots):
(WebCore::JSCSSValueOwner::finalize):

  • bindings/js/JSCallbackData.cpp:

(WebCore::JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots):

  • bindings/js/JSCallbackData.h:
  • bindings/js/JSMutationObserverCustom.cpp:

(WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):

  • bindings/js/JSNodeCustom.cpp:

(WebCore::isReachableFromDOM):
(WebCore::JSNodeOwner::isReachableFromOpaqueRoots):

  • bindings/js/JSNodeListCustom.cpp:

(WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):

  • bindings/js/JSTextTrackCueCustom.cpp:

(WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots):

  • bindings/js/WebCoreTypedArrayController.cpp:

(WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots):
(WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::finalize):

  • bindings/js/WebCoreTypedArrayController.h:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):

  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:

(WebCore::JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestActiveDOMObjectOwner::finalize):

  • bindings/scripts/test/JS/JSTestActiveDOMObject.h:
  • bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:

(WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::finalize):

  • bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
  • bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:

(WebCore::JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestCustomNamedGetterOwner::finalize):

  • bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:

(WebCore::JSTestEventConstructorOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestEventConstructorOwner::finalize):

  • bindings/scripts/test/JS/JSTestEventConstructor.h:
  • bindings/scripts/test/JS/JSTestEventTarget.cpp:

(WebCore::JSTestEventTargetOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestEventTargetOwner::finalize):

  • bindings/scripts/test/JS/JSTestEventTarget.h:
  • bindings/scripts/test/JS/JSTestException.cpp:

(WebCore::JSTestExceptionOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestExceptionOwner::finalize):

  • bindings/scripts/test/JS/JSTestException.h:
  • bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:

(WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestGenerateIsReachableOwner::finalize):

  • bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::JSTestInterfaceOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestInterfaceOwner::finalize):

  • bindings/scripts/test/JS/JSTestInterface.h:
  • bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:

(WebCore::JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestMediaQueryListListenerOwner::finalize):

  • bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
  • bindings/scripts/test/JS/JSTestNamedConstructor.cpp:

(WebCore::JSTestNamedConstructorOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestNamedConstructorOwner::finalize):

  • bindings/scripts/test/JS/JSTestNamedConstructor.h:
  • bindings/scripts/test/JS/JSTestNondeterministic.cpp:

(WebCore::JSTestNondeterministicOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestNondeterministicOwner::finalize):

  • bindings/scripts/test/JS/JSTestNondeterministic.h:
  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObjOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestObjOwner::finalize):

  • bindings/scripts/test/JS/JSTestObj.h:
  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:

(WebCore::JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestOverloadedConstructorsOwner::finalize):

  • bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
  • bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:

(WebCore::JSTestOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestOverrideBuiltinsOwner::finalize):

  • bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:

(WebCore::JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestSerializedScriptValueInterfaceOwner::finalize):

  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

(WebCore::JSTestTypedefsOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestTypedefsOwner::finalize):

  • bindings/scripts/test/JS/JSTestTypedefs.h:
  • bindings/scripts/test/JS/JSattribute.cpp:

(WebCore::JSattributeOwner::isReachableFromOpaqueRoots):
(WebCore::JSattributeOwner::finalize):

  • bindings/scripts/test/JS/JSattribute.h:
  • bindings/scripts/test/JS/JSreadonly.cpp:

(WebCore::JSreadonlyOwner::isReachableFromOpaqueRoots):
(WebCore::JSreadonlyOwner::finalize):

  • bindings/scripts/test/JS/JSreadonly.h:
  • bridge/runtime_root.cpp:

(JSC::Bindings::RootObject::finalize):

  • bridge/runtime_root.h:

Source/WebKit2:

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::finalize):

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
Location:
trunk/Source
Files:
74 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSAPIWrapperObject.mm

    r179728 r189616  
    3434#if JSC_OBJC_API_ENABLED
    3535
    36 class JSAPIWrapperObjectHandleOwner : public JSC::WeakHandleOwner {
     36class JSAPIWrapperObjectHandleOwner final : public JSC::WeakHandleOwner {
    3737public:
    38     virtual void finalize(JSC::Handle<JSC::Unknown>, void*) override;
    39     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&) override;
     38    void finalize(JSC::JSCell*&, void*) override;
     39    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
    4040};
    4141
     
    4646}
    4747
    48 void JSAPIWrapperObjectHandleOwner::finalize(JSC::Handle<JSC::Unknown> handle, void*)
     48void JSAPIWrapperObjectHandleOwner::finalize(JSC::JSCell*& cell, void*)
    4949{
    50     JSC::JSAPIWrapperObject* wrapperObject = JSC::jsCast<JSC::JSAPIWrapperObject*>(handle.get().asCell());
    51     if (!wrapperObject->wrappedObject())
     50    auto& wrapperObject = JSC::jsCast<JSC::JSAPIWrapperObject&>(*cell);
     51    if (!wrapperObject.wrappedObject())
    5252        return;
    5353
    54     JSC::Heap::heap(wrapperObject)->releaseSoon(adoptNS(static_cast<id>(wrapperObject->wrappedObject())));
    55     JSC::WeakSet::deallocate(JSC::WeakImpl::asWeakImpl(handle.slot()));
     54    JSC::Heap::heap(&wrapperObject)->releaseSoon(adoptNS(static_cast<id>(wrapperObject.wrappedObject())));
     55    JSC::WeakSet::deallocate(JSC::WeakImpl::asWeakImpl(&cell));
    5656}
    5757
    58 bool JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, JSC::SlotVisitor& visitor)
     58bool JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, JSC::SlotVisitor& visitor)
    5959{
    60     JSC::JSAPIWrapperObject* wrapperObject = JSC::jsCast<JSC::JSAPIWrapperObject*>(handle.get().asCell());
     60    JSC::JSAPIWrapperObject& wrapperObject = JSC::jsCast<JSC::JSAPIWrapperObject&>(cell);
    6161    // We use the JSGlobalObject when processing weak handles to prevent the situation where using
    6262    // the same Objective-C object in multiple global objects keeps all of the global objects alive.
    63     if (!wrapperObject->wrappedObject())
     63    if (!wrapperObject.wrappedObject())
    6464        return false;
    65     return JSC::Heap::isMarked(wrapperObject->structure()->globalObject()) && visitor.containsOpaqueRoot(wrapperObject->wrappedObject());
     65    return JSC::Heap::isMarked(wrapperObject.globalObject()) && visitor.containsOpaqueRoot(wrapperObject.wrappedObject());
    6666}
    6767
     
    8787{
    8888    Base::finishCreation(vm);
    89     WeakSet::allocate(this, jsAPIWrapperObjectHandleOwner(), 0); // Balanced in JSAPIWrapperObjectHandleOwner::finalize.
     89    WeakSet::allocate(*this, jsAPIWrapperObjectHandleOwner(), 0); // Balanced in JSAPIWrapperObjectHandleOwner::finalize.
    9090}
    9191   
  • trunk/Source/JavaScriptCore/API/JSManagedValue.mm

    r174110 r189616  
    4040#import <wtf/spi/cocoa/NSMapTableSPI.h>
    4141
    42 class JSManagedValueHandleOwner : public JSC::WeakHandleOwner {
     42class JSManagedValueHandleOwner final : public JSC::WeakHandleOwner {
    4343public:
    44     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context) override;
    45     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&) override;
     44    void finalize(JSC::JSCell*&, void* context) override;
     45    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
    4646};
    4747
     
    296296@end
    297297
    298 bool JSManagedValueHandleOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor& visitor)
     298bool JSManagedValueHandleOwner::isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor& visitor)
    299299{
    300300    JSManagedValue *managedValue = static_cast<JSManagedValue *>(context);
     
    302302}
    303303
    304 void JSManagedValueHandleOwner::finalize(JSC::Handle<JSC::Unknown>, void* context)
     304void JSManagedValueHandleOwner::finalize(JSC::JSCell*&, void* context)
    305305{
    306306    JSManagedValue *managedValue = static_cast<JSManagedValue *>(context);
  • trunk/Source/JavaScriptCore/ChangeLog

    r189599 r189616  
     12015-09-11  Andreas Kling  <[email protected]>
     2
     3        [JSC] Weak should only accept cell pointees.
     4        <https://webkit.org/b/148955>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Since WeakImpls only support pointing to JSCell derived objects,
     9        enforce that at compile time by having the API use JSCell* instead of JSValue.
     10
     11        WeakHandleOwner callbacks now get JSCell& and JSCell*& respectively instead
     12        of wrapping the cell pointer in a Handle<Unknown>.
     13
     14        Also added a static_assert so Weak<T> can't be instantiated with a T that's
     15        not convertible to JSCell.
     16
     17        * API/JSAPIWrapperObject.mm:
     18        (JSAPIWrapperObjectHandleOwner::finalize):
     19        (JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots):
     20        (JSC::JSAPIWrapperObject::finishCreation):
     21        * API/JSManagedValue.mm:
     22        (JSManagedValueHandleOwner::isReachableFromOpaqueRoots):
     23        (JSManagedValueHandleOwner::finalize):
     24        * builtins/BuiltinExecutables.cpp:
     25        (JSC::BuiltinExecutables::finalize):
     26        * builtins/BuiltinExecutables.h:
     27        * heap/Heap.cpp:
     28        (JSC::Heap::addFinalizer):
     29        (JSC::Heap::FinalizerOwner::finalize):
     30        * heap/Heap.h:
     31        * heap/WeakBlock.cpp:
     32        (JSC::WeakBlock::visit):
     33        (JSC::WeakBlock::reap):
     34        * heap/WeakHandleOwner.cpp:
     35        (JSC::WeakHandleOwner::isReachableFromOpaqueRoots):
     36        (JSC::WeakHandleOwner::finalize):
     37        * heap/WeakHandleOwner.h:
     38        * heap/WeakImpl.h:
     39        (JSC::WeakImpl::WeakImpl):
     40        (JSC::WeakImpl::state):
     41        (JSC::WeakImpl::cell):
     42        (JSC::WeakImpl::asWeakImpl):
     43        (JSC::WeakImpl::jsValue): Deleted.
     44        * heap/WeakInlines.h:
     45        (JSC::Weak<T>::Weak):
     46        (JSC::>):
     47        (JSC::Weak<T>::operator):
     48        (JSC::Weak<T>::get):
     49        (JSC::Weak<T>::was):
     50        * heap/WeakSet.h:
     51        * heap/WeakSetInlines.h:
     52        (JSC::WeakSet::allocate):
     53        (JSC::WeakBlock::finalize):
     54        * jit/JITThunks.cpp:
     55        (JSC::JITThunks::finalize):
     56        * jit/JITThunks.h:
     57        * jsc.cpp:
     58        (WTF::ElementHandleOwner::isReachableFromOpaqueRoots): Deleted.
     59        * runtime/JSCell.h:
     60        (JSC::jsCast):
     61        * runtime/RegExpCache.cpp:
     62        (JSC::RegExpCache::finalize):
     63        * runtime/RegExpCache.h:
     64        * runtime/Structure.cpp:
     65        (JSC::StructureTransitionTable::singleTransition):
     66        (JSC::StructureTransitionTable::setSingleTransition):
     67
    1682015-09-10  Sukolsak Sakshuwong  <[email protected]>
    269
  • trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp

    r188417 r189616  
    109109}
    110110
    111 void BuiltinExecutables::finalize(Handle<Unknown>, void* context)
     111void BuiltinExecutables::finalize(JSCell*&, void* context)
    112112{
    113113    static_cast<Weak<UnlinkedFunctionExecutable>*>(context)->clear();
  • trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.h

    r187205 r189616  
    5454
    5555private:
    56     void finalize(Handle<Unknown>, void* context) override;
     56    void finalize(JSCell*&, void* context) override;
    5757
    5858    VM& m_vm;
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r189553 r189616  
    13841384void Heap::addFinalizer(JSCell* cell, Finalizer finalizer)
    13851385{
    1386     WeakSet::allocate(cell, &m_finalizerOwner, reinterpret_cast<void*>(finalizer)); // Balanced by FinalizerOwner::finalize().
    1387 }
    1388 
    1389 void Heap::FinalizerOwner::finalize(Handle<Unknown> handle, void* context)
    1390 {
    1391     HandleSlot slot = handle.slot();
     1386    WeakSet::allocate(*cell, &m_finalizerOwner, reinterpret_cast<void*>(finalizer)); // Balanced by FinalizerOwner::finalize().
     1387}
     1388
     1389void Heap::FinalizerOwner::finalize(JSCell*& cell, void* context)
     1390{
    13921391    Finalizer finalizer = reinterpret_cast<Finalizer>(context);
    1393     finalizer(slot->asCell());
    1394     WeakSet::deallocate(WeakImpl::asWeakImpl(slot));
     1392    finalizer(cell);
     1393    WeakSet::deallocate(WeakImpl::asWeakImpl(&cell));
    13951394}
    13961395
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r189515 r189616  
    269269    static const size_t minExtraMemory = 256;
    270270   
    271     class FinalizerOwner : public WeakHandleOwner {
    272         virtual void finalize(Handle<Unknown>, void* context) override;
     271    class FinalizerOwner final : public WeakHandleOwner {
     272        void finalize(JSCell*&, void* context) override;
    273273    };
    274274
  • trunk/Source/JavaScriptCore/heap/WeakBlock.cpp

    r183769 r189616  
    113113            continue;
    114114
    115         const JSValue& jsValue = weakImpl->jsValue();
    116         if (m_markedBlock->isMarkedOrNewlyAllocated(jsValue.asCell()))
     115        if (m_markedBlock->isMarkedOrNewlyAllocated(weakImpl->m_cell))
    117116            continue;
    118117
     
    121120            continue;
    122121
    123         if (!weakHandleOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(jsValue)), weakImpl->context(), visitor))
     122        if (!weakHandleOwner->isReachableFromOpaqueRoots(*weakImpl->m_cell, weakImpl->context(), visitor))
    124123            continue;
    125124
    126         heapRootVisitor.visit(&const_cast<JSValue&>(jsValue));
     125        heapRootVisitor.visit(&weakImpl->m_cell);
    127126    }
    128127}
     
    145144            continue;
    146145
    147         if (m_markedBlock->isMarkedOrNewlyAllocated(weakImpl->jsValue().asCell())) {
     146        if (m_markedBlock->isMarkedOrNewlyAllocated(weakImpl->cell())) {
    148147            ASSERT(weakImpl->state() == WeakImpl::Live);
    149148            continue;
  • trunk/Source/JavaScriptCore/heap/WeakHandleOwner.cpp

    r163844 r189616  
    3838}
    3939
    40 bool WeakHandleOwner::isReachableFromOpaqueRoots(Handle<Unknown>, void*, SlotVisitor&)
     40bool WeakHandleOwner::isReachableFromOpaqueRoots(JSCell&, void*, SlotVisitor&)
    4141{
    4242    return false;
    4343}
    4444
    45 void WeakHandleOwner::finalize(Handle<Unknown>, void*)
     45void WeakHandleOwner::finalize(JSCell*&, void*)
    4646{
    4747}
  • trunk/Source/JavaScriptCore/heap/WeakHandleOwner.h

    r113141 r189616  
    3636public:
    3737    virtual ~WeakHandleOwner();
    38     virtual bool isReachableFromOpaqueRoots(Handle<Unknown>, void* context, SlotVisitor&);
    39     virtual void finalize(Handle<Unknown>, void* context);
     38    virtual bool isReachableFromOpaqueRoots(JSCell&, void* context, SlotVisitor&);
     39    virtual void finalize(JSCell*&, void* context);
    4040};
    4141
  • trunk/Source/JavaScriptCore/heap/WeakImpl.h

    r143909 r189616  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747
    4848    WeakImpl();
    49     WeakImpl(JSValue, WeakHandleOwner*, void* context);
     49    WeakImpl(JSCell&, WeakHandleOwner*, void* context);
    5050
    51     State state();
     51    State state() const;
    5252    void setState(State);
    5353
    54     const JSValue& jsValue();
     54    JSCell* cell();
    5555    WeakHandleOwner* weakHandleOwner();
    5656    void* context();
    5757
    58     static WeakImpl* asWeakImpl(JSValue*);
     58    static WeakImpl* asWeakImpl(JSCell**);
    5959
    6060private:
    61     const JSValue m_jsValue;
    62     WeakHandleOwner* m_weakHandleOwner;
    63     void* m_context;
     61    friend class WeakBlock;
     62
     63    JSCell* m_cell { nullptr };
     64    WeakHandleOwner* m_weakHandleOwner { nullptr };
     65    void* m_context { nullptr };
    6466};
    6567
    6668inline WeakImpl::WeakImpl()
    67     : m_weakHandleOwner(0)
    68     , m_context(0)
    6969{
    7070    setState(Deallocated);
    7171}
    7272
    73 inline WeakImpl::WeakImpl(JSValue jsValue, WeakHandleOwner* weakHandleOwner, void* context)
    74     : m_jsValue(jsValue)
     73inline WeakImpl::WeakImpl(JSCell& cell, WeakHandleOwner* weakHandleOwner, void* context)
     74    : m_cell(&cell)
    7575    , m_weakHandleOwner(weakHandleOwner)
    7676    , m_context(context)
    7777{
    7878    ASSERT(state() == Live);
    79     ASSERT(m_jsValue && m_jsValue.isCell());
    8079}
    8180
    82 inline WeakImpl::State WeakImpl::state()
     81inline WeakImpl::State WeakImpl::state() const
    8382{
    8483    return static_cast<State>(reinterpret_cast<uintptr_t>(m_weakHandleOwner) & StateMask);
     
    9190}
    9291
    93 inline const JSValue& WeakImpl::jsValue()
     92inline JSCell* WeakImpl::cell()
    9493{
    95     return m_jsValue;
     94    return m_cell;
    9695}
    9796
     
    106105}
    107106
    108 inline WeakImpl* WeakImpl::asWeakImpl(JSValue* slot)
     107inline WeakImpl* WeakImpl::asWeakImpl(JSCell** slot)
    109108{
    110     return reinterpret_cast_ptr<WeakImpl*>(reinterpret_cast_ptr<char*>(slot) + OBJECT_OFFSETOF(WeakImpl, m_jsValue));
     109    return reinterpret_cast_ptr<WeakImpl*>(reinterpret_cast_ptr<char*>(slot));
    111110}
    112111
  • trunk/Source/JavaScriptCore/heap/WeakInlines.h

    r188040 r189616  
    3535
    3636template<typename T> inline Weak<T>::Weak(T* cell, WeakHandleOwner* weakOwner, void* context)
    37     : m_impl(cell ? WeakSet::allocate(cell, weakOwner, context) : 0)
     37    : m_impl(cell ? WeakSet::allocate(*cell, weakOwner, context) : 0)
    3838{
     39    static_assert((std::is_convertible<T, JSCell>::value), "JSC::Weak can only be used with cell types.");
    3940}
    4041
     
    7475{
    7576    ASSERT(m_impl && m_impl->state() == WeakImpl::Live);
    76     return jsCast<T*>(m_impl->jsValue().asCell());
     77    return jsCast<T*>(m_impl->cell());
    7778}
    7879
     
    8081{
    8182    ASSERT(m_impl && m_impl->state() == WeakImpl::Live);
    82     return *jsCast<T*>(m_impl->jsValue().asCell());
     83    return *jsCast<T*>(m_impl->cell());
    8384}
    8485
     
    8788    if (!m_impl || m_impl->state() != WeakImpl::Live)
    8889        return 0;
    89     return jsCast<T*>(m_impl->jsValue().asCell());
     90    return jsCast<T*>(m_impl->cell());
    9091}
    9192
    9293template<typename T> inline bool Weak<T>::was(T* other) const
    9394{
    94     return static_cast<T*>(m_impl->jsValue().asCell()) == other;
     95    return static_cast<T*>(m_impl->cell()) == other;
    9596}
    9697
    9798template<typename T> inline bool Weak<T>::operator!() const
    9899{
    99     return !m_impl || !m_impl->jsValue() || m_impl->state() != WeakImpl::Live;
     100    return !m_impl || !m_impl->cell() || m_impl->state() != WeakImpl::Live;
    100101}
    101102
  • trunk/Source/JavaScriptCore/heap/WeakSet.h

    r183769 r189616  
    3939
    4040public:
    41     static WeakImpl* allocate(JSValue, WeakHandleOwner* = 0, void* context = 0);
     41    static WeakImpl* allocate(JSCell&, WeakHandleOwner* = 0, void* context = 0);
    4242    static void deallocate(WeakImpl*);
    4343
  • trunk/Source/JavaScriptCore/heap/WeakSetInlines.h

    r148479 r189616  
    3131namespace JSC {
    3232
    33 inline WeakImpl* WeakSet::allocate(JSValue jsValue, WeakHandleOwner* weakHandleOwner, void* context)
     33inline WeakImpl* WeakSet::allocate(JSCell& cell, WeakHandleOwner* weakHandleOwner, void* context)
    3434{
    35     WeakSet& weakSet = MarkedBlock::blockFor(jsValue.asCell())->weakSet();
     35    WeakSet& weakSet = MarkedBlock::blockFor(&cell)->weakSet();
    3636    WeakBlock::FreeCell* allocator = weakSet.m_allocator;
    3737    if (UNLIKELY(!allocator))
     
    4040
    4141    WeakImpl* weakImpl = WeakBlock::asWeakImpl(allocator);
    42     return new (NotNull, weakImpl) WeakImpl(jsValue, weakHandleOwner, context);
     42    return new (NotNull, weakImpl) WeakImpl(cell, weakHandleOwner, context);
    4343}
    4444
     
    5050    if (!weakHandleOwner)
    5151        return;
    52     weakHandleOwner->finalize(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(weakImpl->jsValue())), weakImpl->context());
     52    weakHandleOwner->finalize(weakImpl->m_cell, weakImpl->context());
    5353}
    5454
  • trunk/Source/JavaScriptCore/jit/JITThunks.cpp

    r188499 r189616  
    7777}
    7878
    79 void JITThunks::finalize(Handle<Unknown> handle, void*)
     79void JITThunks::finalize(JSCell*& cell, void*)
    8080{
    81     auto* nativeExecutable = jsCast<NativeExecutable*>(handle.get().asCell());
     81    auto* nativeExecutable = jsCast<NativeExecutable*>(cell);
    8282    weakRemove(*m_hostFunctionStubMap, std::make_pair(nativeExecutable->function(), nativeExecutable->constructor()), nativeExecutable);
    8383}
  • trunk/Source/JavaScriptCore/jit/JITThunks.h

    r188499 r189616  
    6464
    6565private:
    66     void finalize(Handle<Unknown>, void* context) override;
     66    void finalize(JSCell*&, void* context) override;
    6767   
    6868    typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
  • trunk/Source/JavaScriptCore/jsc.cpp

    r189591 r189616  
    177177};
    178178
    179 class ElementHandleOwner : public WeakHandleOwner {
     179class ElementHandleOwner final : public WeakHandleOwner {
    180180public:
    181     virtual bool isReachableFromOpaqueRoots(Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    182     {
    183         Element* element = jsCast<Element*>(handle.slot()->asCell());
    184         return visitor.containsOpaqueRoot(element->root());
     181    virtual bool isReachableFromOpaqueRoots(JSCell& cell, void*, SlotVisitor& visitor)
     182    {
     183        auto& element = jsCast<Element&>(cell);
     184        return visitor.containsOpaqueRoot(element.root());
    185185    }
    186186};
  • trunk/Source/JavaScriptCore/runtime/JSCell.h

    r184328 r189616  
    246246
    247247template<typename To, typename From>
     248inline To& jsCast(From& from)
     249{
     250    ASSERT_WITH_SECURITY_IMPLICATION(from.JSCell::inherits(std::remove_reference<To>::type::info()));
     251    return static_cast<To&>(from);
     252}
     253
     254template<typename To, typename From>
    248255inline To jsCast(From* from)
    249256{
  • trunk/Source/JavaScriptCore/runtime/RegExpCache.cpp

    r188397 r189616  
    5757}
    5858
    59 void RegExpCache::finalize(Handle<Unknown> handle, void*)
     59void RegExpCache::finalize(JSCell*& cell, void*)
    6060{
    61     RegExp* regExp = static_cast<RegExp*>(handle.get().asCell());
     61    RegExp* regExp = jsCast<RegExp*>(cell);
    6262    weakRemove(m_weakCache, regExp->key(), regExp);
    6363}
  • trunk/Source/JavaScriptCore/runtime/RegExpCache.h

    r188394 r189616  
    5555    static const int maxStrongCacheableEntries = 32;
    5656
    57     virtual void finalize(Handle<Unknown>, void* context) override;
     57    void finalize(JSCell*&, void* context) override;
    5858
    5959    RegExp* lookupOrCreate(const WTF::String& patternString, RegExpFlags);
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r189596 r189616  
    6363
    6464class SingleSlotTransitionWeakOwner final : public WeakHandleOwner {
    65     void finalize(Handle<Unknown>, void* context) override
     65    void finalize(JSCell*&, void* context) override
    6666    {
    6767        StructureTransitionTable* table = reinterpret_cast<StructureTransitionTable*>(context);
     
    8383    if (WeakImpl* impl = this->weakImpl()) {
    8484        if (impl->state() == WeakImpl::Live)
    85             return jsCast<Structure*>(impl->jsValue().asCell());
     85            return jsCast<Structure*>(impl->cell());
    8686    }
    8787    return nullptr;
     
    9393    if (WeakImpl* impl = this->weakImpl())
    9494        WeakSet::deallocate(impl);
    95     WeakImpl* impl = WeakSet::allocate(structure, &singleSlotTransitionWeakOwner(), this);
     95    WeakImpl* impl = WeakSet::allocate(*structure, &singleSlotTransitionWeakOwner(), this);
    9696    m_data = reinterpret_cast<intptr_t>(impl) | UsingSingleSlotFlag;
    9797}
  • trunk/Source/WebCore/ChangeLog

    r189598 r189616  
     12015-09-11  Andreas Kling  <[email protected]>
     2
     3        [JSC] Weak should only accept cell pointees.
     4        <https://webkit.org/b/148955>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Update WebCore bindings for the new Weak and Weak-related signatures.
     9
     10        * bindings/js/JSCSSRuleListCustom.cpp:
     11        (WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):
     12        * bindings/js/JSCSSValueCustom.cpp:
     13        (WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots):
     14        (WebCore::JSCSSValueOwner::finalize):
     15        * bindings/js/JSCallbackData.cpp:
     16        (WebCore::JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots):
     17        * bindings/js/JSCallbackData.h:
     18        * bindings/js/JSMutationObserverCustom.cpp:
     19        (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
     20        * bindings/js/JSNodeCustom.cpp:
     21        (WebCore::isReachableFromDOM):
     22        (WebCore::JSNodeOwner::isReachableFromOpaqueRoots):
     23        * bindings/js/JSNodeListCustom.cpp:
     24        (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
     25        * bindings/js/JSTextTrackCueCustom.cpp:
     26        (WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots):
     27        * bindings/js/WebCoreTypedArrayController.cpp:
     28        (WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots):
     29        (WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::finalize):
     30        * bindings/js/WebCoreTypedArrayController.h:
     31        * bindings/scripts/CodeGeneratorJS.pm:
     32        (GenerateHeader):
     33        (GenerateImplementation):
     34        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
     35        (WebCore::JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots):
     36        (WebCore::JSTestActiveDOMObjectOwner::finalize):
     37        * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
     38        * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
     39        (WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots):
     40        (WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::finalize):
     41        * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
     42        * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
     43        (WebCore::JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots):
     44        (WebCore::JSTestCustomNamedGetterOwner::finalize):
     45        * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
     46        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
     47        (WebCore::JSTestEventConstructorOwner::isReachableFromOpaqueRoots):
     48        (WebCore::JSTestEventConstructorOwner::finalize):
     49        * bindings/scripts/test/JS/JSTestEventConstructor.h:
     50        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
     51        (WebCore::JSTestEventTargetOwner::isReachableFromOpaqueRoots):
     52        (WebCore::JSTestEventTargetOwner::finalize):
     53        * bindings/scripts/test/JS/JSTestEventTarget.h:
     54        * bindings/scripts/test/JS/JSTestException.cpp:
     55        (WebCore::JSTestExceptionOwner::isReachableFromOpaqueRoots):
     56        (WebCore::JSTestExceptionOwner::finalize):
     57        * bindings/scripts/test/JS/JSTestException.h:
     58        * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
     59        (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
     60        (WebCore::JSTestGenerateIsReachableOwner::finalize):
     61        * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
     62        * bindings/scripts/test/JS/JSTestInterface.cpp:
     63        (WebCore::JSTestInterfaceOwner::isReachableFromOpaqueRoots):
     64        (WebCore::JSTestInterfaceOwner::finalize):
     65        * bindings/scripts/test/JS/JSTestInterface.h:
     66        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
     67        (WebCore::JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots):
     68        (WebCore::JSTestMediaQueryListListenerOwner::finalize):
     69        * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
     70        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
     71        (WebCore::JSTestNamedConstructorOwner::isReachableFromOpaqueRoots):
     72        (WebCore::JSTestNamedConstructorOwner::finalize):
     73        * bindings/scripts/test/JS/JSTestNamedConstructor.h:
     74        * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
     75        (WebCore::JSTestNondeterministicOwner::isReachableFromOpaqueRoots):
     76        (WebCore::JSTestNondeterministicOwner::finalize):
     77        * bindings/scripts/test/JS/JSTestNondeterministic.h:
     78        * bindings/scripts/test/JS/JSTestObj.cpp:
     79        (WebCore::JSTestObjOwner::isReachableFromOpaqueRoots):
     80        (WebCore::JSTestObjOwner::finalize):
     81        * bindings/scripts/test/JS/JSTestObj.h:
     82        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
     83        (WebCore::JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots):
     84        (WebCore::JSTestOverloadedConstructorsOwner::finalize):
     85        * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
     86        * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
     87        (WebCore::JSTestOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
     88        (WebCore::JSTestOverrideBuiltinsOwner::finalize):
     89        * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
     90        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     91        (WebCore::JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots):
     92        (WebCore::JSTestSerializedScriptValueInterfaceOwner::finalize):
     93        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
     94        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     95        (WebCore::JSTestTypedefsOwner::isReachableFromOpaqueRoots):
     96        (WebCore::JSTestTypedefsOwner::finalize):
     97        * bindings/scripts/test/JS/JSTestTypedefs.h:
     98        * bindings/scripts/test/JS/JSattribute.cpp:
     99        (WebCore::JSattributeOwner::isReachableFromOpaqueRoots):
     100        (WebCore::JSattributeOwner::finalize):
     101        * bindings/scripts/test/JS/JSattribute.h:
     102        * bindings/scripts/test/JS/JSreadonly.cpp:
     103        (WebCore::JSreadonlyOwner::isReachableFromOpaqueRoots):
     104        (WebCore::JSreadonlyOwner::finalize):
     105        * bindings/scripts/test/JS/JSreadonly.h:
     106        * bridge/runtime_root.cpp:
     107        (JSC::Bindings::RootObject::finalize):
     108        * bridge/runtime_root.h:
     109
    11102015-09-10  Chris Fleizach  <[email protected]>
    2111
  • trunk/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp

    r165757 r189616  
    3737namespace WebCore {
    3838
    39 bool JSCSSRuleListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
     39bool JSCSSRuleListOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
    4040{
    41     JSCSSRuleList* jsCSSRuleList = jsCast<JSCSSRuleList*>(handle.slot()->asCell());
    42     if (!jsCSSRuleList->hasCustomProperties())
     41    auto& jsCSSRuleList = jsCast<JSCSSRuleList&>(cell);
     42    if (!jsCSSRuleList.hasCustomProperties())
    4343        return false;
    44     if (CSSStyleSheet* styleSheet = jsCSSRuleList->impl().styleSheet())
     44    if (CSSStyleSheet* styleSheet = jsCSSRuleList.impl().styleSheet())
    4545        return visitor.containsOpaqueRoot(root(styleSheet));
    46     if (CSSRule* cssRule = jsCSSRuleList->impl().item(0))
     46    if (CSSRule* cssRule = jsCSSRuleList.impl().item(0))
    4747        return visitor.containsOpaqueRoot(root(cssRule));
    4848    return false;
  • trunk/Source/WebCore/bindings/js/JSCSSValueCustom.cpp

    r183523 r189616  
    4545namespace WebCore {
    4646
    47 bool JSCSSValueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, SlotVisitor& visitor)
     47bool JSCSSValueOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void* context, SlotVisitor& visitor)
    4848{
    49     JSCSSValue* jsCSSValue = jsCast<JSCSSValue*>(handle.slot()->asCell());
    50     if (!jsCSSValue->hasCustomProperties())
     49    auto& jsCSSValue = jsCast<JSCSSValue&>(cell);
     50    if (!jsCSSValue.hasCustomProperties())
    5151        return false;
    52     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
    53     void* root = world->m_cssValueRoots.get(&jsCSSValue->impl());
     52    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
     53    void* root = world.m_cssValueRoots.get(&jsCSSValue.impl());
    5454    if (!root)
    5555        return false;
     
    5757}
    5858
    59 void JSCSSValueOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
     59void JSCSSValueOwner::finalize(JSC::JSCell*& cell, void* context)
    6060{
    61     JSCSSValue* jsCSSValue = jsCast<JSCSSValue*>(handle.slot()->asCell());
     61    auto& jsCSSValue = jsCast<JSCSSValue&>(*cell);
    6262    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    63     world.m_cssValueRoots.remove(&jsCSSValue->impl());
    64     uncacheWrapper(world, &jsCSSValue->impl(), jsCSSValue);
     63    world.m_cssValueRoots.remove(&jsCSSValue.impl());
     64    uncacheWrapper(world, &jsCSSValue.impl(), &jsCSSValue);
    6565}
    6666
  • trunk/Source/WebCore/bindings/js/JSCallbackData.cpp

    r189230 r189616  
    9191}
    9292
    93 bool JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, SlotVisitor& visitor)
     93bool JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots(JSC::JSCell&, void* context, SlotVisitor& visitor)
    9494{
    9595    return visitor.containsOpaqueRoot(context);
  • trunk/Source/WebCore/bindings/js/JSCallbackData.h

    r189230 r189616  
    106106
    107107private:
    108     class WeakOwner : public JSC::WeakHandleOwner {
    109         virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
     108    class WeakOwner final : public JSC::WeakHandleOwner {
     109        bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
    110110    };
    111111    WeakOwner m_weakOwner;
  • trunk/Source/WebCore/bindings/js/JSMutationObserverCustom.cpp

    r170167 r189616  
    6262}
    6363
    64 bool JSMutationObserverOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
     64bool JSMutationObserverOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
    6565{
    66     MutationObserver& observer = jsCast<JSMutationObserver*>(handle.slot()->asCell())->impl();
     66    MutationObserver& observer = jsCast<JSMutationObserver&>(cell).impl();
    6767    auto observedNodes = observer.getObservedNodes();
    6868    for (auto it = observedNodes.begin(), end = observedNodes.end(); it != end; ++it) {
  • trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp

    r188187 r189616  
    7676using namespace HTMLNames;
    7777
    78 static inline bool isReachableFromDOM(Node* node, SlotVisitor& visitor)
    79 {
    80     if (!node->inDocument()) {
    81         if (is<Element>(*node)) {
    82             auto& element = downcast<Element>(*node);
     78static inline bool isReachableFromDOM(Node& node, SlotVisitor& visitor)
     79{
     80    if (!node.inDocument()) {
     81        if (is<Element>(node)) {
     82            auto& element = downcast<Element>(node);
    8383
    8484            // If a wrapper is the last reference to an image element
     
    101101        // If a node is firing event listeners, its wrapper is observable because
    102102        // its wrapper is responsible for marking those event listeners.
    103         if (node->isFiringEventListeners())
     103        if (node.isFiringEventListeners())
    104104            return true;
    105105    }
    106106
    107     return visitor.containsOpaqueRoot(root(node));
    108 }
    109 
    110 bool JSNodeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    111 {
    112     JSNode* jsNode = jsCast<JSNode*>(handle.slot()->asCell());
    113     return isReachableFromDOM(&jsNode->impl(), visitor);
     107    return visitor.containsOpaqueRoot(root(&node));
     108}
     109
     110bool JSNodeOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     111{
     112    auto& jsNode = jsCast<JSNode&>(cell);
     113    return isReachableFromDOM(jsNode.impl(), visitor);
    114114}
    115115
  • trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp

    r188829 r189616  
    3838namespace WebCore {
    3939
    40 bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
     40bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
    4141{
    42     JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.slot()->asCell());
    43     if (!jsNodeList->hasCustomProperties())
     42    auto& jsNodeList = jsCast<JSNodeList&>(cell);
     43    if (!jsNodeList.hasCustomProperties())
    4444        return false;
    45     if (jsNodeList->impl().isLiveNodeList())
    46         return visitor.containsOpaqueRoot(root(static_cast<LiveNodeList&>(jsNodeList->impl()).ownerNode()));
    47     if (jsNodeList->impl().isChildNodeList())
    48         return visitor.containsOpaqueRoot(root(static_cast<ChildNodeList&>(jsNodeList->impl()).ownerNode()));
    49     if (jsNodeList->impl().isEmptyNodeList())
    50         return visitor.containsOpaqueRoot(root(static_cast<EmptyNodeList&>(jsNodeList->impl()).ownerNode()));
     45    if (jsNodeList.impl().isLiveNodeList())
     46        return visitor.containsOpaqueRoot(root(static_cast<LiveNodeList&>(jsNodeList.impl()).ownerNode()));
     47    if (jsNodeList.impl().isChildNodeList())
     48        return visitor.containsOpaqueRoot(root(static_cast<ChildNodeList&>(jsNodeList.impl()).ownerNode()));
     49    if (jsNodeList.impl().isEmptyNodeList())
     50        return visitor.containsOpaqueRoot(root(static_cast<EmptyNodeList&>(jsNodeList.impl()).ownerNode()));
    5151    return false;
    5252}
  • trunk/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp

    r167794 r189616  
    3939namespace WebCore {
    4040
    41 bool JSTextTrackCueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
     41bool JSTextTrackCueOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
    4242{
    43     JSTextTrackCue* jsTextTrackCue = jsCast<JSTextTrackCue*>(handle.slot()->asCell());
    44     TextTrackCue& textTrackCue = jsTextTrackCue->impl();
     43    auto& jsTextTrackCue = jsCast<JSTextTrackCue&>(cell);
     44    TextTrackCue& textTrackCue = jsTextTrackCue.impl();
    4545
    4646    // If the cue is firing event listeners, its wrapper is reachable because
     
    5050
    5151    // If the cue has no event listeners and has no custom properties, it is not reachable.
    52     if (!textTrackCue.hasEventListeners() && !jsTextTrackCue->hasCustomProperties())
     52    if (!textTrackCue.hasEventListeners() && !jsTextTrackCue.hasCustomProperties())
    5353        return false;
    5454
  • trunk/Source/WebCore/bindings/js/WebCoreTypedArrayController.cpp

    r165757 r189616  
    4848}
    4949
    50 bool WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, JSC::SlotVisitor& visitor)
     50bool WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, JSC::SlotVisitor& visitor)
    5151{
    52     auto& wrapper = *JSC::jsCast<JSC::JSArrayBuffer*>(handle.slot()->asCell());
     52    auto& wrapper = JSC::jsCast<JSC::JSArrayBuffer&>(cell);
    5353    if (!wrapper.hasCustomProperties())
    5454        return false;
     
    5656}
    5757
    58 void WebCoreTypedArrayController::JSArrayBufferOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
     58void WebCoreTypedArrayController::JSArrayBufferOwner::finalize(JSC::JSCell*& cell, void* context)
    5959{
    60     auto& wrapper = *static_cast<JSC::JSArrayBuffer*>(handle.slot()->asCell());
     60    auto& wrapper = static_cast<JSC::JSArrayBuffer&>(*cell);
    6161    auto& buffer = *wrapper.impl();
    6262    uncacheWrapper(*static_cast<DOMWrapperWorld*>(context), &buffer, &wrapper);
  • trunk/Source/WebCore/bindings/js/WebCoreTypedArrayController.h

    r166124 r189616  
    3636namespace WebCore {
    3737
    38 class WebCoreTypedArrayController : public JSC::TypedArrayController {
     38class WebCoreTypedArrayController final : public JSC::TypedArrayController {
    3939public:
    4040    WebCoreTypedArrayController();
     
    4646
    4747private:
    48     class JSArrayBufferOwner : public JSC::WeakHandleOwner {
     48    class JSArrayBufferOwner final : public JSC::WeakHandleOwner {
    4949    public:
    50         virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&) override;
    51         virtual void finalize(JSC::Handle<JSC::Unknown>, void* context) override;
     50        bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     51        void finalize(JSC::JSCell*&, void* context) override;
    5252    };
    5353
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r189507 r189616  
    11921192        $headerIncludes{"<wtf/NeverDestroyed.h>"} = 1;
    11931193        push(@headerContent, "public:\n");
    1194         push(@headerContent, "    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);\n");
    1195         push(@headerContent, "    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);\n");
     1194        push(@headerContent, "    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;\n");
     1195        push(@headerContent, "    void finalize(JSC::JSCell*&, void* context) override;\n");
    11961196        push(@headerContent, "};\n");
    11971197        push(@headerContent, "\n");
     
    29462946    if ((!$hasParent && !GetCustomIsReachable($interface)) || GetGenerateIsReachable($interface) || $codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
    29472947
    2948         push(@implContent, "bool JS${interfaceName}Owner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)\n");
     2948        push(@implContent, "bool JS${interfaceName}Owner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)\n");
    29492949        push(@implContent, "{\n");
    29502950        # All ActiveDOMObjects implement hasPendingActivity(), but not all of them
     
    29572957        my $emittedJSCast = 0;
    29582958        if ($codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
    2959             push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2959            push(@implContent, "    auto& js${interfaceName} = jsCast<JS${interfaceName}&>(cell);\n");
    29602960            $emittedJSCast = 1;
    2961             push(@implContent, "    if (js${interfaceName}->impl().hasPendingActivity())\n");
     2961            push(@implContent, "    if (js${interfaceName}.impl().hasPendingActivity())\n");
    29622962            push(@implContent, "        return true;\n");
    29632963        }
    29642964        if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
    29652965            if (!$emittedJSCast) {
    2966                 push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2966                push(@implContent, "    auto& js${interfaceName} = jsCast<JS${interfaceName}&>(cell);\n");
    29672967                $emittedJSCast = 1;
    29682968            }
    2969             push(@implContent, "    if (js${interfaceName}->impl().isFiringEventListeners())\n");
     2969            push(@implContent, "    if (js${interfaceName}.impl().isFiringEventListeners())\n");
    29702970            push(@implContent, "        return true;\n");
    29712971        }
    29722972        if ($codeGenerator->InheritsInterface($interface, "Node")) {
    29732973            if (!$emittedJSCast) {
    2974                 push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2974                push(@implContent, "    auto& js${interfaceName} = jsCast<JS${interfaceName}&>(cell);\n");
    29752975                $emittedJSCast = 1;
    29762976            }
    2977             push(@implContent, "    if (JSNodeOwner::isReachableFromOpaqueRoots(handle, 0, visitor))\n");
     2977            push(@implContent, "    if (JSNodeOwner::isReachableFromOpaqueRoots(cell, 0, visitor))\n");
    29782978            push(@implContent, "        return true;\n");
    29792979        }
    29802980        if (GetGenerateIsReachable($interface)) {
    29812981            if (!$emittedJSCast) {
    2982                 push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2982                push(@implContent, "    auto& js${interfaceName} = jsCast<JS${interfaceName}&>(cell);\n");
    29832983                $emittedJSCast = 1;
    29842984            }
     
    29862986            my $rootString;
    29872987            if (GetGenerateIsReachable($interface) eq "Impl") {
    2988                 $rootString  = "    ${implType}* root = &js${interfaceName}->impl();\n";
     2988                $rootString  = "    ${implType}* root = &js${interfaceName}.impl();\n";
    29892989            } elsif (GetGenerateIsReachable($interface) eq "ImplWebGLRenderingContext") {
    2990                 $rootString  = "    WebGLRenderingContextBase* root = WTF::getPtr(js${interfaceName}->impl().context());\n";
     2990                $rootString  = "    WebGLRenderingContextBase* root = WTF::getPtr(js${interfaceName}.impl().context());\n";
    29912991            } elsif (GetGenerateIsReachable($interface) eq "ImplFrame") {
    2992                 $rootString  = "    Frame* root = WTF::getPtr(js${interfaceName}->impl().frame());\n";
     2992                $rootString  = "    Frame* root = WTF::getPtr(js${interfaceName}.impl().frame());\n";
    29932993                $rootString .= "    if (!root)\n";
    29942994                $rootString .= "        return false;\n";
    29952995            } elsif (GetGenerateIsReachable($interface) eq "ImplDocument") {
    2996                 $rootString  = "    Document* root = WTF::getPtr(js${interfaceName}->impl().document());\n";
     2996                $rootString  = "    Document* root = WTF::getPtr(js${interfaceName}.impl().document());\n";
    29972997                $rootString .= "    if (!root)\n";
    29982998                $rootString .= "        return false;\n";
     
    30003000                $implIncludes{"Element.h"} = 1;
    30013001                $implIncludes{"JSNodeCustom.h"} = 1;
    3002                 $rootString  = "    Element* element = WTF::getPtr(js${interfaceName}->impl().element());\n";
     3002                $rootString  = "    Element* element = WTF::getPtr(js${interfaceName}.impl().element());\n";
    30033003                $rootString .= "    if (!element)\n";
    30043004                $rootString .= "        return false;\n";
     
    30073007                $implIncludes{"Element.h"} = 1;
    30083008                $implIncludes{"JSNodeCustom.h"} = 1;
    3009                 $rootString  = "    void* root = WebCore::root(js${interfaceName}->impl().canvas());\n";
     3009                $rootString  = "    void* root = WebCore::root(js${interfaceName}.impl().canvas());\n";
    30103010            } elsif (GetGenerateIsReachable($interface) eq "ImplOwnerNodeRoot") {
    30113011                $implIncludes{"Element.h"} = 1;
    30123012                $implIncludes{"JSNodeCustom.h"} = 1;
    3013                 $rootString  = "    void* root = WebCore::root(js${interfaceName}->impl().ownerNode());\n";
     3013                $rootString  = "    void* root = WebCore::root(js${interfaceName}.impl().ownerNode());\n";
    30143014            } else {
    3015                 $rootString  = "    void* root = WebCore::root(&js${interfaceName}->impl());\n";
     3015                $rootString  = "    void* root = WebCore::root(&js${interfaceName}.impl());\n";
    30163016            }
    30173017
     
    30203020        } else {
    30213021            if (!$emittedJSCast) {
    3022                 push(@implContent, "    UNUSED_PARAM(handle);\n");
     3022                push(@implContent, "    UNUSED_PARAM(cell);\n");
    30233023            }
    30243024            push(@implContent, "    UNUSED_PARAM(visitor);\n");
     
    30333033         GetCustomIsReachable($interface) ||
    30343034         $codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject"))) {
    3035         push(@implContent, "void JS${interfaceName}Owner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)\n");
     3035        push(@implContent, "void JS${interfaceName}Owner::finalize(JSC::JSCell*& cell, void* context)\n");
    30363036        push(@implContent, "{\n");
    3037         push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     3037        push(@implContent, "    auto& wrapper = jsCast<JS${interfaceName}&>(*cell);\n");
    30383038        push(@implContent, "    auto& world = *static_cast<DOMWrapperWorld*>(context);\n");
    3039         push(@implContent, "    uncacheWrapper(world, &js${interfaceName}->impl(), js${interfaceName});\n");
     3039        push(@implContent, "    uncacheWrapper(world, &wrapper.impl(), &wrapper);\n");
    30403040        push(@implContent, "}\n\n");
    30413041    }
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp

    r189188 r189616  
    241241}
    242242
    243 bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    244 {
    245     UNUSED_PARAM(handle);
     243bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     244{
     245    UNUSED_PARAM(cell);
    246246    UNUSED_PARAM(visitor);
    247247    return false;
    248248}
    249249
    250 void JSTestActiveDOMObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    251 {
    252     auto* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.slot()->asCell());
     250void JSTestActiveDOMObjectOwner::finalize(JSC::JSCell*& cell, void* context)
     251{
     252    auto& wrapper = jsCast<JSTestActiveDOMObject&>(*cell);
    253253    auto& world = *static_cast<DOMWrapperWorld*>(context);
    254     uncacheWrapper(world, &jsTestActiveDOMObject->impl(), jsTestActiveDOMObject);
     254    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    255255}
    256256
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h

    r184228 r189616  
    7373class JSTestActiveDOMObjectOwner : public JSC::WeakHandleOwner {
    7474public:
    75     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    76     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     75    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     76    void finalize(JSC::JSCell*&, void* context) override;
    7777};
    7878
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp

    r189188 r189616  
    158158}
    159159
    160 bool JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    161 {
    162     UNUSED_PARAM(handle);
     160bool JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     161{
     162    UNUSED_PARAM(cell);
    163163    UNUSED_PARAM(visitor);
    164164    return false;
    165165}
    166166
    167 void JSTestCustomConstructorWithNoInterfaceObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    168 {
    169     auto* jsTestCustomConstructorWithNoInterfaceObject = jsCast<JSTestCustomConstructorWithNoInterfaceObject*>(handle.slot()->asCell());
     167void JSTestCustomConstructorWithNoInterfaceObjectOwner::finalize(JSC::JSCell*& cell, void* context)
     168{
     169    auto& wrapper = jsCast<JSTestCustomConstructorWithNoInterfaceObject&>(*cell);
    170170    auto& world = *static_cast<DOMWrapperWorld*>(context);
    171     uncacheWrapper(world, &jsTestCustomConstructorWithNoInterfaceObject->impl(), jsTestCustomConstructorWithNoInterfaceObject);
     171    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    172172}
    173173
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h

    r184953 r189616  
    6969class JSTestCustomConstructorWithNoInterfaceObjectOwner : public JSC::WeakHandleOwner {
    7070public:
    71     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    72     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     71    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     72    void finalize(JSC::JSCell*&, void* context) override;
    7373};
    7474
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp

    r189188 r189616  
    226226}
    227227
    228 bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    229 {
    230     UNUSED_PARAM(handle);
     228bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     229{
     230    UNUSED_PARAM(cell);
    231231    UNUSED_PARAM(visitor);
    232232    return false;
    233233}
    234234
    235 void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    236 {
    237     auto* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.slot()->asCell());
     235void JSTestCustomNamedGetterOwner::finalize(JSC::JSCell*& cell, void* context)
     236{
     237    auto& wrapper = jsCast<JSTestCustomNamedGetter&>(*cell);
    238238    auto& world = *static_cast<DOMWrapperWorld*>(context);
    239     uncacheWrapper(world, &jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter);
     239    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    240240}
    241241
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h

    r188663 r189616  
    7676class JSTestCustomNamedGetterOwner : public JSC::WeakHandleOwner {
    7777public:
    78     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    79     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     78    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     79    void finalize(JSC::JSCell*&, void* context) override;
    8080};
    8181
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp

    r189188 r189616  
    242242}
    243243
    244 bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    245 {
    246     UNUSED_PARAM(handle);
     244bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     245{
     246    UNUSED_PARAM(cell);
    247247    UNUSED_PARAM(visitor);
    248248    return false;
    249249}
    250250
    251 void JSTestEventConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    252 {
    253     auto* jsTestEventConstructor = jsCast<JSTestEventConstructor*>(handle.slot()->asCell());
     251void JSTestEventConstructorOwner::finalize(JSC::JSCell*& cell, void* context)
     252{
     253    auto& wrapper = jsCast<JSTestEventConstructor&>(*cell);
    254254    auto& world = *static_cast<DOMWrapperWorld*>(context);
    255     uncacheWrapper(world, &jsTestEventConstructor->impl(), jsTestEventConstructor);
     255    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    256256}
    257257
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h

    r184228 r189616  
    7272class JSTestEventConstructorOwner : public JSC::WeakHandleOwner {
    7373public:
    74     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    75     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     74    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     75    void finalize(JSC::JSCell*&, void* context) override;
    7676};
    7777
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

    r189188 r189616  
    321321}
    322322
    323 bool JSTestEventTargetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    324 {
    325     auto* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.slot()->asCell());
    326     if (jsTestEventTarget->impl().isFiringEventListeners())
     323bool JSTestEventTargetOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     324{
     325    auto& jsTestEventTarget = jsCast<JSTestEventTarget&>(cell);
     326    if (jsTestEventTarget.impl().isFiringEventListeners())
    327327        return true;
    328328    UNUSED_PARAM(visitor);
     
    330330}
    331331
    332 void JSTestEventTargetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    333 {
    334     auto* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.slot()->asCell());
     332void JSTestEventTargetOwner::finalize(JSC::JSCell*& cell, void* context)
     333{
     334    auto& wrapper = jsCast<JSTestEventTarget&>(*cell);
    335335    auto& world = *static_cast<DOMWrapperWorld*>(context);
    336     uncacheWrapper(world, &jsTestEventTarget->impl(), jsTestEventTarget);
     336    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    337337}
    338338
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h

    r188663 r189616  
    8080class JSTestEventTargetOwner : public JSC::WeakHandleOwner {
    8181public:
    82     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    83     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     82    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     83    void finalize(JSC::JSCell*&, void* context) override;
    8484};
    8585
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp

    r189188 r189616  
    191191}
    192192
    193 bool JSTestExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    194 {
    195     UNUSED_PARAM(handle);
     193bool JSTestExceptionOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     194{
     195    UNUSED_PARAM(cell);
    196196    UNUSED_PARAM(visitor);
    197197    return false;
    198198}
    199199
    200 void JSTestExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    201 {
    202     auto* jsTestException = jsCast<JSTestException*>(handle.slot()->asCell());
     200void JSTestExceptionOwner::finalize(JSC::JSCell*& cell, void* context)
     201{
     202    auto& wrapper = jsCast<JSTestException&>(*cell);
    203203    auto& world = *static_cast<DOMWrapperWorld*>(context);
    204     uncacheWrapper(world, &jsTestException->impl(), jsTestException);
     204    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    205205}
    206206
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.h

    r184228 r189616  
    7474class JSTestExceptionOwner : public JSC::WeakHandleOwner {
    7575public:
    76     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    77     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     76    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     77    void finalize(JSC::JSCell*&, void* context) override;
    7878};
    7979
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp

    r189188 r189616  
    153153}
    154154
    155 bool JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    156 {
    157     auto* jsTestGenerateIsReachable = jsCast<JSTestGenerateIsReachable*>(handle.slot()->asCell());
    158     TestGenerateIsReachable* root = &jsTestGenerateIsReachable->impl();
     155bool JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     156{
     157    auto& jsTestGenerateIsReachable = jsCast<JSTestGenerateIsReachable&>(cell);
     158    TestGenerateIsReachable* root = &jsTestGenerateIsReachable.impl();
    159159    return visitor.containsOpaqueRoot(root);
    160160}
    161161
    162 void JSTestGenerateIsReachableOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    163 {
    164     auto* jsTestGenerateIsReachable = jsCast<JSTestGenerateIsReachable*>(handle.slot()->asCell());
     162void JSTestGenerateIsReachableOwner::finalize(JSC::JSCell*& cell, void* context)
     163{
     164    auto& wrapper = jsCast<JSTestGenerateIsReachable&>(*cell);
    165165    auto& world = *static_cast<DOMWrapperWorld*>(context);
    166     uncacheWrapper(world, &jsTestGenerateIsReachable->impl(), jsTestGenerateIsReachable);
     166    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    167167}
    168168
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h

    r184228 r189616  
    7070class JSTestGenerateIsReachableOwner : public JSC::WeakHandleOwner {
    7171public:
    72     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    73     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     72    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     73    void finalize(JSC::JSCell*&, void* context) override;
    7474};
    7575
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r189188 r189616  
    940940#endif
    941941
    942 bool JSTestInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    943 {
    944     auto* jsTestInterface = jsCast<JSTestInterface*>(handle.slot()->asCell());
    945     if (jsTestInterface->impl().hasPendingActivity())
     942bool JSTestInterfaceOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     943{
     944    auto& jsTestInterface = jsCast<JSTestInterface&>(cell);
     945    if (jsTestInterface.impl().hasPendingActivity())
    946946        return true;
    947947    UNUSED_PARAM(visitor);
     
    949949}
    950950
    951 void JSTestInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    952 {
    953     auto* jsTestInterface = jsCast<JSTestInterface*>(handle.slot()->asCell());
     951void JSTestInterfaceOwner::finalize(JSC::JSCell*& cell, void* context)
     952{
     953    auto& wrapper = jsCast<JSTestInterface&>(*cell);
    954954    auto& world = *static_cast<DOMWrapperWorld*>(context);
    955     uncacheWrapper(world, &jsTestInterface->impl(), jsTestInterface);
     955    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    956956}
    957957
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h

    r183523 r189616  
    100100class JSTestInterfaceOwner : public JSC::WeakHandleOwner {
    101101public:
    102     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    103     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     102    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     103    void finalize(JSC::JSCell*&, void* context) override;
    104104};
    105105
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp

    r189188 r189616  
    178178}
    179179
    180 bool JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    181 {
    182     UNUSED_PARAM(handle);
     180bool JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     181{
     182    UNUSED_PARAM(cell);
    183183    UNUSED_PARAM(visitor);
    184184    return false;
    185185}
    186186
    187 void JSTestMediaQueryListListenerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    188 {
    189     auto* jsTestMediaQueryListListener = jsCast<JSTestMediaQueryListListener*>(handle.slot()->asCell());
     187void JSTestMediaQueryListListenerOwner::finalize(JSC::JSCell*& cell, void* context)
     188{
     189    auto& wrapper = jsCast<JSTestMediaQueryListListener&>(*cell);
    190190    auto& world = *static_cast<DOMWrapperWorld*>(context);
    191     uncacheWrapper(world, &jsTestMediaQueryListListener->impl(), jsTestMediaQueryListListener);
     191    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    192192}
    193193
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h

    r184228 r189616  
    7070class JSTestMediaQueryListListenerOwner : public JSC::WeakHandleOwner {
    7171public:
    72     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    73     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     72    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     73    void finalize(JSC::JSCell*&, void* context) override;
    7474};
    7575
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp

    r189507 r189616  
    231231}
    232232
    233 bool JSTestNamedConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    234 {
    235     auto* jsTestNamedConstructor = jsCast<JSTestNamedConstructor*>(handle.slot()->asCell());
    236     if (jsTestNamedConstructor->impl().hasPendingActivity())
     233bool JSTestNamedConstructorOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     234{
     235    auto& jsTestNamedConstructor = jsCast<JSTestNamedConstructor&>(cell);
     236    if (jsTestNamedConstructor.impl().hasPendingActivity())
    237237        return true;
    238238    UNUSED_PARAM(visitor);
     
    240240}
    241241
    242 void JSTestNamedConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    243 {
    244     auto* jsTestNamedConstructor = jsCast<JSTestNamedConstructor*>(handle.slot()->asCell());
     242void JSTestNamedConstructorOwner::finalize(JSC::JSCell*& cell, void* context)
     243{
     244    auto& wrapper = jsCast<JSTestNamedConstructor&>(*cell);
    245245    auto& world = *static_cast<DOMWrapperWorld*>(context);
    246     uncacheWrapper(world, &jsTestNamedConstructor->impl(), jsTestNamedConstructor);
     246    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    247247}
    248248
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h

    r184228 r189616  
    7171class JSTestNamedConstructorOwner : public JSC::WeakHandleOwner {
    7272public:
    73     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    74     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     73    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     74    void finalize(JSC::JSCell*&, void* context) override;
    7575};
    7676
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp

    r189188 r189616  
    484484}
    485485
    486 bool JSTestNondeterministicOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    487 {
    488     UNUSED_PARAM(handle);
     486bool JSTestNondeterministicOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     487{
     488    UNUSED_PARAM(cell);
    489489    UNUSED_PARAM(visitor);
    490490    return false;
    491491}
    492492
    493 void JSTestNondeterministicOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    494 {
    495     auto* jsTestNondeterministic = jsCast<JSTestNondeterministic*>(handle.slot()->asCell());
     493void JSTestNondeterministicOwner::finalize(JSC::JSCell*& cell, void* context)
     494{
     495    auto& wrapper = jsCast<JSTestNondeterministic&>(*cell);
    496496    auto& world = *static_cast<DOMWrapperWorld*>(context);
    497     uncacheWrapper(world, &jsTestNondeterministic->impl(), jsTestNondeterministic);
     497    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    498498}
    499499
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h

    r184228 r189616  
    7070class JSTestNondeterministicOwner : public JSC::WeakHandleOwner {
    7171public:
    72     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    73     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     72    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     73    void finalize(JSC::JSCell*&, void* context) override;
    7474};
    7575
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r189507 r189616  
    46834683}
    46844684
    4685 bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    4686 {
    4687     UNUSED_PARAM(handle);
     4685bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     4686{
     4687    UNUSED_PARAM(cell);
    46884688    UNUSED_PARAM(visitor);
    46894689    return false;
    46904690}
    46914691
    4692 void JSTestObjOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    4693 {
    4694     auto* jsTestObj = jsCast<JSTestObj*>(handle.slot()->asCell());
     4692void JSTestObjOwner::finalize(JSC::JSCell*& cell, void* context)
     4693{
     4694    auto& wrapper = jsCast<JSTestObj&>(*cell);
    46954695    auto& world = *static_cast<DOMWrapperWorld*>(context);
    4696     uncacheWrapper(world, &jsTestObj->impl(), jsTestObj);
     4696    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    46974697}
    46984698
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r188334 r189616  
    8686class JSTestObjOwner : public JSC::WeakHandleOwner {
    8787public:
    88     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    89     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     88    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     89    void finalize(JSC::JSCell*&, void* context) override;
    9090};
    9191
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp

    r189188 r189616  
    247247}
    248248
    249 bool JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    250 {
    251     UNUSED_PARAM(handle);
     249bool JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     250{
     251    UNUSED_PARAM(cell);
    252252    UNUSED_PARAM(visitor);
    253253    return false;
    254254}
    255255
    256 void JSTestOverloadedConstructorsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    257 {
    258     auto* jsTestOverloadedConstructors = jsCast<JSTestOverloadedConstructors*>(handle.slot()->asCell());
     256void JSTestOverloadedConstructorsOwner::finalize(JSC::JSCell*& cell, void* context)
     257{
     258    auto& wrapper = jsCast<JSTestOverloadedConstructors&>(*cell);
    259259    auto& world = *static_cast<DOMWrapperWorld*>(context);
    260     uncacheWrapper(world, &jsTestOverloadedConstructors->impl(), jsTestOverloadedConstructors);
     260    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    261261}
    262262
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h

    r184228 r189616  
    7070class JSTestOverloadedConstructorsOwner : public JSC::WeakHandleOwner {
    7171public:
    72     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    73     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     72    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     73    void finalize(JSC::JSCell*&, void* context) override;
    7474};
    7575
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp

    r189188 r189616  
    222222}
    223223
    224 bool JSTestOverrideBuiltinsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    225 {
    226     UNUSED_PARAM(handle);
     224bool JSTestOverrideBuiltinsOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     225{
     226    UNUSED_PARAM(cell);
    227227    UNUSED_PARAM(visitor);
    228228    return false;
    229229}
    230230
    231 void JSTestOverrideBuiltinsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    232 {
    233     auto* jsTestOverrideBuiltins = jsCast<JSTestOverrideBuiltins*>(handle.slot()->asCell());
     231void JSTestOverrideBuiltinsOwner::finalize(JSC::JSCell*& cell, void* context)
     232{
     233    auto& wrapper = jsCast<JSTestOverrideBuiltins&>(*cell);
    234234    auto& world = *static_cast<DOMWrapperWorld*>(context);
    235     uncacheWrapper(world, &jsTestOverrideBuiltins->impl(), jsTestOverrideBuiltins);
     235    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    236236}
    237237
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.h

    r188663 r189616  
    7676class JSTestOverrideBuiltinsOwner : public JSC::WeakHandleOwner {
    7777public:
    78     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    79     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     78    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     79    void finalize(JSC::JSCell*&, void* context) override;
    8080};
    8181
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r189188 r189616  
    312312}
    313313
    314 bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    315 {
    316     UNUSED_PARAM(handle);
     314bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     315{
     316    UNUSED_PARAM(cell);
    317317    UNUSED_PARAM(visitor);
    318318    return false;
    319319}
    320320
    321 void JSTestSerializedScriptValueInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    322 {
    323     auto* jsTestSerializedScriptValueInterface = jsCast<JSTestSerializedScriptValueInterface*>(handle.slot()->asCell());
     321void JSTestSerializedScriptValueInterfaceOwner::finalize(JSC::JSCell*& cell, void* context)
     322{
     323    auto& wrapper = jsCast<JSTestSerializedScriptValueInterface&>(*cell);
    324324    auto& world = *static_cast<DOMWrapperWorld*>(context);
    325     uncacheWrapper(world, &jsTestSerializedScriptValueInterface->impl(), jsTestSerializedScriptValueInterface);
     325    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    326326}
    327327
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h

    r184228 r189616  
    7676class JSTestSerializedScriptValueInterfaceOwner : public JSC::WeakHandleOwner {
    7777public:
    78     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    79     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     78    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     79    void finalize(JSC::JSCell*&, void* context) override;
    8080};
    8181
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r189188 r189616  
    721721}
    722722
    723 bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    724 {
    725     UNUSED_PARAM(handle);
     723bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     724{
     725    UNUSED_PARAM(cell);
    726726    UNUSED_PARAM(visitor);
    727727    return false;
    728728}
    729729
    730 void JSTestTypedefsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    731 {
    732     auto* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.slot()->asCell());
     730void JSTestTypedefsOwner::finalize(JSC::JSCell*& cell, void* context)
     731{
     732    auto& wrapper = jsCast<JSTestTypedefs&>(*cell);
    733733    auto& world = *static_cast<DOMWrapperWorld*>(context);
    734     uncacheWrapper(world, &jsTestTypedefs->impl(), jsTestTypedefs);
     734    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    735735}
    736736
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h

    r184228 r189616  
    7373class JSTestTypedefsOwner : public JSC::WeakHandleOwner {
    7474public:
    75     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    76     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     75    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     76    void finalize(JSC::JSCell*&, void* context) override;
    7777};
    7878
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp

    r189188 r189616  
    174174}
    175175
    176 bool JSattributeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
    177 {
    178     UNUSED_PARAM(handle);
     176bool JSattributeOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
     177{
     178    UNUSED_PARAM(cell);
    179179    UNUSED_PARAM(visitor);
    180180    return false;
    181181}
    182182
    183 void JSattributeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    184 {
    185     auto* jsattribute = jsCast<JSattribute*>(handle.slot()->asCell());
     183void JSattributeOwner::finalize(JSC::JSCell*& cell, void* context)
     184{
     185    auto& wrapper = jsCast<JSattribute&>(*cell);
    186186    auto& world = *static_cast<DOMWrapperWorld*>(context);
    187     uncacheWrapper(world, &jsattribute->impl(), jsattribute);
     187    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    188188}
    189189
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.h

    r184228 r189616  
    7171class JSattributeOwner : public JSC::WeakHandleOwner {
    7272public:
    73     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    74     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     73    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     74    void finalize(JSC::JSCell*&, void* context) override;
    7575};
    7676
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp

    r189188 r189616  
    153153}
    154154
    155 bool JSreadonlyOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
     155bool JSreadonlyOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
    156156{
    157     UNUSED_PARAM(handle);
     157    UNUSED_PARAM(cell);
    158158    UNUSED_PARAM(visitor);
    159159    return false;
    160160}
    161161
    162 void JSreadonlyOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
     162void JSreadonlyOwner::finalize(JSC::JSCell*& cell, void* context)
    163163{
    164     auto* jsreadonly = jsCast<JSreadonly*>(handle.slot()->asCell());
     164    auto& wrapper = jsCast<JSreadonly&>(*cell);
    165165    auto& world = *static_cast<DOMWrapperWorld*>(context);
    166     uncacheWrapper(world, &jsreadonly->impl(), jsreadonly);
     166    uncacheWrapper(world, &wrapper.impl(), &wrapper);
    167167}
    168168
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h

    r184228 r189616  
    7070class JSreadonlyOwner : public JSC::WeakHandleOwner {
    7171public:
    72     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
    73     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     72    bool isReachableFromOpaqueRoots(JSC::JSCell&, void* context, JSC::SlotVisitor&) override;
     73    void finalize(JSC::JSCell*&, void* context) override;
    7474};
    7575
  • trunk/Source/WebCore/bridge/runtime_root.cpp

    r171371 r189616  
    197197}
    198198
    199 void RootObject::finalize(JSC::Handle<JSC::Unknown> handle, void*)
    200 {
    201     RuntimeObject* object = static_cast<RuntimeObject*>(handle.slot()->asCell());
     199void RootObject::finalize(JSC::JSCell*& cell, void*)
     200{
     201    RuntimeObject* object = jsCast<RuntimeObject*>(cell);
    202202
    203203    Ref<RootObject> protect(*this);
  • trunk/Source/WebCore/bridge/runtime_root.h

    r172814 r189616  
    8484
    8585    // WeakHandleOwner
    86     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context) override;
     86    void finalize(JSC::JSCell*&, void* context) override;
    8787
    8888    bool m_isValid;
  • trunk/Source/WebKit2/ChangeLog

    r189602 r189616  
     12015-09-11  Andreas Kling  <[email protected]>
     2
     3        [JSC] Weak should only accept cell pointees.
     4        <https://webkit.org/b/148955>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
     9        (WebKit::NPRuntimeObjectMap::finalize):
     10        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
     11
    1122015-09-10  Joseph Pecoraro  <[email protected]>
    213
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp

    r173696 r189616  
    306306}
    307307
    308 void NPRuntimeObjectMap::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    309 {
    310     JSNPObject* object = jsCast<JSNPObject*>(handle.get().asCell());
    311     weakRemove(m_jsNPObjects, static_cast<NPObject*>(context), object);
    312     addToInvalidationQueue(object->leakNPObject());
     308void NPRuntimeObjectMap::finalize(JSC::JSCell*& cell, void* context)
     309{
     310    JSNPObject& object = jsCast<JSNPObject&>(*cell);
     311    weakRemove(m_jsNPObjects, static_cast<NPObject*>(context), &object);
     312    addToInvalidationQueue(object.leakNPObject());
    313313}
    314314
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h

    r159001 r189616  
    5353
    5454// A per plug-in map of NPObjects that wrap JavaScript objects.
    55 class NPRuntimeObjectMap : private JSC::WeakHandleOwner {
     55class NPRuntimeObjectMap final : private JSC::WeakHandleOwner {
    5656public:
    5757    explicit NPRuntimeObjectMap(PluginView*);
     
    9191private:
    9292    // WeakHandleOwner
    93     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
     93    void finalize(JSC::JSCell*&, void* context) override;
     94
    9495    void addToInvalidationQueue(NPObject*);
    9596    void invalidateQueuedObjects();
Note: See TracChangeset for help on using the changeset viewer.