[V8] Remove a level of indirection in DOMDataStore
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2012 18:55:17 +0000 (18:55 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2012 18:55:17 +0000 (18:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101690

Reviewed by Kentaro Hara.

There is no longer any reason for the DOMDataStore to hold the wrapper
map via a pointer. It can just hold the wrapper map directly, saving a
level of indirection. I doubt this has any measurable performance gain.

* bindings/v8/DOMDataStore.cpp:
(WebCore::DOMDataStore::DOMDataStore):
(WebCore::DOMDataStore::~DOMDataStore):
(WebCore::DOMDataStore::reportMemoryUsage):
* bindings/v8/DOMDataStore.h:
(WebCore::DOMDataStore::get):
(WebCore::DOMDataStore::set):
(DOMDataStore):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134086 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/DOMDataStore.cpp
Source/WebCore/bindings/v8/DOMDataStore.h

index f1ed00a..1db48d4 100644 (file)
@@ -1,3 +1,23 @@
+2012-11-09  Adam Barth  <abarth@webkit.org>
+
+        [V8] Remove a level of indirection in DOMDataStore
+        https://bugs.webkit.org/show_bug.cgi?id=101690
+
+        Reviewed by Kentaro Hara.
+
+        There is no longer any reason for the DOMDataStore to hold the wrapper
+        map via a pointer. It can just hold the wrapper map directly, saving a
+        level of indirection. I doubt this has any measurable performance gain.
+
+        * bindings/v8/DOMDataStore.cpp:
+        (WebCore::DOMDataStore::DOMDataStore):
+        (WebCore::DOMDataStore::~DOMDataStore):
+        (WebCore::DOMDataStore::reportMemoryUsage):
+        * bindings/v8/DOMDataStore.h:
+        (WebCore::DOMDataStore::get):
+        (WebCore::DOMDataStore::set):
+        (DOMDataStore):
+
 2012-11-09  Mihnea Ovidenie  <mihnea@adobe.com>
 
         [CSSRegions] Region styling properties are not filtered correctly
index 869d513..839c439 100644 (file)
@@ -41,7 +41,6 @@ namespace WebCore {
 DOMDataStore::DOMDataStore(Type type)
     : m_type(type)
 {
-    m_domObjectMap = adoptPtr(new DOMWrapperMap<void>);
     V8PerIsolateData::current()->registerDOMDataStore(this);
 }
 
@@ -49,7 +48,7 @@ DOMDataStore::~DOMDataStore()
 {
     ASSERT(m_type != MainWorld); // We never actually destruct the main world's DOMDataStore.
     V8PerIsolateData::current()->unregisterDOMDataStore(this);
-    m_domObjectMap->clear();
+    m_wrapperMap.clear();
 }
 
 DOMDataStore* DOMDataStore::current(v8::Isolate* isolate)
@@ -67,7 +66,7 @@ DOMDataStore* DOMDataStore::current(v8::Isolate* isolate)
 void DOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding);
-    info.addMember(m_domObjectMap);
+    info.addMember(m_wrapperMap);
 }
 
 void DOMDataStore::weakCallback(v8::Persistent<v8::Value> value, void* context)
index 8646db4..4af9ce0 100644 (file)
@@ -60,11 +60,11 @@ public:
     static DOMDataStore* current(v8::Isolate*);
 
     template<typename T>
-    inline v8::Handle<v8::Object> get(T* object) const
+    inline v8::Handle<v8::Object> get(T* object)
     {
         if (wrapperIsStoredInObject(object))
             return getWrapperFromObject(object);
-        return m_domObjectMap->get(object);
+        return m_wrapperMap.get(object);
     }
 
     template<typename T>
@@ -72,7 +72,7 @@ public:
     {
         if (setWrapperInObject(object, wrapper))
             return;
-        m_domObjectMap->set(object, wrapper);
+        m_wrapperMap.set(object, wrapper);
     }
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
@@ -107,7 +107,7 @@ private:
     static void weakCallback(v8::Persistent<v8::Value>, void* context);
 
     Type m_type;
-    OwnPtr<DOMWrapperMap<void> > m_domObjectMap;
+    DOMWrapperMap<void> m_wrapperMap;
 };
 
 } // namespace WebCore