Unreviewed, roll out r187615 as it seems to have caused a ~1% PLT regression.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2015 01:50:04 +0000 (01:50 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2015 01:50:04 +0000 (01:50 +0000)
<rdar://problem/22657123>

* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::makeFlagsKey):
* platform/graphics/FontCascade.cpp:
(WebCore::operator==):
(WebCore::makeFontSelectorFlags):
(WebCore::makeFontCascadeCacheKey):
(WebCore::computeFontCascadeCacheHash):

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

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

index 2b13666..a18ac53 100644 (file)
@@ -1,3 +1,16 @@
+2015-09-24  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, roll out r187615 as it seems to have caused a ~1% PLT regression.
+        <rdar://problem/22657123>
+
+        * platform/graphics/FontCache.h:
+        (WebCore::FontDescriptionKey::makeFlagsKey):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::operator==):
+        (WebCore::makeFontSelectorFlags):
+        (WebCore::makeFontCascadeCacheKey):
+        (WebCore::computeFontCascadeCacheHash):
+
 2015-09-24  David Hyatt  <hyatt@apple.com>
 
         Keep the already-parsed list of terms in custom property values so that we don't have to re-parse them
index 9473ab1..1f23cd4 100644 (file)
@@ -112,10 +112,7 @@ private:
     static std::array<unsigned, 2> makeFlagsKey(const FontDescription& description)
     {
         static_assert(USCRIPT_CODE_LIMIT < 0x1000, "Script code must fit in an unsigned along with the other flags");
-        unsigned first = static_cast<unsigned>(description.script()) << 11
-            | static_cast<unsigned>(description.textRenderingMode()) << 9
-            | static_cast<unsigned>(description.smallCaps()) << 8
-            | static_cast<unsigned>(description.fontSynthesis()) << 6
+        unsigned first = static_cast<unsigned>(description.textRenderingMode()) << 6
             | static_cast<unsigned>(description.widthVariant()) << 4
             | static_cast<unsigned>(description.nonCJKGlyphOrientation()) << 3
             | static_cast<unsigned>(description.orientation()) << 2
index 465facf..e0b9b1f 100644 (file)
@@ -183,6 +183,7 @@ struct FontCascadeCacheKey {
     Vector<AtomicString, 3> families;
     unsigned fontSelectorId;
     unsigned fontSelectorVersion;
+    unsigned fontSelectorFlags;
 };
 
 struct FontCascadeCacheEntry {
@@ -202,7 +203,7 @@ static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey&
 {
     if (a.fontDescriptionKey != b.fontDescriptionKey)
         return false;
-    if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion)
+    if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion|| a.fontSelectorFlags != b.fontSelectorFlags)
         return false;
     if (a.families.size() != b.families.size())
         return false;
@@ -230,6 +231,11 @@ void clearWidthCaches()
         value->fonts.get().widthCache().clear();
 }
 
+static unsigned makeFontSelectorFlags(const FontDescription& description)
+{
+    return static_cast<unsigned>(description.script()) << 1 | static_cast<unsigned>(description.smallCaps());
+}
+
 static FontCascadeCacheKey makeFontCascadeCacheKey(const FontCascadeDescription& description, FontSelector* fontSelector)
 {
     FontCascadeCacheKey key;
@@ -238,6 +244,7 @@ static FontCascadeCacheKey makeFontCascadeCacheKey(const FontCascadeDescription&
         key.families.append(description.familyAt(i));
     key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0;
     key.fontSelectorVersion = fontSelector ? fontSelector->version() : 0;
+    key.fontSelectorFlags = fontSelector && fontSelector->resolvesFamilyFor(description) ? makeFontSelectorFlags(description) : 0;
     return key;
 }
 
@@ -250,6 +257,7 @@ static unsigned computeFontCascadeCacheHash(const FontCascadeCacheKey& key)
     hashCodes.uncheckedAppend(key.fontDescriptionKey.computeHash());
     hashCodes.uncheckedAppend(key.fontSelectorId);
     hashCodes.uncheckedAppend(key.fontSelectorVersion);
+    hashCodes.uncheckedAppend(key.fontSelectorFlags);
     for (unsigned i = 0; i < key.families.size(); ++i)
         hashCodes.uncheckedAppend(key.families[i].impl() ? CaseFoldingHash::hash(key.families[i]) : 0);