Title: [96342] trunk/Source/WebCore
Revision
96342
Author
[email protected]
Date
2011-09-29 11:04:21 -0700 (Thu, 29 Sep 2011)

Log Message

Shrink FontFallbackList.
https://bugs.webkit.org/show_bug.cgi?id=69093

Patch by Andreas Kling <[email protected]> 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96341 => 96342)


--- trunk/Source/WebCore/ChangeLog	2011-09-29 17:50:47 UTC (rev 96341)
+++ trunk/Source/WebCore/ChangeLog	2011-09-29 18:04:21 UTC (rev 96342)
@@ -1,3 +1,25 @@
+2011-09-29  Andreas Kling  <[email protected]>
+
+        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  <[email protected]>
 
         We should ignore the return value of GetRealNamedProperty

Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (96341 => 96342)


--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2011-09-29 17:50:47 UTC (rev 96341)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2011-09-29 18:04:21 UTC (rev 96342)
@@ -463,9 +463,9 @@
     gClients->remove(client);
 }
 
-static unsigned gGeneration = 0;
+static unsigned short gGeneration = 0;
 
-unsigned FontCache::generation()
+unsigned short FontCache::generation()
 {
     return gGeneration;
 }

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (96341 => 96342)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2011-09-29 17:50:47 UTC (rev 96341)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2011-09-29 18:04:21 UTC (rev 96342)
@@ -91,7 +91,7 @@
     void addClient(FontSelector*);
     void removeClient(FontSelector*);
 
-    unsigned generation();
+    unsigned short generation();
     void invalidate();
 
     size_t fontDataCount();

Modified: trunk/Source/WebCore/platform/graphics/FontFallbackList.cpp (96341 => 96342)


--- trunk/Source/WebCore/platform/graphics/FontFallbackList.cpp	2011-09-29 17:50:47 UTC (rev 96341)
+++ trunk/Source/WebCore/platform/graphics/FontFallbackList.cpp	2011-09-29 18:04:21 UTC (rev 96342)
@@ -40,9 +40,9 @@
     , m_cachedPrimarySimpleFontData(0)
     , m_fontSelector(0)
     , m_familyIndex(0)
+    , m_generation(fontCache()->generation())
     , m_pitch(UnknownPitch)
     , m_loadingCustomFonts(false)
-    , m_generation(fontCache()->generation())
 {
 }
 

Modified: trunk/Source/WebCore/platform/graphics/FontFallbackList.h (96341 => 96342)


--- trunk/Source/WebCore/platform/graphics/FontFallbackList.h	2011-09-29 17:50:47 UTC (rev 96341)
+++ trunk/Source/WebCore/platform/graphics/FontFallbackList.h	2011-09-29 18:04:21 UTC (rev 96342)
@@ -85,9 +85,9 @@
     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;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to