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 453709 3588e0ddb99e
parent 453708 e3d38e17dec8
child 453710 1957ef91d750
push id111132
push userjcoppeard@mozilla.com
push dateMon, 14 Jan 2019 13:38:39 +0000
treeherdermozilla-inbound@3588e0ddb99e [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 {