Bug 1000598 - Clear TypeCompartment tables. r=billm, a=sledru
authorShu-yu Guo <shu@rfrn.org>
Wed, 23 Apr 2014 17:33:44 -0700
changeset 192215 56d4c53323c0
parent 192214 10e5a05f34b3
child 192216 0c8b19312abf
push id3526
push userryanvm@gmail.com
push date2014-05-07 15:03 +0000
treeherdermozilla-beta@0c8b19312abf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, sledru
bugs1000598
milestone30.0
Bug 1000598 - Clear TypeCompartment tables. r=billm, a=sledru
js/src/jscompartment.cpp
js/src/jsinfer.cpp
js/src/jsinfer.h
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -661,16 +661,17 @@ JSCompartment::clearTables()
     JS_ASSERT_IF(callsiteClones.initialized(), callsiteClones.empty());
 #ifdef JS_ION
     JS_ASSERT(!jitCompartment_);
 #endif
     JS_ASSERT(!debugScopes);
     JS_ASSERT(!gcWeakMapList);
     JS_ASSERT(enumerators->next() == enumerators);
 
+    types.clearTables();
     if (baseShapes.initialized())
         baseShapes.clear();
     if (initialShapes.initialized())
         initialShapes.clear();
     if (newTypeObjects.initialized())
         newTypeObjects.clear();
     if (lazyTypeObjects.initialized())
         lazyTypeObjects.clear();
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -4176,16 +4176,27 @@ TypeObject::sweep(FreeOp *fop, bool *oom
                 clearProperties();
                 return;
             }
         }
     }
 }
 
 void
+TypeCompartment::clearTables()
+{
+    if (allocationSiteTable && allocationSiteTable->initialized())
+        allocationSiteTable->clear();
+    if (arrayTypeTable && arrayTypeTable->initialized())
+        arrayTypeTable->clear();
+    if (objectTypeTable && objectTypeTable->initialized())
+        objectTypeTable->clear();
+}
+
+void
 TypeCompartment::sweep(FreeOp *fop)
 {
     /*
      * Iterate through the array/object type tables and remove all entries
      * referencing collected data. These tables only hold weak references.
      */
 
     if (arrayTypeTable) {
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -1531,16 +1531,17 @@ struct TypeCompartment
                               TypeObjectFlags initialFlags = 0);
 
     /* Get or make an object for an allocation site, and add to the allocation site table. */
     TypeObject *addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey key);
 
     /* Mark any type set containing obj as having a generic object type. */
     void markSetsUnknown(JSContext *cx, TypeObject *obj);
 
+    void clearTables();
     void sweep(FreeOp *fop);
     void finalizeObjects();
 
     void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf,
                                 size_t *allocationSiteTables,
                                 size_t *arrayTypeTables,
                                 size_t *objectTypeTables);
 };