Commit 72d7c72f authored by Jan de Mooij's avatar Jan de Mooij
Browse files

Bug 1594054 - Move ExecutableAllocator from JitRuntime to JitZone. r=jonco,erahm

This matches the JitCode GC-thing lifetime and will hopefully help avoid
fragmentation.

Differential Revision: https://phabricator.services.mozilla.com/D52823

--HG--
extra : moz-landing-system : lando
parent 32fdd189
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -507,7 +507,6 @@ struct RuntimeSizes {
  void addToServoSizes(ServoSizes* sizes) const {
    FOR_EACH_SIZE(ADD_TO_SERVO_SIZES);
    scriptSourceInfo.addToServoSizes(sizes);
    code.addToServoSizes(sizes);
    gc.addToServoSizes(sizes);
  }

@@ -518,7 +517,6 @@ struct RuntimeSizes {
  // FineGrained, we subtract the measurements of the notable script sources
  // and move them into |notableScriptSources|.
  ScriptSourceInfo scriptSourceInfo;
  CodeSizes code;
  GCSizes gc;

  typedef js::HashMap<const char*, ScriptSourceInfo, mozilla::CStringHasher,
@@ -683,6 +681,7 @@ struct ZoneStats {
    unusedGCThings.addToServoSizes(sizes);
    stringInfo.addToServoSizes(sizes);
    shapeInfo.addToServoSizes(sizes);
    code.addToServoSizes(sizes);
  }

  FOR_EACH_SIZE(DECL_SIZE_ZERO);
@@ -694,6 +693,7 @@ struct ZoneStats {
  UnusedGCThingSizes unusedGCThings;
  StringInfo stringInfo;
  ShapeInfo shapeInfo;
  CodeSizes code;
  void* extra = nullptr;  // This field can be used by embedders.

  typedef js::HashMap<JSString*, StringInfo,
+4 −5
Original line number Diff line number Diff line
@@ -5552,6 +5552,10 @@ IncrementalProgress GCRuntime::endSweepingSweepGroup(JSFreeOp* fop,

  /* Update the GC state for zones we have swept. */
  for (SweepGroupZonesIter zone(this); !zone.done(); zone.next()) {
    if (jit::JitZone* jitZone = zone->jitZone()) {
      // Clear out any small pools that we're hanging on to.
      jitZone->execAlloc().purge();
    }
    AutoLockGC lock(this);
    zone->changeGCState(Zone::Sweep, Zone::Finished);
    zone->updateGCThresholds(*this, invocationKind, lock);
@@ -6357,11 +6361,6 @@ void GCRuntime::endSweepPhase(bool destroyingRuntime) {
     * script's filename. See bug 323267.
     */
    SweepScriptData(rt);

    /* Clear out any small pools that we're hanging on to. */
    if (rt->hasJitRuntime()) {
      rt->jitRuntime()->execAlloc().purge();
    }
  }

  {
+7 −6
Original line number Diff line number Diff line
@@ -580,15 +580,16 @@ void Zone::traceAtomCache(JSTracer* trc) {
}

void Zone::addSizeOfIncludingThis(
    mozilla::MallocSizeOf mallocSizeOf, size_t* typePool, size_t* regexpZone,
    size_t* jitZone, size_t* baselineStubsOptimized, size_t* cachedCFG,
    size_t* uniqueIdMap, size_t* shapeCaches, size_t* atomsMarkBitmaps,
    size_t* compartmentObjects, size_t* crossCompartmentWrappersTables,
    size_t* compartmentsPrivateData, size_t* scriptCountsMapArg) {
    mozilla::MallocSizeOf mallocSizeOf, JS::CodeSizes* code, size_t* typePool,
    size_t* regexpZone, size_t* jitZone, size_t* baselineStubsOptimized,
    size_t* cachedCFG, size_t* uniqueIdMap, size_t* shapeCaches,
    size_t* atomsMarkBitmaps, size_t* compartmentObjects,
    size_t* crossCompartmentWrappersTables, size_t* compartmentsPrivateData,
    size_t* scriptCountsMapArg) {
  *typePool += types.typeLifoAlloc().sizeOfExcludingThis(mallocSizeOf);
  *regexpZone += regExps().sizeOfExcludingThis(mallocSizeOf);
  if (jitZone_) {
    jitZone_->addSizeOfIncludingThis(mallocSizeOf, jitZone,
    jitZone_->addSizeOfIncludingThis(mallocSizeOf, code, jitZone,
                                     baselineStubsOptimized, cachedCFG);
  }
  *uniqueIdMap += uniqueIds().shallowSizeOfExcludingThis(mallocSizeOf);
+6 −5
Original line number Diff line number Diff line
@@ -210,11 +210,12 @@ class Zone : public js::ZoneAllocator, public js::gc::GraphNodeBase<JS::Zone> {
      ShouldDiscardJitScripts discardJitScripts = KeepJitScripts);

  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* shapeCaches, size_t* atomsMarkBitmaps,
      size_t* compartmentObjects, size_t* crossCompartmentWrappersTables,
      size_t* compartmentsPrivateData, size_t* scriptCountsMapArg);
      mozilla::MallocSizeOf mallocSizeOf, JS::CodeSizes* code, size_t* typePool,
      size_t* regexpZone, size_t* jitZone, size_t* baselineStubsOptimized,
      size_t* cachedCFG, size_t* uniqueIdMap, size_t* shapeCaches,
      size_t* atomsMarkBitmaps, size_t* compartmentObjects,
      size_t* crossCompartmentWrappersTables, size_t* compartmentsPrivateData,
      size_t* scriptCountsMapArg);

  // Iterate over all cells in the zone. See the definition of ZoneCellIter
  // in gc/GC-inl.h for the possible arguments and documentation.
+4 −3
Original line number Diff line number Diff line
@@ -156,8 +156,7 @@ bool jit::InitializeJit() {
}

JitRuntime::JitRuntime()
    : execAlloc_(),
      nextCompilationId_(0),
    : nextCompilationId_(0),
      exceptionTailOffset_(0),
      bailoutTailOffset_(0),
      profilerExitFrameTailOffset_(0),
@@ -609,7 +608,7 @@ size_t JitRealm::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
}

void JitZone::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
                                     size_t* jitZone,
                                     JS::CodeSizes* code, size_t* jitZone,
                                     size_t* baselineStubsOptimized,
                                     size_t* cachedCFG) const {
  *jitZone += mallocSizeOf(this);
@@ -617,6 +616,8 @@ void JitZone::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
      baselineCacheIRStubCodes_.shallowSizeOfExcludingThis(mallocSizeOf);
  *jitZone += ionCacheIRStubInfoSet_.shallowSizeOfExcludingThis(mallocSizeOf);

  execAlloc().addSizeOfCode(code);

  *baselineStubsOptimized +=
      optimizedStubSpace_.sizeOfExcludingThis(mallocSizeOf);
  *cachedCFG += cfgSpace_.sizeOfExcludingThis(mallocSizeOf);
Loading