Add finalizer to JSActivation
authormhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Nov 2011 22:04:07 +0000 (22:04 +0000)
committermhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Nov 2011 22:04:07 +0000 (22:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72575

Reviewed by Geoffrey Garen.

* runtime/JSActivation.cpp:
(JSC::JSActivation::finishCreation): Attach finalize function to objects during creation.
(JSC::JSActivation::finalize):
* runtime/JSActivation.h: Replaced virtual destructor with static finalize function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100672 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSActivation.cpp
Source/JavaScriptCore/runtime/JSActivation.h

index 1455471..bb7cd7d 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-17  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Add finalizer to JSActivation
+        https://bugs.webkit.org/show_bug.cgi?id=72575
+
+        Reviewed by Geoffrey Garen.
+
+        * runtime/JSActivation.cpp:
+        (JSC::JSActivation::finishCreation): Attach finalize function to objects during creation.
+        (JSC::JSActivation::finalize):
+        * runtime/JSActivation.h: Replaced virtual destructor with static finalize function.
+
 2011-11-15  Filip Pizlo  <fpizlo@apple.com>
 
         Code block jettisoning should be part of the GC's transitive closure
index a0a3193..f89359b 100644 (file)
@@ -56,11 +56,12 @@ void JSActivation::finishCreation(CallFrame* callFrame)
     // We have to manually ref and deref the symbol table as JSVariableObject
     // doesn't know about SharedSymbolTable
     static_cast<SharedSymbolTable*>(m_symbolTable)->ref();
+    callFrame->globalData().heap.addFinalizer(this, &finalize);
 }
 
-JSActivation::~JSActivation()
+void JSActivation::finalize(JSCell* cell)
 {
-    static_cast<SharedSymbolTable*>(m_symbolTable)->deref();
+    static_cast<SharedSymbolTable*>(jsCast<JSActivation*>(cell)->m_symbolTable)->deref();
 }
 
 void JSActivation::visitChildren(JSCell* cell, SlotVisitor& visitor)
index e05e758..14cabbd 100644 (file)
@@ -53,7 +53,7 @@ namespace JSC {
             return activation;
         }
 
-        virtual ~JSActivation();
+        static void finalize(JSCell*);
 
         static void visitChildren(JSCell*, SlotVisitor&);