Changeset 178853 in webkit


Ignore:
Timestamp:
Jan 21, 2015 11:33:14 AM (9 years ago)
Author:
Antti Koivisto
Message:

REGRESSION(r178180): Membuster regressed ~4%
https://bugs.webkit.org/show_bug.cgi?id=140495

Reviewed by Andreas Kling.

After r178180 we keep system fallback fonts that are used on glyph pages alive.
Previously we would traverse the glyph pages and remove entries referencing system fallbacks.

  • platform/graphics/FontCache.cpp:

(WebCore::FontCache::purgeInactiveFontData):

  • platform/graphics/FontCascade.cpp:

(WebCore::pruneUnreferencedEntriesFromFontGlyphsCache):
(WebCore::pruneSystemFallbackFonts):

  • platform/graphics/FontCascade.h:
  • platform/graphics/FontGlyphs.cpp:

(WebCore::FontGlyphs::pruneSystemFallbacks):

When clearing the font cache also remove the cached glyph pages that may contain system fallback fonts
and release the fallbacks.

  • platform/graphics/FontGlyphs.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r178822 r178853  
     12015-01-20  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION(r178180): Membuster regressed ~4%
     4        https://bugs.webkit.org/show_bug.cgi?id=140495
     5
     6        Reviewed by Andreas Kling.
     7
     8        After r178180 we keep system fallback fonts that are used on glyph pages alive.
     9        Previously we would traverse the glyph pages and remove entries referencing system fallbacks.
     10
     11        * platform/graphics/FontCache.cpp:
     12        (WebCore::FontCache::purgeInactiveFontData):
     13        * platform/graphics/FontCascade.cpp:
     14        (WebCore::pruneUnreferencedEntriesFromFontGlyphsCache):
     15        (WebCore::pruneSystemFallbackFonts):
     16        * platform/graphics/FontCascade.h:
     17        * platform/graphics/FontGlyphs.cpp:
     18        (WebCore::FontGlyphs::pruneSystemFallbacks):
     19
     20            When clearing the font cache also remove the cached glyph pages that may contain system fallback fonts
     21            and release the fallbacks.
     22
     23        * platform/graphics/FontGlyphs.h:
     24
    1252015-01-21  Manuel Rego Casasnovas  <rego@igalia.com>
    226
  • trunk/Source/WebCore/platform/graphics/FontCache.cpp

    r178673 r178853  
    428428{
    429429    pruneUnreferencedEntriesFromFontGlyphsCache();
     430    pruneSystemFallbackFonts();
    430431
    431432#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r178578 r178853  
    288288void pruneUnreferencedEntriesFromFontGlyphsCache()
    289289{
    290     Vector<unsigned, 50> toRemove;
    291     FontGlyphsCache::iterator end = fontGlyphsCache().end();
    292     for (FontGlyphsCache::iterator it = fontGlyphsCache().begin(); it != end; ++it) {
    293         if (it->value->glyphs.get().hasOneRef())
    294             toRemove.append(it->key);
    295     }
    296     for (unsigned i = 0; i < toRemove.size(); ++i)
    297         fontGlyphsCache().remove(toRemove[i]);
     290    fontGlyphsCache().removeIf([](FontGlyphsCache::KeyValuePairType& entry) {
     291        return entry.value->glyphs.get().hasOneRef();
     292    });
     293}
     294
     295void pruneSystemFallbackFonts()
     296{
     297    for (auto& entry : fontGlyphsCache().values())
     298        entry->glyphs->pruneSystemFallbacks();
    298299}
    299300
  • trunk/Source/WebCore/platform/graphics/FontCascade.h

    r178510 r178853  
    346346void invalidateFontGlyphsCache();
    347347void pruneUnreferencedEntriesFromFontGlyphsCache();
     348void pruneSystemFallbackFonts();
    348349void clearWidthCaches();
    349350
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp

    r178510 r178853  
    393393}
    394394
    395 }
     395void FontGlyphs::pruneSystemFallbacks()
     396{
     397    if (m_systemFallbackFontDataSet.isEmpty())
     398        return;
     399    // Mutable glyph pages may reference fallback fonts.
     400    if (m_cachedPageZero && !m_cachedPageZero->isImmutable())
     401        m_cachedPageZero = nullptr;
     402    m_cachedPages.removeIf([](decltype(m_cachedPages)::KeyValuePairType& keyAndValue) {
     403        return !keyAndValue.value->isImmutable();
     404    });
     405    m_systemFallbackFontDataSet.clear();
     406}
     407
     408}
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.h

    r178388 r178853  
    7070    WEBCORE_EXPORT const FontRanges& realizeFallbackRangesAt(const FontDescription&, unsigned fallbackIndex);
    7171
     72    void pruneSystemFallbacks();
     73
    7274private:
    7375    FontGlyphs(PassRefPtr<FontSelector>);
Note: See TracChangeset for help on using the changeset viewer.