Title: [140284] trunk/Source/_javascript_Core
Revision
140284
Author
[email protected]
Date
2013-01-20 16:59:45 -0800 (Sun, 20 Jan 2013)

Log Message

Weak GC maps should be easier to use
https://bugs.webkit.org/show_bug.cgi?id=107312

Reviewed by Sam Weinig.

Follow-up fix.

* runtime/PrototypeMap.cpp:
(JSC::PrototypeMap::emptyObjectStructureForPrototype): Restored this
ASSERT, which was disabled because of a bug in WeakGCMap.

* runtime/WeakGCMap.h:
(JSC::WeakGCMap::add): We can't pass our passed-in value to add() because
a PassWeak() clears itself when passed to another function. So, we pass
nullptr instead, and fix things up afterwards.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (140283 => 140284)


--- trunk/Source/_javascript_Core/ChangeLog	2013-01-21 00:11:43 UTC (rev 140283)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-01-21 00:59:45 UTC (rev 140284)
@@ -1,5 +1,23 @@
 2013-01-20  Geoffrey Garen  <[email protected]>
 
+        Weak GC maps should be easier to use
+        https://bugs.webkit.org/show_bug.cgi?id=107312
+
+        Reviewed by Sam Weinig.
+
+        Follow-up fix.
+
+        * runtime/PrototypeMap.cpp:
+        (JSC::PrototypeMap::emptyObjectStructureForPrototype): Restored this
+        ASSERT, which was disabled because of a bug in WeakGCMap.
+
+        * runtime/WeakGCMap.h:
+        (JSC::WeakGCMap::add): We can't pass our passed-in value to add() because
+        a PassWeak() clears itself when passed to another function. So, we pass
+        nullptr instead, and fix things up afterwards.
+
+2013-01-20  Geoffrey Garen  <[email protected]>
+
         Unreviewed.
 
         Temporarily disabling this ASSERT to get the bots green

Modified: trunk/Source/_javascript_Core/runtime/PrototypeMap.cpp (140283 => 140284)


--- trunk/Source/_javascript_Core/runtime/PrototypeMap.cpp	2013-01-21 00:11:43 UTC (rev 140283)
+++ trunk/Source/_javascript_Core/runtime/PrototypeMap.cpp	2013-01-21 00:59:45 UTC (rev 140284)
@@ -55,8 +55,10 @@
 Structure* PrototypeMap::emptyObjectStructureForPrototype(JSObject* object)
 {
     WeakGCMap<JSObject*, Structure>::AddResult addResult = m_structures.add(object, nullptr);
-    if (!addResult.isNewEntry)
+    if (!addResult.isNewEntry) {
+        ASSERT(isPrototype(object));
         return addResult.iterator->value.get();
+    }
 
     addPrototype(object);
     Structure* structure = JSFinalObject::createStructure(object->globalObject()->globalData(), object->globalObject(), object);

Modified: trunk/Source/_javascript_Core/runtime/WeakGCMap.h (140283 => 140284)


--- trunk/Source/_javascript_Core/runtime/WeakGCMap.h	2013-01-21 00:11:43 UTC (rev 140283)
+++ trunk/Source/_javascript_Core/runtime/WeakGCMap.h	2013-01-21 00:59:45 UTC (rev 140284)
@@ -66,8 +66,8 @@
     AddResult add(const KeyType& key, MappedPassInType value)
     {
         gcMapIfNeeded();
-        AddResult addResult = Base::add(key, value);
-        if (!addResult.isNewEntry && !addResult.iterator->value) { // Found a zombie value.
+        AddResult addResult = Base::add(key, nullptr);
+        if (!addResult.iterator->value) { // New value or found a zombie value.
             addResult.isNewEntry = true;
             addResult.iterator->value = value;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to