delete gFontPlatformDataCache;
529 void FontCache::invalidate() 530 { 531 if (!gClients) { 532 ASSERT(!gFontPlatformDataCache); 533 return; 534 } 535 536 if (gFontPlatformDataCache) { 537 deleteAllValues(*gFontPlatformDataCache); 538 delete gFontPlatformDataCache; <===================== 539 gFontPlatformDataCache = new FontPlatformDataCache; 540 } 541 542 gGeneration++; 543 544 Vector<RefPtr<FontSelector> > clients; 545 size_t numClients = gClients->size(); 546 clients.reserveInitialCapacity(numClients); 547 HashSet<FontSelector*>::iterator end = gClients->end(); 548 for (HashSet<FontSelector*>::iterator it = gClients->begin(); it != end; ++it) 549 clients.append(*it); 550 551 ASSERT(numClients == clients.size()); 552 for (size_t i = 0; i < numClients; ++i) 553 clients[i]->fontCacheInvalidated(); 554 555 purgeInactiveFontData(); 556 }
272 ~HashTable() 273 { 274 if (m_table) 275 deallocateTable(m_table, m_tableSize); m_tableSize = 64 276 }(gdb) print m_table $4 = ( WTF::HashTable< WebCore::FontPlatformDataCacheKey, WTF::KeyValuePair<WebCore::FontPlatformDataCacheKey, WebCore::FontPlatformData*>, WTF::KeyValuePairKeyExtractor< WTF::KeyValuePair<WebCore::FontPlatformDataCacheKey, WebCore::FontPlatformData*> >, WebCore::FontPlatformDataCacheKeyHash, WTF::HashMapValueTraits< WebCore::FontPlatformDataCacheKeyTraits, WTF::HashTraits<WebCore::FontPlatformData*> >, WebCore::FontPlatformDataCacheKeyTraits>::ValueType *) 0x7d4d2380870 template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> 871 void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::deallocateTable(ValueType* table, int size) 872 { 873 if (Traits::needsDestruction) { 874 for (int i = 0; i < size; ++i) { 875 if (!isDeletedBucket(table[i])) 876 table[i].~ValueType(); <===================== <WebCore::FontPlatformDataCacheKey::~FontPlatformDataCacheKey()> このデストラクタなのか。 877 } 878 } 879 fastFree(table); 880 }263 struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> { 265 static const bool needsDestruction = true; <====== 279 };
203 struct KeyValuePair { <==================ここを指してつぎへいく 204 typedef KeyTypeArg KeyType; 205 206 KeyValuePair() 207 { 208 } 209 210 KeyValuePair(const KeyTypeArg& key, const ValueTypeArg& value) 211 : key(key) 212 , value(value) 213 { 214 } 215 216 template <typename OtherKeyType, typename OtherValueType> 217 KeyValuePair(const KeyValuePair<OtherKeyType, OtherValueType>& other) 218 : key(other.key) 219 , value(other.value) 220 { 221 } 222 223 KeyTypeArg key; 224 ValueTypeArg value; 225 };
61 struct FontPlatformDataCacheKey { <==================ここを指してつぎへいく 62 WTF_MAKE_FAST_ALLOCATED; 63 public: 86 unsigned m_size; 87 unsigned m_weight; 88 AtomicString m_family; 89 bool m_italic; 90 bool m_printerFont; 91 FontOrientation m_orientation; 92 FontWidthVariant m_widthVariant; 93 94 private: 95 static unsigned hashTableDeletedSize() { return 0xFFFFFFFFU; } 96 };
38 template <typename CharType> 39 class StringBuffer { 40 WTF_MAKE_NONCOPYABLE(StringBuffer); 41 public: 50 ~StringBuffer() <===== 51 { 52 } 83 private: 84 RefPtr<StringImpl> m_data; 85 };
50 ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
42 template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr) 43 { 44 if (LIKELY(ptr != 0)) <===== 分岐予測 45 ptr->deref(); 46 }
164 /* LIKELY */ 165 166 #ifndef LIKELY 167 #if COMPILER(GCC) 168 #define LIKELY(x) __builtin_expect((x), 1) 169 #else 170 #define LIKELY(x) (x) 171 #endif 172 #endif
__builtin_expect(A,B)
と書いた場合 Aが定数 Bである事を期待する、というヒント情報になる。
例えば、条件に「likely」というマークが付いていれば、コンパイラーは (おそらく分岐命令によるジャンプはないであろう) 分岐命令の直後にコードの True の部分を配置することができ、条件の False の部分 (実行される可能性も低く、パフォーマンスも最適ではない部分) は分岐命令によってジャンプした先に配置されるようになります。このようにして、コードは最も可能性の高い場合に合わせて最適化されるというわけです。