Change JSEventListener::m_jsFunction to be a weak ref.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2012 01:01:41 +0000 (01:01 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2012 01:01:41 +0000 (01:01 +0000)
commit48d0136edd37ecda000ca4fff9ad9e395e96aa6c
treeee840e778b49b3e027870024dc861c347aaddf19
parent7422394e1efc2cc739b92fbc490ecb522cb57440
Change JSEventListener::m_jsFunction to be a weak ref.
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
12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/SlotVisitor.cpp
Source/JavaScriptCore/heap/SlotVisitor.h
Source/JavaScriptCore/heap/SlotVisitorInlines.h
Source/JavaScriptCore/heap/Weak.h
Source/JavaScriptCore/runtime/JSCell.h
Source/JavaScriptCore/runtime/JSObject.h
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/heap/SlotVisitor.h [new file with mode: 0644]
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSEventListener.cpp
Source/WebCore/bindings/js/JSEventListener.h