[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

barraclough at apple.com barraclough at apple.com
Thu Apr 8 01:05:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit f2c07dc1c74a9a3a3c909d9e38d9786b55ee7d93
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 14 06:45:27 2010 +0000

    <rdar://problem/7403736> REGRESSION (r49963,r49965): 8% Dromaeo Core DOM test regression
    
    Reviewed by Oliver Hunt.
    
    Adding isolated worlds support to the JSC bindings introduced a regression due to
    additional map lookups.  Add a mechanism to quickly detect that a lookup is for the
    'normal' world, and add fast paths to a couple of methods to check the normal world
    first.
    
    * bindings/js/JSDOMBinding.cpp:
    (WebCore::Document::getWrapperCache):
    (WebCore::DOMWrapperWorld::DOMWrapperWorld):
    (WebCore::forgetDOMObject):
    * bindings/js/JSDOMBinding.h:
    (WebCore::DOMWrapperWorld::isNormal):
    (WebCore::WebCoreJSClientData::WebCoreJSClientData):
    * bindings/js/ScriptController.cpp:
    (WebCore::IsolatedWorld::IsolatedWorld):
    * dom/Document.cpp:
    (WebCore::Document::Document):
    (WebCore::Document::createWrapperCache):
    * dom/Document.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53240 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 56ed207..8d01b57 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-01-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        <rdar://problem/7403736> REGRESSION (r49963,r49965): 8% Dromaeo Core DOM test regression
+
+        Adding isolated worlds support to the JSC bindings introduced a regression due to
+        additional map lookups.  Add a mechanism to quickly detect that a lookup is for the
+        'normal' world, and add fast paths to a couple of methods to check the normal world
+        first.
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::Document::getWrapperCache):
+        (WebCore::DOMWrapperWorld::DOMWrapperWorld):
+        (WebCore::forgetDOMObject):
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::DOMWrapperWorld::isNormal):
+        (WebCore::WebCoreJSClientData::WebCoreJSClientData):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::IsolatedWorld::IsolatedWorld):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::createWrapperCache):
+        * dom/Document.h:
+
 2010-01-13  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 24f891e..e98af01 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -80,6 +80,17 @@ using namespace HTMLNames;
 typedef Document::JSWrapperCache JSWrapperCache;
 typedef Document::JSWrapperCacheMap JSWrapperCacheMap;
 
+inline JSWrapperCache* Document::getWrapperCache(DOMWrapperWorld* world)
+{
+    if (world->isNormal()) {
+        if (JSWrapperCache* wrapperCache = m_normalWorldWrapperCache)
+            return wrapperCache;
+        ASSERT(!m_wrapperCacheMap.contains(world));
+    } else if (JSWrapperCache* wrapperCache = m_wrapperCacheMap.get(world))
+        return wrapperCache;
+    return createWrapperCache(world);
+}
+
 // For debugging, keep a set of wrappers currently registered, and check that
 // all are unregistered before they are destroyed. This has helped us fix at
 // least one bug.
@@ -155,8 +166,9 @@ DOMObject::~DOMObject()
 
 #endif
 
-DOMWrapperWorld::DOMWrapperWorld(JSC::JSGlobalData* globalData)
+DOMWrapperWorld::DOMWrapperWorld(JSC::JSGlobalData* globalData, bool isNormal)
     : m_globalData(globalData)
+    , m_isNormal(isNormal)
 {
 }
 
@@ -296,6 +308,16 @@ JSNode* getCachedDOMNodeWrapper(JSC::ExecState* exec, Document* document, Node*
 void forgetDOMObject(DOMObject* wrapper, void* objectHandle)
 {
     JSC::JSGlobalData* globalData = Heap::heap(wrapper)->globalData();
+
+    // Check the normal world first!
+    JSGlobalData::ClientData* clientData = globalData->clientData;
+    ASSERT(clientData);
+    DOMObjectWrapperMap& wrappers = static_cast<WebCoreJSClientData*>(clientData)->normalWorld()->m_wrappers;
+    if (wrappers.uncheckedRemove(objectHandle, wrapper)) {
+        removeWrapper(wrapper);
+        return;
+    }
+
     for (JSGlobalDataWorldIterator worldIter(globalData); worldIter; ++worldIter) {
         if (worldIter->m_wrappers.uncheckedRemove(objectHandle, wrapper))
             break;
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 4d11872..c847560 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -144,7 +144,7 @@ namespace WebCore {
 
     class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
     public:
-        DOMWrapperWorld(JSC::JSGlobalData*);
+        DOMWrapperWorld(JSC::JSGlobalData*, bool isNormal);
         ~DOMWrapperWorld();
 
         void rememberDocument(Document* document) { documentsWithWrappers.add(document); }
@@ -153,9 +153,12 @@ namespace WebCore {
         // FIXME: can we make this private?
         DOMObjectWrapperMap m_wrappers;
 
+        bool isNormal() const { return m_isNormal; }
+
     private:
         JSC::JSGlobalData* m_globalData;
         HashSet<Document*> documentsWithWrappers;
+        bool m_isNormal;
     };
 
     // Map from static HashTable instances to per-GlobalData ones.
@@ -187,7 +190,7 @@ namespace WebCore {
 
     public:
         WebCoreJSClientData(JSC::JSGlobalData* globalData)
-            : m_normalWorld(globalData)
+            : m_normalWorld(globalData, true)
         {
             m_worldSet.add(&m_normalWorld);
         }
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 0aa7a5a..bfdcaaf 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -156,7 +156,7 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
 class IsolatedWorld : public DOMWrapperWorld {
 public:
     IsolatedWorld(JSGlobalData* globalData)
-        : DOMWrapperWorld(globalData)
+        : DOMWrapperWorld(globalData, false)
     {
         JSGlobalData::ClientData* clientData = globalData->clientData;
         ASSERT(clientData);
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 37635f8..df47e88 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -353,6 +353,9 @@ Document::Document(Frame* frame, bool isXHTML)
     , m_useSecureKeyboardEntryWhenActive(false)
     , m_isXHTML(isXHTML)
     , m_numNodeListCaches(0)
+#if USE(JSC)
+    , m_normalWorldWrapperCache(0)
+#endif
 #if ENABLE(DATABASE)
     , m_hasOpenDatabases(false)
 #endif
@@ -516,6 +519,10 @@ Document::JSWrapperCache* Document::createWrapperCache(DOMWrapperWorld* world)
 {
     JSWrapperCache* wrapperCache = new JSWrapperCache();
     m_wrapperCacheMap.set(world, wrapperCache);
+    if (world->isNormal()) {
+        ASSERT(!m_normalWorldWrapperCache);
+        m_normalWorldWrapperCache = wrapperCache;
+    }
     world->rememberDocument(this);
     return wrapperCache;
 }
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index c71e80f..857aacb 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -840,12 +840,7 @@ public:
     typedef JSC::WeakGCMap<WebCore::Node*, JSNode*> JSWrapperCache;
     typedef HashMap<DOMWrapperWorld*, JSWrapperCache*> JSWrapperCacheMap;
     JSWrapperCacheMap& wrapperCacheMap() { return m_wrapperCacheMap; }
-    JSWrapperCache* getWrapperCache(DOMWrapperWorld* world)
-    {
-        if (JSWrapperCache* wrapperCache = m_wrapperCacheMap.get(world))
-            return wrapperCache;
-        return createWrapperCache(world);
-    }
+    JSWrapperCache* getWrapperCache(DOMWrapperWorld* world);
     JSWrapperCache* createWrapperCache(DOMWrapperWorld*);
 #endif
 
@@ -1181,6 +1176,7 @@ private:
 
 #if USE(JSC)
     JSWrapperCacheMap m_wrapperCacheMap;
+    JSWrapperCache* m_normalWorldWrapperCache;
 #endif
 
 #if ENABLE(DATABASE)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list