Skip to content
  • mark.lam@apple.com's avatar
    Change JSEventListener::m_jsFunction to be a weak ref. · 48d0136e
    mark.lam@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=101989.
    
    Reviewed by Geoffrey Garen.
    
    Source/JavaScriptCore: 
    
    Added infrastructure for scanning weak ref slots.
    
    * heap/SlotVisitor.cpp: Added #include "SlotVisitorInlines.h".
    * heap/SlotVisitor.h:
    (SlotVisitor): Added SlotVisitor::appendUnbarrieredWeak().
    * heap/SlotVisitorInlines.h: Added #include "Weak.h".
    (JSC::SlotVisitor::appendUnbarrieredWeak): Added.
    * heap/Weak.h:
    (JSC::operator==): Added operator==() for Weak.
    * runtime/JSCell.h: Removed #include "SlotVisitorInlines.h".
    * runtime/JSObject.h: Added #include "SlotVisitorInlines.h".
    
    Source/WebCore: 
    
    No new tests.
    
    * ForwardingHeaders/heap/SlotVisitor.h: Added.
    * bindings/js/JSDOMBinding.h: Added #include <heap/SlotVisitor.h>
    * bindings/js/JSEventListener.cpp:
    (WebCore::JSEventListener::JSEventListener):
    (WebCore::JSEventListener::visitJSFunction):
    (WebCore::JSEventListener::operator==):
     - Removed the m_wrapper checks in operator==() because they are not
       needed. There is no longer any threat of m_jsFunction pointing to
       recycled memory. The use of weak refs will ensure that m_jsFunction
       is either still holding on to its old memory exclusively, or is 0'ed
       out when the GC collects it.
    * bindings/js/JSEventListener.h:
    (JSEventListener):
    (WebCore::JSEventListener::jsFunction):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134697 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    48d0136e