Optimize V8 getDOMNodeMap(), a hot function in Dromaeo DOM tests, by increasing inlining.
[WebKit-https.git] / WebCore / bindings / v8 / MainThreadDOMData.cpp
index ea344443fb2ea0bd20d4bf8111b59d21ac897d91..b1b63bff67adb5375e2aa0e848436ce0303b8f62 100644 (file)
@@ -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