Bug 1000598 - Clear TypeCompartment tables. r=billm, a=sledru
authorShu-yu Guo <shu@rfrn.org>
Wed, 23 Apr 2014 17:33:44 -0700
changeset 199083 cff3a438c3e13877d4223f0e5740954d177a3c8f
parent 199082 1389f09bbbc9757a0fc7f4577a23d06d3074a0c1
child 199084 0f40e6c752c8ec96d68d6036c1dd588c524e31df
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, sledru
bugs1000598
milestone31.0a2
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
@@ -656,16 +656,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
@@ -4146,16 +4146,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
@@ -1553,16 +1553,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);
 };