Title: [99734] trunk/Source/WebCore
Revision
99734
Author
andreas.kl...@nokia.com
Date
2011-11-09 10:14:09 -0800 (Wed, 09 Nov 2011)

Log Message

Shrink HTMLCollection.
<http://webkit.org/b/71928>

Reviewed by Darin Adler.

Rearrange the members of HTMLCollection, effectively shrinking
it by 16 bytes on 64-bit. This reduces memory consumption
by 531 kB when loading the full HTML5 spec.

On 32-bit it shrinks by 8 bytes, saving 265 kB.

* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::HTMLCollection):
* html/HTMLCollection.h:
(WebCore::HTMLCollection::type):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99733 => 99734)


--- trunk/Source/WebCore/ChangeLog	2011-11-09 18:11:47 UTC (rev 99733)
+++ trunk/Source/WebCore/ChangeLog	2011-11-09 18:14:09 UTC (rev 99734)
@@ -1,3 +1,21 @@
+2011-11-09  Andreas Kling  <kl...@webkit.org>
+
+        Shrink HTMLCollection.
+        <http://webkit.org/b/71928>
+
+        Reviewed by Darin Adler.
+
+        Rearrange the members of HTMLCollection, effectively shrinking
+        it by 16 bytes on 64-bit. This reduces memory consumption
+        by 531 kB when loading the full HTML5 spec.
+
+        On 32-bit it shrinks by 8 bytes, saving 265 kB.
+
+        * html/HTMLCollection.cpp:
+        (WebCore::HTMLCollection::HTMLCollection):
+        * html/HTMLCollection.h:
+        (WebCore::HTMLCollection::type):
+
 2011-11-09  Kentaro Hara  <hara...@chromium.org>
 
         Remove redundant [CanBeConstructed] IDLs

Modified: trunk/Source/WebCore/html/HTMLCollection.cpp (99733 => 99734)


--- trunk/Source/WebCore/html/HTMLCollection.cpp	2011-11-09 18:11:47 UTC (rev 99733)
+++ trunk/Source/WebCore/html/HTMLCollection.cpp	2011-11-09 18:14:09 UTC (rev 99734)
@@ -38,19 +38,19 @@
 
 HTMLCollection::HTMLCollection(PassRefPtr<Node> base, CollectionType type)
     : m_idsDone(false)
+    , m_ownsInfo(false)
+    , m_type(type)
     , m_base(base)
-    , m_type(type)
     , m_info(m_base->isDocumentNode() ? static_cast<Document*>(m_base.get())->collectionInfo(type) : 0)
-    , m_ownsInfo(false)
 {
 }
 
 HTMLCollection::HTMLCollection(PassRefPtr<Node> base, CollectionType type, CollectionCache* info)
     : m_idsDone(false)
+    , m_ownsInfo(false)
+    , m_type(type)
     , m_base(base)
-    , m_type(type)
     , m_info(info)
-    , m_ownsInfo(false)
 {
 }
 

Modified: trunk/Source/WebCore/html/HTMLCollection.h (99733 => 99734)


--- trunk/Source/WebCore/html/HTMLCollection.h	2011-11-09 18:11:47 UTC (rev 99733)
+++ trunk/Source/WebCore/html/HTMLCollection.h	2011-11-09 18:14:09 UTC (rev 99734)
@@ -57,7 +57,7 @@
     PassRefPtr<NodeList> tags(const String&);
 
     Node* base() const { return m_base.get(); }
-    CollectionType type() const { return m_type; }
+    CollectionType type() const { return static_cast<CollectionType>(m_type); }
 
 protected:
     HTMLCollection(PassRefPtr<Node> base, CollectionType, CollectionCache*);
@@ -66,7 +66,7 @@
     CollectionCache* info() const { return m_info; }
     void resetCollectionInfo() const;
 
-    mutable bool m_idsDone; // for nextNamedItem()
+    mutable bool m_idsDone : 1; // for nextNamedItem()
 
 private:
     virtual Element* itemAfter(Element*) const;
@@ -74,12 +74,12 @@
     virtual void updateNameCache() const;
 
     bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const;
+    mutable bool m_ownsInfo : 1;
+    unsigned m_type : 5; // CollectionType
 
     RefPtr<Node> m_base;
-    CollectionType m_type;
 
     mutable CollectionCache* m_info;
-    mutable bool m_ownsInfo;
 };
 
 } // namespace
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to