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

snej at chromium.org snej at chromium.org
Wed Apr 7 23:31:30 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 46c952ed50dbea16c30aabe025a40bd541d1091b
Author: snej at chromium.org <snej at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 11 19:19:50 2009 +0000

    Optimize V8 getDOMNodeMap(), a hot function in Dromaeo DOM tests, by increasing inlining.
    
    Reviewed by Dimitri Glazkov.
    
    * bindings/v8/DOMData.cpp:
    (WebCore::DOMData::getCurrent):  Moved getCurrentMainThread to MainThreadDOMData::getCurrent
        so it can be inlined by its caller.
    * bindings/v8/DOMData.h:
    * bindings/v8/MainThreadDOMData.cpp:
    (WebCore::MainThreadDOMData::getCurrent):  Moved here from DOMData.cpp.
    (WebCore::MainThreadDOMData::getMainThreadStore):  Added UNLIKELY macro to improve codegen.
    (WebCore::MainThreadDOMData::getCurrentMainThreadStore):  Combination of getCurrentMainThread
        and getStore, which inline both calls together.
    * bindings/v8/MainThreadDOMData.h:
    (WebCore::MainThreadDOMData::getStore):  Broke out nonvirtual getMainThreadStore for inlineability.
    * bindings/v8/V8DOMMap.cpp:
    (WebCore::getDOMNodeMap):  Call new getCurrentMainThreadStore, which is faster.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50826 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 434cb2a..f43053d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-11  Jens Alfke  <snej at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Optimize V8 getDOMNodeMap(), a hot function in Dromaeo DOM tests, by increasing inlining.
+
+        * bindings/v8/DOMData.cpp:
+        (WebCore::DOMData::getCurrent):  Moved getCurrentMainThread to MainThreadDOMData::getCurrent
+            so it can be inlined by its caller.
+        * bindings/v8/DOMData.h:
+        * bindings/v8/MainThreadDOMData.cpp:
+        (WebCore::MainThreadDOMData::getCurrent):  Moved here from DOMData.cpp.
+        (WebCore::MainThreadDOMData::getMainThreadStore):  Added UNLIKELY macro to improve codegen.
+        (WebCore::MainThreadDOMData::getCurrentMainThreadStore):  Combination of getCurrentMainThread
+            and getStore, which inline both calls together.
+        * bindings/v8/MainThreadDOMData.h:
+        (WebCore::MainThreadDOMData::getStore):  Broke out nonvirtual getMainThreadStore for inlineability.
+        * bindings/v8/V8DOMMap.cpp:
+        (WebCore::getDOMNodeMap):  Call new getCurrentMainThreadStore, which is faster.
+
 2009-11-11  Nate Chapin  <japhet at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/bindings/v8/DOMData.cpp b/WebCore/bindings/v8/DOMData.cpp
index 07254fe..08d4561 100644
--- a/WebCore/bindings/v8/DOMData.cpp
+++ b/WebCore/bindings/v8/DOMData.cpp
@@ -46,19 +46,12 @@ DOMData::DOMData()
 DOMData* DOMData::getCurrent()
 {
     if (WTF::isMainThread())
-        return getCurrentMainThread();
+        return MainThreadDOMData::getCurrent();
 
     DEFINE_STATIC_LOCAL(WTF::ThreadSpecific<ChildThreadDOMData>, childThreadDOMData, ());
     return childThreadDOMData;
 }
 
-DOMData* DOMData::getCurrentMainThread()
-{
-    ASSERT(WTF::isMainThread());
-    DEFINE_STATIC_LOCAL(MainThreadDOMData, mainThreadDOMData, ());
-    return &mainThreadDOMData;
-}
-
 void DOMData::ensureDeref(V8ClassIndex::V8WrapperType type, void* domObject)
 {
     if (m_owningThread == WTF::currentThread()) {
diff --git a/WebCore/bindings/v8/DOMData.h b/WebCore/bindings/v8/DOMData.h
index 8552426..65fe8fc 100644
--- a/WebCore/bindings/v8/DOMData.h
+++ b/WebCore/bindings/v8/DOMData.h
@@ -47,7 +47,6 @@ namespace WebCore {
         DOMData();
 
         static DOMData* getCurrent();
-        static DOMData* getCurrentMainThread(); // Caller must be on the main thread.
         virtual DOMDataStore& getStore() = 0;
 
         template<typename T>
diff --git a/WebCore/bindings/v8/MainThreadDOMData.cpp b/WebCore/bindings/v8/MainThreadDOMData.cpp
index ea34444..b1b63bf 100644
--- a/WebCore/bindings/v8/MainThreadDOMData.cpp
+++ b/WebCore/bindings/v8/MainThreadDOMData.cpp
@@ -39,14 +39,30 @@ MainThreadDOMData::MainThreadDOMData()
     : m_defaultStore(this)
 {
 }
+    
+MainThreadDOMData* MainThreadDOMData::getCurrent()
+{
+    ASSERT(WTF::isMainThread());
+    DEFINE_STATIC_LOCAL(MainThreadDOMData, mainThreadDOMData, ());
+    return &mainThreadDOMData;
+}
 
-DOMDataStore& MainThreadDOMData::getStore()
+DOMDataStore& MainThreadDOMData::getMainThreadStore()
 {
+    // This is broken out as a separate non-virtual method from getStore()
+    // so that it can be inlined by getCurrentMainThreadStore, which is
+    // a hot spot in Dromaeo DOM tests.
     ASSERT(WTF::isMainThread());
     V8IsolatedWorld* world = V8IsolatedWorld::getEntered();
-    if (world)
+    if (UNLIKELY(world != 0))
         return *world->getDOMDataStore();
     return m_defaultStore;
 }
 
+DOMDataStore& MainThreadDOMData::getCurrentMainThreadStore()
+{
+    return getCurrent()->getMainThreadStore();
+}
+
+
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/MainThreadDOMData.h b/WebCore/bindings/v8/MainThreadDOMData.h
index 5c78cec..e8f99c9 100644
--- a/WebCore/bindings/v8/MainThreadDOMData.h
+++ b/WebCore/bindings/v8/MainThreadDOMData.h
@@ -38,10 +38,16 @@ namespace WebCore {
 
     class MainThreadDOMData : public DOMData {
     public:
-        MainThreadDOMData();
-        DOMDataStore& getStore();
+        static MainThreadDOMData* getCurrent(); // Caller must be on the main thread.
+        static DOMDataStore& getCurrentMainThreadStore();
+                
+        virtual DOMDataStore& getStore() { return getMainThreadStore(); }
+        
 
     private:
+        MainThreadDOMData();
+        DOMDataStore& getMainThreadStore();
+
         StaticDOMDataStore m_defaultStore;
         // Note: The DOMDataStores for isolated world are owned by the world object.
     };
diff --git a/WebCore/bindings/v8/V8DOMMap.cpp b/WebCore/bindings/v8/V8DOMMap.cpp
index 1bd68f7..7512dff 100644
--- a/WebCore/bindings/v8/V8DOMMap.cpp
+++ b/WebCore/bindings/v8/V8DOMMap.cpp
@@ -34,6 +34,7 @@
 #include "DOMData.h"
 #include "DOMDataStore.h"
 #include "DOMObjectsInclude.h"
+#include "MainThreadDOMData.h"
 #include "ScopedDOMDataStore.h"
 
 namespace WebCore {
@@ -49,8 +50,7 @@ DOMDataStoreHandle::~DOMDataStoreHandle()
 
 DOMWrapperMap<Node>& getDOMNodeMap()
 {
-    // Nodes only exist on the main thread.
-    return DOMData::getCurrentMainThread()->getStore().domNodeMap();
+    return MainThreadDOMData::getCurrentMainThreadStore().domNodeMap();
 }
 
 DOMWrapperMap<void>& getDOMObjectMap()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list