Title: [135001] trunk/Source/WebCore
Revision
135001
Author
e...@webkit.org
Date
2012-11-16 14:02:21 -0800 (Fri, 16 Nov 2012)

Log Message

Deploy ScriptWrappable to more always-wrapped objects
https://bugs.webkit.org/show_bug.cgi?id=102539

Reviewed by Adam Barth.

Add the ScriptWrappable baseclass to:
CSSStyleDeclaration (anttik tells me these should only be used from JS, even though some old Editing code used to use them)
ClientRect (element.getBoundingClientRects)
Event (Not all events end up wrapped, but any which live past dispatch do)
NodeList (this covers Static and Dynamic node list types, like document.all)
HTMLCollection (separate from NodeList, for things like table.rows)
Storage (for window.storage, always wrapped)
XMLHttpRequest (always wrapped, created from JS)

This should be a small memory savings as the inline pointer is only 4-8 bytes
instead of the hashmap entry which would be 8-16.  This may also show up
on benchmarks which repeatedly access these objects (like window.storage).

These were found by adding a couple lines of logging-code to
WebCore::createWrapper when we were in the main world, but took the
HashMap (instead of inline) storage path. I used sort and uniq -c
to find the most-frequently wrapped objects (while surfing
a few common sites) and came up with this list.  There are still a few
more complicated objects (like CSSStyleDeclaration) which may benifit
from inline-wrapper-access and will be covered in a later patch.

* css/CSSStyleDeclaration.h:
* dom/ClientRect.h:
* dom/Event.h:
* dom/NodeList.h:
* html/HTMLCollection.h:
* storage/Storage.h:
* xml/XMLHttpRequest.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135000 => 135001)


--- trunk/Source/WebCore/ChangeLog	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/ChangeLog	2012-11-16 22:02:21 UTC (rev 135001)
@@ -1,3 +1,39 @@
+2012-11-16  Eric Seidel  <e...@webkit.org>
+
+        Deploy ScriptWrappable to more always-wrapped objects
+        https://bugs.webkit.org/show_bug.cgi?id=102539
+
+        Reviewed by Adam Barth.
+
+        Add the ScriptWrappable baseclass to:
+        CSSStyleDeclaration (anttik tells me these should only be used from JS, even though some old Editing code used to use them)
+        ClientRect (element.getBoundingClientRects)
+        Event (Not all events end up wrapped, but any which live past dispatch do)
+        NodeList (this covers Static and Dynamic node list types, like document.all)
+        HTMLCollection (separate from NodeList, for things like table.rows)
+        Storage (for window.storage, always wrapped)
+        XMLHttpRequest (always wrapped, created from JS)
+
+        This should be a small memory savings as the inline pointer is only 4-8 bytes
+        instead of the hashmap entry which would be 8-16.  This may also show up
+        on benchmarks which repeatedly access these objects (like window.storage).
+
+        These were found by adding a couple lines of logging-code to
+        WebCore::createWrapper when we were in the main world, but took the
+        HashMap (instead of inline) storage path. I used sort and uniq -c
+        to find the most-frequently wrapped objects (while surfing
+        a few common sites) and came up with this list.  There are still a few
+        more complicated objects (like CSSStyleDeclaration) which may benifit
+        from inline-wrapper-access and will be covered in a later patch.
+
+        * css/CSSStyleDeclaration.h:
+        * dom/ClientRect.h:
+        * dom/Event.h:
+        * dom/NodeList.h:
+        * html/HTMLCollection.h:
+        * storage/Storage.h:
+        * xml/XMLHttpRequest.h:
+
 2012-11-16  Jon Lee  <jon...@apple.com>
 
         Simulated events instances do not all have the same underlying event

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (135000 => 135001)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -23,6 +23,7 @@
 
 #include "CSSPropertyNames.h"
 #include "CSSRule.h"
+#include "ScriptWrappable.h"
 #include "StylePropertySet.h"
 #include <wtf/Forward.h>
 
@@ -35,7 +36,7 @@
 
 typedef int ExceptionCode;
 
-class CSSStyleDeclaration {
+class CSSStyleDeclaration : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); WTF_MAKE_FAST_ALLOCATED;
 public:
     virtual ~CSSStyleDeclaration() { }

Modified: trunk/Source/WebCore/dom/ClientRect.h (135000 => 135001)


--- trunk/Source/WebCore/dom/ClientRect.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/dom/ClientRect.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -28,6 +28,7 @@
 #define ClientRect_h
 
 #include "FloatRect.h"
+#include "ScriptWrappable.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -35,7 +36,7 @@
 
     class IntRect; 
 
-    class ClientRect : public RefCounted<ClientRect> {
+    class ClientRect : public ScriptWrappable, public RefCounted<ClientRect> {
     public:
         static PassRefPtr<ClientRect> create() { return adoptRef(new ClientRect); }
         static PassRefPtr<ClientRect> create(const IntRect& rect) { return adoptRef(new ClientRect(rect)); }

Modified: trunk/Source/WebCore/dom/Event.h (135000 => 135001)


--- trunk/Source/WebCore/dom/Event.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/dom/Event.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -26,6 +26,7 @@
 
 #include "DOMTimeStamp.h"
 #include "EventNames.h"
+#include "ScriptWrappable.h"
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/RefCounted.h>
@@ -45,7 +46,7 @@
     bool cancelable;
 };
 
-class Event : public RefCounted<Event> {
+class Event : public ScriptWrappable, public RefCounted<Event> {
 public:
     enum PhaseType { 
         NONE                = 0,

Modified: trunk/Source/WebCore/dom/NodeList.h (135000 => 135001)


--- trunk/Source/WebCore/dom/NodeList.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/dom/NodeList.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -24,6 +24,7 @@
 #ifndef NodeList_h
 #define NodeList_h
 
+#include "ScriptWrappable.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 
@@ -31,7 +32,7 @@
 
     class Node;
 
-    class NodeList : public RefCounted<NodeList> {
+    class NodeList : public ScriptWrappable, public RefCounted<NodeList> {
     public:
         virtual ~NodeList() { }
 

Modified: trunk/Source/WebCore/html/HTMLCollection.h (135000 => 135001)


--- trunk/Source/WebCore/html/HTMLCollection.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/html/HTMLCollection.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -25,6 +25,7 @@
 
 #include "CollectionType.h"
 #include "DynamicNodeList.h"
+#include "ScriptWrappable.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/PassOwnPtr.h>
@@ -64,7 +65,7 @@
     friend class DynamicNodeListCacheBase;
 };
 
-class HTMLCollection : public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase {
+class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase {
 public:
     static PassRefPtr<HTMLCollection> create(Node* base, CollectionType);
     virtual ~HTMLCollection();

Modified: trunk/Source/WebCore/storage/Storage.h (135000 => 135001)


--- trunk/Source/WebCore/storage/Storage.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/storage/Storage.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -27,6 +27,7 @@
 #define Storage_h
 
 #include "DOMWindowProperty.h"
+#include "ScriptWrappable.h"
 #include "StorageArea.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
@@ -37,7 +38,7 @@
     class Frame;
     typedef int ExceptionCode;
 
-    class Storage : public RefCounted<Storage>, public DOMWindowProperty {
+    class Storage : public ScriptWrappable, public RefCounted<Storage>, public DOMWindowProperty {
     public:
         static PassRefPtr<Storage> create(Frame*, PassRefPtr<StorageArea>);
         ~Storage();

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (135000 => 135001)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2012-11-16 21:53:38 UTC (rev 135000)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2012-11-16 22:02:21 UTC (rev 135001)
@@ -28,6 +28,7 @@
 #include "EventTarget.h"
 #include "FormData.h"
 #include "ResourceResponse.h"
+#include "ScriptWrappable.h"
 #include "SecurityOrigin.h"
 #include "ThreadableLoaderClient.h"
 #include "XMLHttpRequestProgressEventThrottle.h"
@@ -46,7 +47,7 @@
 class TextResourceDecoder;
 class ThreadableLoader;
 
-class XMLHttpRequest : public RefCounted<XMLHttpRequest>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
+class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext*, PassRefPtr<SecurityOrigin> = 0);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to