Bug 1519405 - Add enums for flags passed to Zone::discardJitCode() r=jandem
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 14 Jan 2019 13:31:44 +0000
changeset 453716 3588e0ddb99edc3586a813f14fdc0560e754a21f
parent 453715 e3d38e17dec86ebe0321d4eb4d49c3ec8d2bf85b
child 453717 1957ef91d750c116e7b76c8a0ac2dc3d32f063df
push id35371
push userncsoregi@mozilla.com
push dateMon, 14 Jan 2019 17:23:11 +0000
treeherdermozilla-central@b8f96f4d584a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1519405
milestone66.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 1519405 - Add enums for flags passed to Zone::discardJitCode() r=jandem
js/src/gc/GC.cpp
js/src/gc/Zone.cpp
js/src/gc/Zone.h
js/src/vm/TypeInference.cpp
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -4221,18 +4221,18 @@ bool GCRuntime::prepareZonesForCollectio
 }
 
 static void DiscardJITCodeForGC(JSRuntime* rt) {
   js::CancelOffThreadIonCompile(rt, JS::Zone::MarkBlackOnly);
   for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
     gcstats::AutoPhase ap(rt->gc.stats(),
                           gcstats::PhaseKind::MARK_DISCARD_CODE);
     zone->discardJitCode(rt->defaultFreeOp(),
-                         /* discardBaselineCode = */ true,
-                         /* releaseTypes = */ true);
+                         Zone::DiscardBaselineCode,
+                         Zone::ReleaseTypes);
   }
 }
 
 static void RelazifyFunctionsForShrinkingGC(JSRuntime* rt) {
   gcstats::AutoPhase ap(rt->gc.stats(), gcstats::PhaseKind::RELAZIFY_FUNCTIONS);
   for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
     if (zone->isSelfHostingZone()) {
       continue;
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -190,18 +190,19 @@ void Zone::sweepBreakpoints(FreeOp* fop)
   }
 }
 
 void Zone::sweepWeakMaps() {
   /* Finalize unreachable (key,value) pairs in all weak maps. */
   WeakMapBase::sweepZone(this);
 }
 
-void Zone::discardJitCode(FreeOp* fop, bool discardBaselineCode,
-                          bool releaseTypes) {
+void Zone::discardJitCode(FreeOp* fop,
+                          ShouldDiscardBaselineCode discardBaselineCode,
+                          ShouldReleaseTypes releaseTypes) {
   if (!jitZone()) {
     return;
   }
 
   if (isPreservingCode()) {
     return;
   }
 
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -181,18 +181,29 @@ class Zone : public JS::shadow::Zone,
   }
   void clearUsedByHelperThread() {
     MOZ_ASSERT(helperThreadUse_ != HelperThreadUse::None);
     helperThreadUse_ = HelperThreadUse::None;
   }
 
   void findOutgoingEdges(js::gc::ZoneComponentFinder& finder);
 
-  void discardJitCode(js::FreeOp* fop, bool discardBaselineCode = true,
-                      bool releaseTypes = false);
+  enum ShouldDiscardBaselineCode : bool {
+    KeepBaselineCode = false,
+    DiscardBaselineCode
+  };
+
+  enum ShouldReleaseTypes : bool {
+    KeepTypes = false,
+    ReleaseTypes
+  };
+
+  void discardJitCode(js::FreeOp* fop,
+                      ShouldDiscardBaselineCode discardBaselineCode = DiscardBaselineCode,
+                      ShouldReleaseTypes releaseTypes = KeepTypes);
 
   void addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
                               size_t* typePool, size_t* regexpZone,
                               size_t* jitZone, size_t* baselineStubsOptimized,
                               size_t* cachedCFG, size_t* uniqueIdMap,
                               size_t* shapeTables, size_t* atomsMarkBitmaps,
                               size_t* compartmentObjects,
                               size_t* crossCompartmentWrappersTables,
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -4796,18 +4796,17 @@ AutoClearTypeInferenceStateOnOOM::AutoCl
   zone->types.setSweepingTypes(true);
 }
 
 AutoClearTypeInferenceStateOnOOM::~AutoClearTypeInferenceStateOnOOM() {
   if (zone->types.hadOOMSweepingTypes()) {
     JSRuntime* rt = zone->runtimeFromMainThread();
     js::CancelOffThreadIonCompile(rt);
     zone->setPreservingCode(false);
-    zone->discardJitCode(rt->defaultFreeOp(),
-                         /* discardBaselineCode = */ false);
+    zone->discardJitCode(rt->defaultFreeOp(), Zone::KeepBaselineCode);
     zone->types.clearAllNewScriptsOnOOM();
   }
 
   zone->types.setSweepingTypes(false);
 }
 
 #ifdef DEBUG
 void TypeScript::printTypes(JSContext* cx, HandleScript script) const {