Changeset 167577 in webkit
- Timestamp:
- Apr 20, 2014 9:19:07 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r167566 r167577 1 2014-04-20 Andreas Kling <akling@apple.com> 2 3 Speed up jsStringWithCache() through WeakGCMap inlining. 4 <https://webkit.org/b/131923> 5 6 Always inline WeakGCMap::add() but move the slow garbage collecting 7 path out-of-line. 8 9 Reviewed by Darin Adler. 10 11 * runtime/WeakGCMap.h: 12 (JSC::WeakGCMap::add): 13 (JSC::WeakGCMap::gcMap): 14 1 15 2014-04-20 László Langó <llango.u-szeged@partner.samsung.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/WeakGCMap.h
r157688 r167577 63 63 } 64 64 65 A ddResult add(const KeyType& key, ValueType value)65 ALWAYS_INLINE AddResult add(const KeyType& key, ValueType value) 66 66 { 67 67 gcMapIfNeeded(); 68 AddResult addResult = m_map. add(key, nullptr);68 AddResult addResult = m_map.fastAdd(key, nullptr); 69 69 if (!addResult.iterator->value) { // New value or found a zombie value. 70 70 addResult.isNewEntry = true; … … 106 106 static const int minGCThreshold = 3; 107 107 108 void gcMap()108 NEVER_INLINE void gcMap() 109 109 { 110 110 Vector<KeyType, 4> zombies; -
trunk/Source/WTF/ChangeLog
r167548 r167577 1 2014-04-20 Andreas Kling <akling@apple.com> 2 3 Speed up jsStringWithCache() through WeakGCMap inlining. 4 <https://webkit.org/b/131923> 5 6 Add HashMap::fastAdd(), which is the same as add() except we'll tell 7 the compiler to aggressively inline it. 8 9 Reviewed by Darin Adler. 10 11 * wtf/HashMap.h: 12 * wtf/HashTable.h: 13 1 14 2014-04-19 Filip Pizlo <fpizlo@apple.com> 2 15 -
trunk/Source/WTF/wtf/HashMap.h
r163519 r167577 115 115 template<typename V> AddResult add(KeyType&&, V&&); 116 116 117 // Same as add(), but aggressively inlined. 118 template<typename V> AddResult fastAdd(const KeyType&, V&&); 119 template<typename V> AddResult fastAdd(KeyType&&, V&&); 120 117 121 bool remove(const KeyType&); 118 122 bool remove(iterator); … … 277 281 template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> 278 282 template<typename K, typename V> 279 auto HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::inlineAdd(K&& key, V&& value) -> AddResult283 ALWAYS_INLINE auto HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::inlineAdd(K&& key, V&& value) -> AddResult 280 284 { 281 285 return m_impl.template add<HashMapTranslator<KeyValuePairTraits, HashFunctions>>(std::forward<K>(key), std::forward<V>(value)); … … 313 317 template<typename T> 314 318 auto HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::add(KeyType&& key, T&& mapped) -> AddResult 319 { 320 return inlineAdd(std::move(key), std::forward<T>(mapped)); 321 } 322 323 template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> 324 template<typename T> 325 ALWAYS_INLINE auto HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::fastAdd(const KeyType& key, T&& mapped) -> AddResult 326 { 327 return inlineAdd(key, std::forward<T>(mapped)); 328 } 329 330 template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> 331 template<typename T> 332 ALWAYS_INLINE auto HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::fastAdd(KeyType&& key, T&& mapped) -> AddResult 315 333 { 316 334 return inlineAdd(std::move(key), std::forward<T>(mapped)); -
trunk/Source/WTF/wtf/HashTable.h
r164378 r167577 784 784 template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> 785 785 template<typename HashTranslator, typename T, typename Extra> 786 inlineauto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::add(T&& key, Extra&& extra) -> AddResult786 ALWAYS_INLINE auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::add(T&& key, Extra&& extra) -> AddResult 787 787 { 788 788 checkKey<HashTranslator>(key); -
trunk/Source/WebCore/ChangeLog
r167575 r167577 1 2014-04-20 Andreas Kling <akling@apple.com> 2 3 Speed up jsStringWithCache() through WeakGCMap inlining. 4 <https://webkit.org/b/131923> 5 6 Inline the common path of WeakGCMap::add() in jsStringWithCache(). 7 26% progression on Bindings/id-getter.html 8 9 Reviewed by Darin Adler. 10 11 * WebCore.exp.in: 12 * bindings/js/JSDOMBinding.h: 13 * bindings/js/JSDOMBinding.cpp: 14 (WebCore::jsStringWithCache): 15 16 Move jsStringWithCache() out of line since we're now blowing up 17 its size quite a bit. 18 1 19 2014-04-20 Benjamin Poulain <benjamin@webkit.org> 2 20 -
trunk/Source/WebCore/WebCore.exp.in
r167568 r167577 747 747 __ZN7WebCore17drawLayerContentsEP9CGContextPNS_15PlatformCALayerERN3WTF6VectorINS_9FloatRectELm5ENS4_15CrashOnOverflowEEE 748 748 __ZN7WebCore17encodeForFileNameERKN3WTF6StringE 749 __ZN7WebCore17jsStringWithCacheEPN3JSC9ExecStateERKN3WTF6StringE 749 750 __ZN7WebCore17languageDidChangeEv 750 751 __ZN7WebCore17openTemporaryFileERKN3WTF6StringERi -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r166864 r167577 64 64 } 65 65 66 JSC::JSValue jsStringWithCache(JSC::ExecState* exec, const String& s) 67 { 68 StringImpl* stringImpl = s.impl(); 69 if (!stringImpl || !stringImpl->length()) 70 return jsEmptyString(exec); 71 72 if (stringImpl->length() == 1) { 73 UChar singleCharacter = (*stringImpl)[0u]; 74 if (singleCharacter <= JSC::maxSingleCharacterString) { 75 JSC::VM* vm = &exec->vm(); 76 return vm->smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter)); 77 } 78 } 79 80 JSStringCache& stringCache = currentWorld(exec).m_stringCache; 81 JSStringCache::AddResult addResult = stringCache.add(stringImpl, nullptr); 82 if (addResult.isNewEntry) 83 addResult.iterator->value = JSC::jsString(exec, String(stringImpl)); 84 return JSC::JSValue(addResult.iterator->value.get()); 85 } 86 66 87 JSValue jsStringOrNull(ExecState* exec, const String& s) 67 88 { -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r166864 r167577 560 560 JSC::EncodedJSValue objectToStringFunctionGetter(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName); 561 561 562 inline JSC::JSValue jsStringWithCache(JSC::ExecState* exec, const String& s)563 {564 StringImpl* stringImpl = s.impl();565 if (!stringImpl || !stringImpl->length())566 return jsEmptyString(exec);567 568 if (stringImpl->length() == 1) {569 UChar singleCharacter = (*stringImpl)[0u];570 if (singleCharacter <= JSC::maxSingleCharacterString) {571 JSC::VM* vm = &exec->vm();572 return vm->smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter));573 }574 }575 576 JSStringCache& stringCache = currentWorld(exec).m_stringCache;577 JSStringCache::AddResult addResult = stringCache.add(stringImpl, nullptr);578 if (addResult.isNewEntry)579 addResult.iterator->value = JSC::jsString(exec, String(stringImpl));580 return JSC::JSValue(addResult.iterator->value.get());581 }582 583 562 inline String propertyNameToString(JSC::PropertyName propertyName) 584 563 {
Note: See TracChangeset
for help on using the changeset viewer.