Bug 1315262 - Don't purge shape tables in the self-hosting zone. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 15 Nov 2016 16:46:17 +0100
changeset 322727 8d6553075ae1ce62d1032b13906892e508e9e1f7
parent 322726 3656a6f2cd7e5c93f32c820d73ed73ad1a170dae
child 322728 5c79c47c39795fbe4c530813d47663dea8813079
push id30961
push userkwierso@gmail.com
push dateThu, 17 Nov 2016 01:08:03 +0000
treeherdermozilla-central@c27117f67fa3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1315262
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1315262 - Don't purge shape tables in the self-hosting zone. r=jonco
js/src/jsfun.cpp
js/src/jsgc.cpp
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1590,19 +1590,22 @@ JSFunction::maybeRelazify(JSRuntime* rt)
     if (!hasScript() || !u.i.s.script_)
         return;
 
     // Don't relazify functions in compartments that are active.
     JSCompartment* comp = compartment();
     if (comp->hasBeenEntered() && !rt->allowRelazificationForTesting)
         return;
 
-    // Don't relazify if the compartment is being debugged or is the
-    // self-hosting compartment.
-    if (comp->isDebuggee() || comp->isSelfHosting)
+    // The caller should have checked we're not in the self-hosting zone (it's
+    // shared with worker runtimes so relazifying functions in it will race).
+    MOZ_ASSERT(!comp->isSelfHosting);
+
+    // Don't relazify if the compartment is being debugged.
+    if (comp->isDebuggee())
         return;
 
     // Don't relazify if the compartment and/or runtime is instrumented to
     // collect code coverage for analysis.
     if (comp->collectCoverageForDebug())
         return;
 
     // Don't relazify functions with JIT code.
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -3863,25 +3863,27 @@ GCRuntime::beginMarkPhase(JS::gcreason::
      * We do this only when we're performing a shrinking GC, as too much
      * relazification can cause performance issues when we have to reparse
      * the same functions over and over.
      */
     if (invocationKind == GC_SHRINK) {
         {
             gcstats::AutoPhase ap(stats, gcstats::PHASE_RELAZIFY_FUNCTIONS);
             for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
+                if (zone->isSelfHostingZone())
+                    continue;
                 RelazifyFunctions(zone, AllocKind::FUNCTION);
                 RelazifyFunctions(zone, AllocKind::FUNCTION_EXTENDED);
             }
         }
 
         /* Purge ShapeTables. */
         gcstats::AutoPhase ap(stats, gcstats::PHASE_PURGE_SHAPE_TABLES);
         for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
-            if (zone->keepShapeTables())
+            if (zone->keepShapeTables() || zone->isSelfHostingZone())
                 continue;
             for (auto baseShape = zone->cellIter<BaseShape>(); !baseShape.done(); baseShape.next())
                 baseShape->maybePurgeTable();
         }
     }
 
     startNumber = number;