Title: [167605] trunk/Source
- Revision
- 167605
- Author
- [email protected]
- Date
- 2014-04-21 12:17:14 -0700 (Mon, 21 Apr 2014)
Log Message
Move the JSString cache from DOMWrapperWorld to VM.
<https://webkit.org/b/131940>
Source/_javascript_Core:
Reviewed by Geoff Garen.
* runtime/VM.h:
Source/WebCore:
Since there's no need for JSStrings to be world-specific, this patch
moves the string cache to JSC::VM. This makes jsStringWithCache()
a lot faster since it no longer has to jump through twenty-eleven
hoops to find the DOMWrapperWorld.
Reviewed by Geoff Garen.
* bindings/js/DOMWrapperWorld.cpp:
(WebCore::DOMWrapperWorld::clearWrappers):
* bindings/js/DOMWrapperWorld.h:
* bindings/js/JSDOMBinding.cpp:
(WebCore::jsStringWithCache):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (167604 => 167605)
--- trunk/Source/_javascript_Core/ChangeLog 2014-04-21 19:15:17 UTC (rev 167604)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-04-21 19:17:14 UTC (rev 167605)
@@ -1,3 +1,12 @@
+2014-04-21 Andreas Kling <[email protected]>
+
+ Move the JSString cache from DOMWrapperWorld to VM.
+ <https://webkit.org/b/131940>
+
+ Reviewed by Geoff Garen.
+
+ * runtime/VM.h:
+
2014-04-19 Filip Pizlo <[email protected]>
Take block execution count estimates into account when voting double
Modified: trunk/Source/_javascript_Core/runtime/VM.h (167604 => 167605)
--- trunk/Source/_javascript_Core/runtime/VM.h 2014-04-21 19:15:17 UTC (rev 167604)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2014-04-21 19:17:14 UTC (rev 167605)
@@ -295,6 +295,7 @@
NumericStrings numericStrings;
DateInstanceCache dateInstanceCache;
WTF::SimpleStats machineCodeBytesPerBytecodeWordForBaselineJIT;
+ WeakGCMap<StringImpl*, JSString, PtrHash<StringImpl*>> stringCache;
AtomicStringTable* atomicStringTable() const { return m_atomicStringTable; }
Modified: trunk/Source/WebCore/ChangeLog (167604 => 167605)
--- trunk/Source/WebCore/ChangeLog 2014-04-21 19:15:17 UTC (rev 167604)
+++ trunk/Source/WebCore/ChangeLog 2014-04-21 19:17:14 UTC (rev 167605)
@@ -1,3 +1,21 @@
+2014-04-21 Andreas Kling <[email protected]>
+
+ Move the JSString cache from DOMWrapperWorld to VM.
+ <https://webkit.org/b/131940>
+
+ Since there's no need for JSStrings to be world-specific, this patch
+ moves the string cache to JSC::VM. This makes jsStringWithCache()
+ a lot faster since it no longer has to jump through twenty-eleven
+ hoops to find the DOMWrapperWorld.
+
+ Reviewed by Geoff Garen.
+
+ * bindings/js/DOMWrapperWorld.cpp:
+ (WebCore::DOMWrapperWorld::clearWrappers):
+ * bindings/js/DOMWrapperWorld.h:
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::jsStringWithCache):
+
2014-04-21 David Hyatt <[email protected]>
[New Multicolumn] Column balancing is slow on float-multicol.html
Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp (167604 => 167605)
--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp 2014-04-21 19:15:17 UTC (rev 167604)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp 2014-04-21 19:17:14 UTC (rev 167605)
@@ -53,7 +53,6 @@
void DOMWrapperWorld::clearWrappers()
{
m_wrappers.clear();
- m_stringCache.clear();
// These items are created lazily.
while (!m_scriptControllersWithWindowShells.isEmpty())
Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h (167604 => 167605)
--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h 2014-04-21 19:15:17 UTC (rev 167604)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h 2014-04-21 19:17:14 UTC (rev 167605)
@@ -23,7 +23,6 @@
#define DOMWrapperWorld_h
#include "JSDOMGlobalObject.h"
-#include <runtime/WeakGCMap.h>
#include <wtf/Forward.h>
namespace WebCore {
@@ -33,7 +32,6 @@
class ScriptController;
typedef HashMap<void*, JSC::Weak<JSC::JSObject>> DOMObjectWrapperMap;
-typedef JSC::WeakGCMap<StringImpl*, JSC::JSString, PtrHash<StringImpl*>> JSStringCache;
class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
@@ -51,7 +49,6 @@
// FIXME: can we make this private?
DOMObjectWrapperMap m_wrappers;
- JSStringCache m_stringCache;
HashMap<CSSValue*, void*> m_cssValueRoots;
bool isNormal() const { return m_isNormal; }
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (167604 => 167605)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2014-04-21 19:15:17 UTC (rev 167604)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2014-04-21 19:17:14 UTC (rev 167605)
@@ -65,22 +65,20 @@
JSC::JSValue jsStringWithCache(JSC::ExecState* exec, const String& s)
{
+ JSC::VM& vm = exec->vm();
StringImpl* stringImpl = s.impl();
if (!stringImpl || !stringImpl->length())
- return jsEmptyString(exec);
+ return jsEmptyString(&vm);
if (stringImpl->length() == 1) {
UChar singleCharacter = (*stringImpl)[0u];
- if (singleCharacter <= JSC::maxSingleCharacterString) {
- JSC::VM* vm = &exec->vm();
- return vm->smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter));
- }
+ if (singleCharacter <= JSC::maxSingleCharacterString)
+ return vm.smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter));
}
- JSStringCache& stringCache = currentWorld(exec).m_stringCache;
- JSStringCache::AddResult addResult = stringCache.add(stringImpl, nullptr);
+ auto addResult = vm.stringCache.add(stringImpl, nullptr);
if (addResult.isNewEntry)
- addResult.iterator->value = JSC::jsString(exec, String(stringImpl));
+ addResult.iterator->value = JSC::jsString(&vm, String(stringImpl));
return JSC::JSValue(addResult.iterator->value.get());
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes