Title: [101945] trunk/Source/_javascript_Core
Revision
101945
Author
da...@apple.com
Date
2011-12-03 21:20:08 -0800 (Sat, 03 Dec 2011)

Log Message

Use HashMap<OwnPtr> for the opaqueJSClassData map
https://bugs.webkit.org/show_bug.cgi?id=73759

Reviewed by Andreas Kling.

* API/JSClassRef.cpp:
(OpaqueJSClass::contextData): Update types.
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::~JSGlobalData): Add an explicit clear of opaqueJSClassData to keep the
timing the same. If we didn't care about the order of operations, we could remove this, too.
* runtime/JSGlobalData.h: Use OwnPtr instead of raw pointer for the mapped type in the
opaqueJSClassData map.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSClassRef.cpp (101944 => 101945)


--- trunk/Source/_javascript_Core/API/JSClassRef.cpp	2011-12-04 05:11:35 UTC (rev 101944)
+++ trunk/Source/_javascript_Core/API/JSClassRef.cpp	2011-12-04 05:20:08 UTC (rev 101945)
@@ -202,9 +202,9 @@
 
 OpaqueJSClassContextData& OpaqueJSClass::contextData(ExecState* exec)
 {
-    OpaqueJSClassContextData*& contextData = exec->globalData().opaqueJSClassData.add(this, 0).first->second;
+    OwnPtr<OpaqueJSClassContextData>& contextData = exec->globalData().opaqueJSClassData.add(this, nullptr).first->second;
     if (!contextData)
-        contextData = new OpaqueJSClassContextData(exec->globalData(), this);
+        contextData = adoptPtr(new OpaqueJSClassContextData(exec->globalData(), this));
     return *contextData;
 }
 

Modified: trunk/Source/_javascript_Core/ChangeLog (101944 => 101945)


--- trunk/Source/_javascript_Core/ChangeLog	2011-12-04 05:11:35 UTC (rev 101944)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-12-04 05:20:08 UTC (rev 101945)
@@ -1,5 +1,20 @@
 2011-12-03  Darin Adler  <da...@apple.com>
 
+        Use HashMap<OwnPtr> for the opaqueJSClassData map
+        https://bugs.webkit.org/show_bug.cgi?id=73759
+
+        Reviewed by Andreas Kling.
+
+        * API/JSClassRef.cpp:
+        (OpaqueJSClass::contextData): Update types.
+        * runtime/JSGlobalData.cpp:
+        (JSC::JSGlobalData::~JSGlobalData): Add an explicit clear of opaqueJSClassData to keep the
+        timing the same. If we didn't care about the order of operations, we could remove this, too.
+        * runtime/JSGlobalData.h: Use OwnPtr instead of raw pointer for the mapped type in the
+        opaqueJSClassData map.
+
+2011-12-03  Darin Adler  <da...@apple.com>
+
         Change HashMap implementation to use the pass type and peek type from traits for the mapped value
         https://bugs.webkit.org/show_bug.cgi?id=72474
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp (101944 => 101945)


--- trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp	2011-12-04 05:11:35 UTC (rev 101944)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp	2011-12-04 05:20:08 UTC (rev 101945)
@@ -354,7 +354,7 @@
     fastDelete(const_cast<HashTable*>(stringTable));
     fastDelete(const_cast<HashTable*>(stringConstructorTable));
 
-    deleteAllValues(opaqueJSClassData);
+    opaqueJSClassData.clear();
 
     delete emptyList;
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.h (101944 => 101945)


--- trunk/Source/_javascript_Core/runtime/JSGlobalData.h	2011-12-04 05:11:35 UTC (rev 101944)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.h	2011-12-04 05:20:08 UTC (rev 101945)
@@ -284,7 +284,7 @@
 #endif
 #endif
 
-        HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
+        HashMap<OpaqueJSClass*, OwnPtr<OpaqueJSClassContextData> > opaqueJSClassData;
 
         JSGlobalObject* dynamicGlobalObject;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to