Shrink FontFallbackList.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 18:04:21 +0000 (18:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 18:04:21 +0000 (18:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69093

Patch by Andreas Kling <kling@webkit.org> on 2011-09-29
Reviewed by Antti Koivisto.

Reduce the size of FontFallbackList by one CPU word, decreasing memory
consumption by 300 kB (on 64-bit) when loading the full HTML5 spec.

* platform/graphics/FontCache.h:
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::generation):

    Store the FontCache generation as an ushort rather than uint.

* platform/graphics/FontFallbackList.cpp:
(WebCore::FontFallbackList::FontFallbackList):
* platform/graphics/FontFallbackList.h:

    Pack enum and bool members in a bitfield.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontFallbackList.cpp
Source/WebCore/platform/graphics/FontFallbackList.h

index 0623e89..8d32c1b 100644 (file)
@@ -1,3 +1,25 @@
+2011-09-29  Andreas Kling  <kling@webkit.org>
+
+        Shrink FontFallbackList.
+        https://bugs.webkit.org/show_bug.cgi?id=69093
+
+        Reviewed by Antti Koivisto.
+
+        Reduce the size of FontFallbackList by one CPU word, decreasing memory
+        consumption by 300 kB (on 64-bit) when loading the full HTML5 spec.
+
+        * platform/graphics/FontCache.h:
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontCache::generation):
+
+            Store the FontCache generation as an ushort rather than uint.
+
+        * platform/graphics/FontFallbackList.cpp:
+        (WebCore::FontFallbackList::FontFallbackList):
+        * platform/graphics/FontFallbackList.h:
+
+            Pack enum and bool members in a bitfield.
+
 2011-09-29  Adam Barth  <abarth@webkit.org>
 
         We should ignore the return value of GetRealNamedProperty
index 92cb7d9..74663c7 100644 (file)
@@ -463,9 +463,9 @@ void FontCache::removeClient(FontSelector* client)
     gClients->remove(client);
 }
 
-static unsigned gGeneration = 0;
+static unsigned short gGeneration = 0;
 
-unsigned FontCache::generation()
+unsigned short FontCache::generation()
 {
     return gGeneration;
 }
index e34c9f1..ed399bb 100644 (file)
@@ -91,7 +91,7 @@ public:
     void addClient(FontSelector*);
     void removeClient(FontSelector*);
 
-    unsigned generation();
+    unsigned short generation();
     void invalidate();
 
     size_t fontDataCount();
index 7df58d9..2f1b68f 100644 (file)
@@ -40,9 +40,9 @@ FontFallbackList::FontFallbackList()
     , m_cachedPrimarySimpleFontData(0)
     , m_fontSelector(0)
     , m_familyIndex(0)
+    , m_generation(fontCache()->generation())
     , m_pitch(UnknownPitch)
     , m_loadingCustomFonts(false)
-    , m_generation(fontCache()->generation())
 {
 }
 
index 9ccfa5a..459baba 100644 (file)
@@ -85,9 +85,9 @@ private:
     mutable const SimpleFontData* m_cachedPrimarySimpleFontData;
     RefPtr<FontSelector> m_fontSelector;
     mutable int m_familyIndex;
-    mutable Pitch m_pitch;
-    mutable bool m_loadingCustomFonts;
-    unsigned m_generation;
+    unsigned short m_generation;
+    mutable Pitch m_pitch : 3;
+    mutable bool m_loadingCustomFonts : 1;
 
     friend class Font;
 };