Title: [134460] trunk/Source/_javascript_Core
Revision
134460
Author
[email protected]
Date
2012-11-13 11:58:18 -0800 (Tue, 13 Nov 2012)

Log Message

JSFunction and its descendants should be destructible
https://bugs.webkit.org/show_bug.cgi?id=102062

Reviewed by Mark Hahnenberg.

This will make it easy to place an InlineWatchpointSet inside JSFunction. In the
future, we could make JSFunction non-destructible again by making a version of
WatchpointSet that is entirely GC'd, but this seems like overkill for now.
        
This is performance-neutral.

* runtime/JSBoundFunction.cpp:
(JSC::JSBoundFunction::destroy):
(JSC):
* runtime/JSBoundFunction.h:
(JSBoundFunction):
* runtime/JSFunction.cpp:
(JSC):
(JSC::JSFunction::destroy):
* runtime/JSFunction.h:
(JSFunction):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (134459 => 134460)


--- trunk/Source/_javascript_Core/ChangeLog	2012-11-13 19:55:34 UTC (rev 134459)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-11-13 19:58:18 UTC (rev 134460)
@@ -1,3 +1,27 @@
+2012-11-13  Filip Pizlo  <[email protected]>
+
+        JSFunction and its descendants should be destructible
+        https://bugs.webkit.org/show_bug.cgi?id=102062
+
+        Reviewed by Mark Hahnenberg.
+
+        This will make it easy to place an InlineWatchpointSet inside JSFunction. In the
+        future, we could make JSFunction non-destructible again by making a version of
+        WatchpointSet that is entirely GC'd, but this seems like overkill for now.
+        
+        This is performance-neutral.
+
+        * runtime/JSBoundFunction.cpp:
+        (JSC::JSBoundFunction::destroy):
+        (JSC):
+        * runtime/JSBoundFunction.h:
+        (JSBoundFunction):
+        * runtime/JSFunction.cpp:
+        (JSC):
+        (JSC::JSFunction::destroy):
+        * runtime/JSFunction.h:
+        (JSFunction):
+
 2012-11-13  Cosmin Truta  <[email protected]>
 
         Uninitialized fields in class JSLock

Modified: trunk/Source/_javascript_Core/runtime/JSBoundFunction.cpp (134459 => 134460)


--- trunk/Source/_javascript_Core/runtime/JSBoundFunction.cpp	2012-11-13 19:55:34 UTC (rev 134459)
+++ trunk/Source/_javascript_Core/runtime/JSBoundFunction.cpp	2012-11-13 19:58:18 UTC (rev 134460)
@@ -88,6 +88,11 @@
     return function;
 }
 
+void JSBoundFunction::destroy(JSCell* cell)
+{
+    static_cast<JSBoundFunction*>(cell)->JSBoundFunction::~JSBoundFunction();
+}
+
 bool JSBoundFunction::customHasInstance(JSObject* object, ExecState* exec, JSValue value)
 {
     return jsCast<JSBoundFunction*>(object)->m_targetFunction->hasInstance(exec, value);

Modified: trunk/Source/_javascript_Core/runtime/JSBoundFunction.h (134459 => 134460)


--- trunk/Source/_javascript_Core/runtime/JSBoundFunction.h	2012-11-13 19:55:34 UTC (rev 134459)
+++ trunk/Source/_javascript_Core/runtime/JSBoundFunction.h	2012-11-13 19:58:18 UTC (rev 134460)
@@ -38,6 +38,8 @@
     typedef JSFunction Base;
 
     static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const String&);
+    
+    static void destroy(JSCell*);
 
     static bool customHasInstance(JSObject*, ExecState*, JSValue);
 

Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (134459 => 134460)


--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2012-11-13 19:55:34 UTC (rev 134459)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2012-11-13 19:58:18 UTC (rev 134460)
@@ -48,8 +48,6 @@
     return throwVMError(exec, createNotAConstructorError(exec, exec->callee()));
 }
 
-ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSFunction);
-
 const ClassInfo JSFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSFunction) };
 
 bool JSFunction::isHostFunctionNonInline() const
@@ -76,6 +74,11 @@
     return function;
 }
 
+void JSFunction::destroy(JSCell* cell)
+{
+    static_cast<JSFunction*>(cell)->JSFunction::~JSFunction();
+}
+
 JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
     : Base(exec->globalData(), structure)
     , m_executable()

Modified: trunk/Source/_javascript_Core/runtime/JSFunction.h (134459 => 134460)


--- trunk/Source/_javascript_Core/runtime/JSFunction.h	2012-11-13 19:55:34 UTC (rev 134459)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.h	2012-11-13 19:58:18 UTC (rev 134460)
@@ -25,6 +25,7 @@
 #define JSFunction_h
 
 #include "InternalFunction.h"
+#include "JSDestructibleObject.h"
 #include "JSScope.h"
 
 namespace JSC {
@@ -46,14 +47,14 @@
 
     JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
     
-    class JSFunction : public JSNonFinalObject {
+    class JSFunction : public JSDestructibleObject {
         friend class JIT;
         friend class DFG::SpeculativeJIT;
         friend class DFG::JITCompiler;
         friend class JSGlobalData;
 
     public:
-        typedef JSNonFinalObject Base;
+        typedef JSDestructibleObject Base;
 
         JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
 
@@ -66,6 +67,8 @@
             return function;
         }
         
+        static void destroy(JSCell*);
+        
         JS_EXPORT_PRIVATE String name(ExecState*);
         JS_EXPORT_PRIVATE String displayName(ExecState*);
         const String calculatedDisplayName(ExecState*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to