Changeset 167605 in webkit
- Timestamp:
- Apr 21, 2014 12:17:14 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r167600 r167605 1 2014-04-21 Andreas Kling <akling@apple.com> 2 3 Move the JSString cache from DOMWrapperWorld to VM. 4 <https://webkit.org/b/131940> 5 6 Reviewed by Geoff Garen. 7 8 * runtime/VM.h: 9 1 10 2014-04-19 Filip Pizlo <fpizlo@apple.com> 2 11 -
trunk/Source/JavaScriptCore/runtime/VM.h
r166192 r167605 296 296 DateInstanceCache dateInstanceCache; 297 297 WTF::SimpleStats machineCodeBytesPerBytecodeWordForBaselineJIT; 298 WeakGCMap<StringImpl*, JSString, PtrHash<StringImpl*>> stringCache; 298 299 299 300 AtomicStringTable* atomicStringTable() const { return m_atomicStringTable; } -
trunk/Source/WebCore/ChangeLog
r167602 r167605 1 2014-04-21 Andreas Kling <akling@apple.com> 2 3 Move the JSString cache from DOMWrapperWorld to VM. 4 <https://webkit.org/b/131940> 5 6 Since there's no need for JSStrings to be world-specific, this patch 7 moves the string cache to JSC::VM. This makes jsStringWithCache() 8 a lot faster since it no longer has to jump through twenty-eleven 9 hoops to find the DOMWrapperWorld. 10 11 Reviewed by Geoff Garen. 12 13 * bindings/js/DOMWrapperWorld.cpp: 14 (WebCore::DOMWrapperWorld::clearWrappers): 15 * bindings/js/DOMWrapperWorld.h: 16 * bindings/js/JSDOMBinding.cpp: 17 (WebCore::jsStringWithCache): 18 1 19 2014-04-21 David Hyatt <hyatt@apple.com> 2 20 -
trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp
r165152 r167605 54 54 { 55 55 m_wrappers.clear(); 56 m_stringCache.clear();57 56 58 57 // These items are created lazily. -
trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h
r165152 r167605 24 24 25 25 #include "JSDOMGlobalObject.h" 26 #include <runtime/WeakGCMap.h>27 26 #include <wtf/Forward.h> 28 27 … … 34 33 35 34 typedef HashMap<void*, JSC::Weak<JSC::JSObject>> DOMObjectWrapperMap; 36 typedef JSC::WeakGCMap<StringImpl*, JSC::JSString, PtrHash<StringImpl*>> JSStringCache;37 35 38 36 class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { … … 52 50 // FIXME: can we make this private? 53 51 DOMObjectWrapperMap m_wrappers; 54 JSStringCache m_stringCache;55 52 HashMap<CSSValue*, void*> m_cssValueRoots; 56 53 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r167577 r167605 66 66 JSC::JSValue jsStringWithCache(JSC::ExecState* exec, const String& s) 67 67 { 68 JSC::VM& vm = exec->vm(); 68 69 StringImpl* stringImpl = s.impl(); 69 70 if (!stringImpl || !stringImpl->length()) 70 return jsEmptyString( exec);71 return jsEmptyString(&vm); 71 72 72 73 if (stringImpl->length() == 1) { 73 74 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); 75 if (singleCharacter <= JSC::maxSingleCharacterString) 76 return vm.smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter)); 77 } 78 79 auto addResult = vm.stringCache.add(stringImpl, nullptr); 82 80 if (addResult.isNewEntry) 83 addResult.iterator->value = JSC::jsString( exec, String(stringImpl));81 addResult.iterator->value = JSC::jsString(&vm, String(stringImpl)); 84 82 return JSC::JSValue(addResult.iterator->value.get()); 85 83 }
Note: See TracChangeset
for help on using the changeset viewer.