From 867bfbd87902a68680286ee9c52d882d854b90d3 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 19:53:53 +0200 Subject: Remove GCZeal: Base cleanup UXP repo issue #8 --- dom/workers/RuntimeService.cpp | 67 ---- dom/workers/RuntimeService.h | 13 - dom/workers/WorkerPrefs.h | 3 - dom/workers/WorkerPrivate.cpp | 60 ---- dom/workers/WorkerPrivate.h | 5 - dom/workers/Workers.h | 8 - js/src/builtin/TestingFunctions.cpp | 202 ----------- js/src/devtools/automation/variants/compacting | 1 - js/src/devtools/automation/variants/rootanalysis | 1 - js/src/gc/Allocator.cpp | 7 +- js/src/gc/GCInternals.h | 40 --- js/src/gc/GCRuntime.h | 98 ------ js/src/gc/Heap.h | 16 - js/src/gc/Nursery.cpp | 82 ----- js/src/gc/Nursery.h | 10 - js/src/gc/Verifier.cpp | 414 ----------------------- js/src/jsapi.h | 13 - js/src/jsgcinlines.h | 6 - 18 files changed, 1 insertion(+), 1045 deletions(-) diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index d1d76e3d1..1f5616873 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -290,13 +290,6 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */) return; } -#ifdef JS_GC_ZEAL - if (prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL) || - prefName.EqualsLiteral(PREF_WORKERS_OPTIONS_PREFIX PREF_GCZEAL)) { - return; - } -#endif - // Context options. JS::ContextOptions contextOptions; contextOptions.setAsmJS(GetWorkerPref(NS_LITERAL_CSTRING("asmjs"))) @@ -317,37 +310,6 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */) } } -#ifdef JS_GC_ZEAL -void -LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */) -{ - AssertIsOnMainThread(); - - RuntimeService* rts = RuntimeService::GetService(); - if (!rts) { - // May be shutting down, just bail. - return; - } - - int32_t gczeal = GetWorkerPref(NS_LITERAL_CSTRING(PREF_GCZEAL), -1); - if (gczeal < 0) { - gczeal = 0; - } - - int32_t frequency = - GetWorkerPref(NS_LITERAL_CSTRING("gcZeal.frequency"), -1); - if (frequency < 0) { - frequency = JS_DEFAULT_ZEAL_FREQ; - } - - RuntimeService::SetDefaultGCZeal(uint8_t(gczeal), uint32_t(frequency)); - - if (rts) { - rts->UpdateAllWorkerGCZeal(); - } -} -#endif - void UpdateCommonJSGCMemoryOption(RuntimeService* aRuntimeService, const nsACString& aPrefName, JSGCParamKey aKey) @@ -994,10 +956,6 @@ InitJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSContext* aWorkerCx) js::SetCTypesActivityCallback(aWorkerCx, CTypesActivityCallback); -#ifdef JS_GC_ZEAL - JS_SetGCZeal(aWorkerCx, settings.gcZeal, settings.gcZealFrequency); -#endif - return true; } @@ -1981,10 +1939,6 @@ RuntimeService::Init() sDefaultJSSettings.chrome.maxScriptRuntime = -1; sDefaultJSSettings.chrome.compartmentOptions.behaviors().setVersion(JSVERSION_LATEST); sDefaultJSSettings.content.maxScriptRuntime = MAX_SCRIPT_RUN_TIME_SEC; -#ifdef JS_GC_ZEAL - sDefaultJSSettings.gcZealFrequency = JS_DEFAULT_ZEAL_FREQ; - sDefaultJSSettings.gcZeal = 0; -#endif SetDefaultJSGCSettings(JSGC_MAX_BYTES, WORKER_DEFAULT_RUNTIME_HEAPSIZE); SetDefaultJSGCSettings(JSGC_ALLOCATION_THRESHOLD, WORKER_DEFAULT_ALLOCATION_THRESHOLD); @@ -2033,12 +1987,6 @@ RuntimeService::Init() LoadJSGCMemoryOptions, PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX, nullptr)) || -#ifdef JS_GC_ZEAL - NS_FAILED(Preferences::RegisterCallback( - LoadGCZealOptions, - PREF_JS_OPTIONS_PREFIX PREF_GCZEAL, - nullptr)) || -#endif #define WORKER_SIMPLE_PREF(name, getter, NAME) \ NS_FAILED(Preferences::RegisterCallbackAndCall( \ @@ -2227,12 +2175,6 @@ RuntimeService::Cleanup() #undef WORKER_SIMPLE_PREF #undef WORKER_PREF -#ifdef JS_GC_ZEAL - NS_FAILED(Preferences::UnregisterCallback( - LoadGCZealOptions, - PREF_JS_OPTIONS_PREFIX PREF_GCZEAL, - nullptr)) || -#endif NS_FAILED(Preferences::UnregisterCallback( LoadJSGCMemoryOptions, PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX, @@ -2644,15 +2586,6 @@ RuntimeService::UpdateAllWorkerMemoryParameter(JSGCParamKey aKey, BROADCAST_ALL_WORKERS(UpdateJSWorkerMemoryParameter, aKey, aValue); } -#ifdef JS_GC_ZEAL -void -RuntimeService::UpdateAllWorkerGCZeal() -{ - BROADCAST_ALL_WORKERS(UpdateGCZeal, sDefaultJSSettings.gcZeal, - sDefaultJSSettings.gcZealFrequency); -} -#endif - void RuntimeService::GarbageCollectAllWorkers(bool aShrinking) { diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index 2e5cc1dad..2ab8cbabe 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -215,19 +215,6 @@ public: void UpdateAllWorkerMemoryParameter(JSGCParamKey aKey, uint32_t aValue); -#ifdef JS_GC_ZEAL - static void - SetDefaultGCZeal(uint8_t aGCZeal, uint32_t aFrequency) - { - AssertIsOnMainThread(); - sDefaultJSSettings.gcZeal = aGCZeal; - sDefaultJSSettings.gcZealFrequency = aFrequency; - } - - void - UpdateAllWorkerGCZeal(); -#endif - void GarbageCollectAllWorkers(bool aShrinking); diff --git a/dom/workers/WorkerPrefs.h b/dom/workers/WorkerPrefs.h index c9b605a84..9a1be4801 100644 --- a/dom/workers/WorkerPrefs.h +++ b/dom/workers/WorkerPrefs.h @@ -44,6 +44,3 @@ WORKER_PREF("intl.accept_languages", PrefLanguagesChanged) WORKER_PREF("general.appname.override", AppNameOverrideChanged) WORKER_PREF("general.appversion.override", AppVersionOverrideChanged) WORKER_PREF("general.platform.override", PlatformOverrideChanged) -#ifdef JS_GC_ZEAL -WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions) -#endif diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 1df4e5551..c2ab4aca3 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1391,30 +1391,6 @@ private: } }; -#ifdef JS_GC_ZEAL -class UpdateGCZealRunnable final : public WorkerControlRunnable -{ - uint8_t mGCZeal; - uint32_t mFrequency; - -public: - UpdateGCZealRunnable(WorkerPrivate* aWorkerPrivate, - uint8_t aGCZeal, - uint32_t aFrequency) - : WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount), - mGCZeal(aGCZeal), mFrequency(aFrequency) - { } - -private: - virtual bool - WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override - { - aWorkerPrivate->UpdateGCZealInternal(aCx, mGCZeal, mFrequency); - return true; - } -}; -#endif - class GarbageCollectRunnable final : public WorkerControlRunnable { bool mShrinking; @@ -3148,27 +3124,6 @@ WorkerPrivateParent::UpdateJSWorkerMemoryParameter(JSGCParamKey aKey, } } -#ifdef JS_GC_ZEAL -template -void -WorkerPrivateParent::UpdateGCZeal(uint8_t aGCZeal, uint32_t aFrequency) -{ - AssertIsOnParentThread(); - - { - MutexAutoLock lock(mMutex); - mJSSettings.gcZeal = aGCZeal; - mJSSettings.gcZealFrequency = aFrequency; - } - - RefPtr runnable = - new UpdateGCZealRunnable(ParentAsWorkerPrivate(), aGCZeal, aFrequency); - if (!runnable->Dispatch()) { - NS_WARNING("Failed to update worker gczeal!"); - } -} -#endif - template void WorkerPrivateParent::GarbageCollect(bool aShrinking) @@ -6323,21 +6278,6 @@ WorkerPrivate::UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, } } -#ifdef JS_GC_ZEAL -void -WorkerPrivate::UpdateGCZealInternal(JSContext* aCx, uint8_t aGCZeal, - uint32_t aFrequency) -{ - AssertIsOnWorkerThread(); - - JS_SetGCZeal(aCx, aGCZeal, aFrequency); - - for (uint32_t index = 0; index < mChildWorkers.Length(); index++) { - mChildWorkers[index]->UpdateGCZeal(aGCZeal, aFrequency); - } -} -#endif - void WorkerPrivate::GarbageCollectInternal(JSContext* aCx, bool aShrinking, bool aCollectChildren) diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index ad906b054..8008f30e5 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -386,11 +386,6 @@ public: void UpdateJSWorkerMemoryParameter(JSGCParamKey key, uint32_t value); -#ifdef JS_GC_ZEAL - void - UpdateGCZeal(uint8_t aGCZeal, uint32_t aFrequency); -#endif - void GarbageCollect(bool aShrinking); diff --git a/dom/workers/Workers.h b/dom/workers/Workers.h index 89e2ccfca..ad083d3b8 100644 --- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -143,15 +143,7 @@ struct JSSettings JSGCSettingsArray gcSettings; JS::ContextOptions contextOptions; -#ifdef JS_GC_ZEAL - uint8_t gcZeal; - uint32_t gcZealFrequency; -#endif - JSSettings() -#ifdef JS_GC_ZEAL - : gcZeal(0), gcZealFrequency(0) -#endif { for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { new (gcSettings + index) JSGCSetting(); diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 5bc69a346..92517df03 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -188,11 +188,7 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) if (!JS_SetProperty(cx, info, "tsan", value)) return false; -#ifdef JS_GC_ZEAL - value = BooleanValue(true); -#else value = BooleanValue(false); -#endif if (!JS_SetProperty(cx, info, "has-gczeal", value)) return false; @@ -731,171 +727,6 @@ GCPreserveCode(JSContext* cx, unsigned argc, Value* vp) return true; } -#ifdef JS_GC_ZEAL -static bool -GCZeal(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - if (args.length() > 2) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Too many arguments"); - return false; - } - - uint32_t zeal; - if (!ToUint32(cx, args.get(0), &zeal)) - return false; - - if (zeal > uint32_t(gc::ZealMode::Limit)) { - JS_ReportErrorASCII(cx, "gczeal argument out of range"); - return false; - } - - uint32_t frequency = JS_DEFAULT_ZEAL_FREQ; - if (args.length() >= 2) { - if (!ToUint32(cx, args.get(1), &frequency)) - return false; - } - - JS_SetGCZeal(cx, (uint8_t)zeal, frequency); - args.rval().setUndefined(); - return true; -} - -static bool -ScheduleGC(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - if (args.length() > 1) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Too many arguments"); - return false; - } - - if (args.length() == 0) { - /* Fetch next zeal trigger only. */ - } else if (args[0].isInt32()) { - /* Schedule a GC to happen after |arg| allocations. */ - JS_ScheduleGC(cx, args[0].toInt32()); - } else if (args[0].isObject()) { - /* Ensure that |zone| is collected during the next GC. */ - Zone* zone = UncheckedUnwrap(&args[0].toObject())->zone(); - PrepareZoneForGC(zone); - } else if (args[0].isString()) { - /* This allows us to schedule the atoms zone for GC. */ - Zone* zone = args[0].toString()->zoneFromAnyThread(); - if (!CurrentThreadCanAccessZone(zone)) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Specified zone not accessible for GC"); - return false; - } - PrepareZoneForGC(zone); - } else { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Bad argument - expecting integer, object or string"); - return false; - } - - uint32_t zealBits; - uint32_t freq; - uint32_t next; - JS_GetGCZealBits(cx, &zealBits, &freq, &next); - args.rval().setInt32(next); - return true; -} - -static bool -SelectForGC(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - /* - * The selectedForMarking set is intended to be manually marked at slice - * start to detect missing pre-barriers. It is invalid for nursery things - * to be in the set, so evict the nursery before adding items. - */ - JSRuntime* rt = cx->runtime(); - rt->gc.evictNursery(); - - for (unsigned i = 0; i < args.length(); i++) { - if (args[i].isObject()) { - if (!rt->gc.selectForMarking(&args[i].toObject())) - return false; - } - } - - args.rval().setUndefined(); - return true; -} - -static bool -VerifyPreBarriers(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - if (args.length() > 0) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Too many arguments"); - return false; - } - - gc::VerifyBarriers(cx->runtime(), gc::PreBarrierVerifier); - args.rval().setUndefined(); - return true; -} - -static bool -VerifyPostBarriers(JSContext* cx, unsigned argc, Value* vp) -{ - // This is a no-op since the post barrier verifier was removed. - CallArgs args = CallArgsFromVp(argc, vp); - if (args.length()) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Too many arguments"); - return false; - } - args.rval().setUndefined(); - return true; -} - -static bool -GCState(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - if (args.length() != 0) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Too many arguments"); - return false; - } - - const char* state = StateName(cx->runtime()->gc.state()); - JSString* str = JS_NewStringCopyZ(cx, state); - if (!str) - return false; - args.rval().setString(str); - return true; -} - -static bool -DeterministicGC(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - if (args.length() != 1) { - RootedObject callee(cx, &args.callee()); - ReportUsageErrorASCII(cx, callee, "Wrong number of arguments"); - return false; - } - - cx->runtime()->gc.setDeterministic(ToBoolean(args[0])); - args.rval().setUndefined(); - return true; -} -#endif /* JS_GC_ZEAL */ - static bool StartGC(JSContext* cx, unsigned argc, Value* vp) { @@ -4387,39 +4218,6 @@ JS_FN_HELP("rejectPromise", RejectPromise, 2, 0, "gcPreserveCode()", " Preserve JIT code during garbage collections."), -#ifdef JS_GC_ZEAL - JS_FN_HELP("gczeal", GCZeal, 2, 0, -"gczeal(level, [N])", -gc::ZealModeHelpText), - - JS_FN_HELP("schedulegc", ScheduleGC, 1, 0, -"schedulegc([num | obj | string])", -" If num is given, schedule a GC after num allocations.\n" -" If obj is given, schedule a GC of obj's zone.\n" -" If string is given, schedule a GC of the string's zone if possible.\n" -" Returns the number of allocations before the next trigger."), - - JS_FN_HELP("selectforgc", SelectForGC, 0, 0, -"selectforgc(obj1, obj2, ...)", -" Schedule the given objects to be marked in the next GC slice."), - - JS_FN_HELP("verifyprebarriers", VerifyPreBarriers, 0, 0, -"verifyprebarriers()", -" Start or end a run of the pre-write barrier verifier."), - - JS_FN_HELP("verifypostbarriers", VerifyPostBarriers, 0, 0, -"verifypostbarriers()", -" Does nothing (the post-write barrier verifier has been remove)."), - - JS_FN_HELP("gcstate", GCState, 0, 0, -"gcstate()", -" Report the global GC state."), - - JS_FN_HELP("deterministicgc", DeterministicGC, 1, 0, -"deterministicgc(true|false)", -" If true, only allow determinstic GCs to run."), -#endif - JS_FN_HELP("startgc", StartGC, 1, 0, "startgc([n [, 'shrinking']])", " Start an incremental GC and run a slice that processes about n objects.\n" diff --git a/js/src/devtools/automation/variants/compacting b/js/src/devtools/automation/variants/compacting index cd1891bfe..2ffade6ac 100644 --- a/js/src/devtools/automation/variants/compacting +++ b/js/src/devtools/automation/variants/compacting @@ -3,7 +3,6 @@ "optimize": true, "debug": true, "env": { - "JS_GC_ZEAL": "Compact", "JITTEST_EXTRA_ARGS": "--jitflags=debug --ignore-timeouts={DIR}/cgc-jittest-timeouts.txt", "JSTESTS_EXTRA_ARGS": "--exclude-file={DIR}/cgc-jstests-slow.txt" }, diff --git a/js/src/devtools/automation/variants/rootanalysis b/js/src/devtools/automation/variants/rootanalysis index c5ed4dfcd..508e1e2db 100644 --- a/js/src/devtools/automation/variants/rootanalysis +++ b/js/src/devtools/automation/variants/rootanalysis @@ -3,7 +3,6 @@ "optimize": true, "debug": true, "env": { - "JS_GC_ZEAL": "GenerationalGC", "JSTESTS_EXTRA_ARGS": "--jitflags=debug" } } diff --git a/js/src/gc/Allocator.cpp b/js/src/gc/Allocator.cpp index f7dc50d02..3994d5a5b 100644 --- a/js/src/gc/Allocator.cpp +++ b/js/src/gc/Allocator.cpp @@ -190,7 +190,7 @@ GCRuntime::checkAllocatorState(JSContext* cx, AllocKind kind) return false; } -#if defined(JS_GC_ZEAL) || defined(DEBUG) +#if defined(DEBUG) MOZ_ASSERT_IF(cx->compartment()->isAtomsCompartment(), kind == AllocKind::ATOM || kind == AllocKind::FAT_INLINE_ATOM || @@ -223,11 +223,6 @@ GCRuntime::checkAllocatorState(JSContext* cx, AllocKind kind) bool GCRuntime::gcIfNeededPerAllocation(JSContext* cx) { -#ifdef JS_GC_ZEAL - if (needZealousGC()) - runDebugGC(); -#endif - // Invoking the interrupt callback can fail and we can't usefully // handle that here. Just check in case we need to collect instead. if (rt->hasPendingInterrupt()) diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index 722539e1c..0d2bed0c1 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -61,50 +61,10 @@ class MOZ_RAII AutoPrepareForTracing AbortReason IsIncrementalGCUnsafe(JSRuntime* rt); -#ifdef JS_GC_ZEAL - -class MOZ_RAII AutoStopVerifyingBarriers -{ - GCRuntime* gc; - bool restartPreVerifier; - - public: - AutoStopVerifyingBarriers(JSRuntime* rt, bool isShutdown) - : gc(&rt->gc) - { - if (gc->isVerifyPreBarriersEnabled()) { - gc->endVerifyPreBarriers(); - restartPreVerifier = !isShutdown; - } else { - restartPreVerifier = false; - } - } - - ~AutoStopVerifyingBarriers() { - // Nasty special case: verification runs a minor GC, which *may* nest - // inside of an outer minor GC. This is not allowed by the - // gc::Statistics phase tree. So we pause the "real" GC, if in fact one - // is in progress. - gcstats::Phase outer = gc->stats.currentPhase(); - if (outer != gcstats::PHASE_NONE) - gc->stats.endPhase(outer); - MOZ_ASSERT((gc->stats.currentPhase() == gcstats::PHASE_NONE) || - (gc->stats.currentPhase() == gcstats::PHASE_GC_BEGIN) || - (gc->stats.currentPhase() == gcstats::PHASE_GC_END)); - - if (restartPreVerifier) - gc->startVerifyPreBarriers(); - - if (outer != gcstats::PHASE_NONE) - gc->stats.beginPhase(outer); - } -}; -#else struct MOZ_RAII AutoStopVerifyingBarriers { AutoStopVerifyingBarriers(JSRuntime*, bool) {} }; -#endif /* JS_GC_ZEAL */ #ifdef JSGC_HASH_TABLE_CHECKS void CheckHashTablesAfterMovingGC(JSRuntime* rt); diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 8c9322849..d4bbe29db 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -653,19 +653,6 @@ class GCRuntime void onOutOfMallocMemory(); void onOutOfMallocMemory(const AutoLockGC& lock); -#ifdef JS_GC_ZEAL - const void* addressOfZealModeBits() { return &zealModeBits; } - void getZealBits(uint32_t* zealBits, uint32_t* frequency, uint32_t* nextScheduled); - void setZeal(uint8_t zeal, uint32_t frequency); - bool parseAndSetZeal(const char* str); - void setNextScheduled(uint32_t count); - void verifyPreBarriers(); - void maybeVerifyPreBarriers(bool always); - bool selectForMarking(JSObject* object); - void clearSelectedForMarking(); - void setDeterministic(bool enable); -#endif - size_t maxMallocBytesAllocated() { return maxMallocBytes; } uint64_t nextCellUniqueId() { @@ -851,14 +838,7 @@ class GCRuntime AutoMaybeStartBackgroundAllocation& maybeStartBGAlloc); void recycleChunk(Chunk* chunk, const AutoLockGC& lock); -#ifdef JS_GC_ZEAL - void startVerifyPreBarriers(); - void endVerifyPreBarriers(); - void finishVerifier(); - bool isVerifyPreBarriersEnabled() const { return !!verifyPreData; } -#else bool isVerifyPreBarriersEnabled() const { return false; } -#endif // Free certain LifoAlloc blocks when it is safe to do so. void freeUnusedLifoBlocksAfterSweeping(LifoAlloc* lifo); @@ -1219,10 +1199,6 @@ class GCRuntime ZoneList zonesToMaybeCompact; Arena* relocatedArenasToRelease; -#ifdef JS_GC_ZEAL - MarkingValidator* markingValidator; -#endif - /* * Indicates that a GC slice has taken place in the middle of an animation * frame, rather than at the beginning. In this case, the next slice will be @@ -1274,40 +1250,6 @@ class GCRuntime bool poked; - /* - * These options control the zealousness of the GC. At every allocation, - * nextScheduled is decremented. When it reaches zero we do a full GC. - * - * At this point, if zeal_ is one of the types that trigger periodic - * collection, then nextScheduled is reset to the value of zealFrequency. - * Otherwise, no additional GCs take place. - * - * You can control these values in several ways: - * - Set the JS_GC_ZEAL environment variable - * - Call gczeal() or schedulegc() from inside shell-executed JS code - * (see the help for details) - * - * If gcZeal_ == 1 then we perform GCs in select places (during MaybeGC and - * whenever a GC poke happens). This option is mainly useful to embedders. - * - * We use zeal_ == 4 to enable write barrier verification. See the comment - * in jsgc.cpp for more information about this. - * - * zeal_ values from 8 to 10 periodically run different types of - * incremental GC. - * - * zeal_ value 14 performs periodic shrinking collections. - */ -#ifdef JS_GC_ZEAL - uint32_t zealModeBits; - int zealFrequency; - int nextScheduled; - bool deterministicOnly; - int incrementalLimit; - - Vector selectedForMarking; -#endif - bool fullCompartmentChecks; Callback gcCallback; @@ -1415,50 +1357,10 @@ class MOZ_RAII AutoMaybeStartBackgroundAllocation } }; -#ifdef JS_GC_ZEAL - -inline bool -GCRuntime::hasZealMode(ZealMode mode) -{ - static_assert(size_t(ZealMode::Limit) < sizeof(zealModeBits) * 8, - "Zeal modes must fit in zealModeBits"); - return zealModeBits & (1 << uint32_t(mode)); -} - -inline void -GCRuntime::clearZealMode(ZealMode mode) -{ - zealModeBits &= ~(1 << uint32_t(mode)); - MOZ_ASSERT(!hasZealMode(mode)); -} - -inline bool -GCRuntime::upcomingZealousGC() { - return nextScheduled == 1; -} - -inline bool -GCRuntime::needZealousGC() { - if (nextScheduled > 0 && --nextScheduled == 0) { - if (hasZealMode(ZealMode::Alloc) || - hasZealMode(ZealMode::GenerationalGC) || - hasZealMode(ZealMode::IncrementalRootsThenFinish) || - hasZealMode(ZealMode::IncrementalMarkAllThenFinish) || - hasZealMode(ZealMode::IncrementalMultipleSlices) || - hasZealMode(ZealMode::Compact)) - { - nextScheduled = zealFrequency; - } - return true; - } - return false; -} -#else inline bool GCRuntime::hasZealMode(ZealMode mode) { return false; } inline void GCRuntime::clearZealMode(ZealMode mode) { } inline bool GCRuntime::upcomingZealousGC() { return false; } inline bool GCRuntime::needZealousGC() { return false; } -#endif } /* namespace gc */ diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h index 2a9390e91..697803380 100644 --- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -1322,22 +1322,6 @@ TenuredCell::writeBarrierPre(TenuredCell* thing) if (!thing) return; -#ifdef JS_GC_ZEAL - // When verifying pre barriers we need to switch on all barriers, even - // those on the Atoms Zone. Normally, we never enter a parse task when - // collecting in the atoms zone, so will filter out atoms below. - // Unfortuantely, If we try that when verifying pre-barriers, we'd never be - // able to handle OMT parse tasks at all as we switch on the verifier any - // time we're not doing GC. This would cause us to deadlock, as OMT parsing - // is meant to resume after GC work completes. Instead we filter out any - // OMT barriers that reach us and assert that they would normally not be - // possible. - if (!CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread())) { - AssertSafeToSkipBarrier(thing); - return; - } -#endif - JS::shadow::Zone* shadowZone = thing->shadowZoneFromAnyThread(); if (shadowZone->needsIncrementalBarrier()) { MOZ_ASSERT(!RuntimeFromMainThreadIsHeapMajorCollecting(shadowZone)); diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 2c402fe0b..d37c1673b 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -74,14 +74,6 @@ struct js::Nursery::SweepAction #endif }; -#ifdef JS_GC_ZEAL -struct js::Nursery::Canary -{ - uintptr_t magicValue; - Canary* next; -}; -#endif - inline void js::Nursery::NurseryChunk::poisonAndInit(JSRuntime* rt, uint8_t poison) { @@ -124,9 +116,6 @@ js::Nursery::Nursery(JSRuntime* rt) , minorGcCount_(0) , freeMallocedBuffersTask(nullptr) , sweepActions_(nullptr) -#ifdef JS_GC_ZEAL - , lastCanary_(nullptr) -#endif {} bool @@ -209,10 +198,6 @@ js::Nursery::enable() setCurrentChunk(0); setStartPosition(); -#ifdef JS_GC_ZEAL - if (runtime()->hasZealMode(ZealMode::GenerationalGC)) - enterZealMode(); -#endif MOZ_ALWAYS_TRUE(runtime()->gc.storeBuffer.enable()); return; @@ -243,23 +228,6 @@ js::Nursery::isEmpty() const return position() == currentStartPosition_; } -#ifdef JS_GC_ZEAL -void -js::Nursery::enterZealMode() { - if (isEnabled()) - updateNumChunks(maxNurseryChunks_); -} - -void -js::Nursery::leaveZealMode() { - if (isEnabled()) { - MOZ_ASSERT(isEmpty()); - setCurrentChunk(0); - setStartPosition(); - } -} -#endif // JS_GC_ZEAL - JSObject* js::Nursery::allocateObject(JSContext* cx, size_t size, size_t numDynamic, const js::Class* clasp) { @@ -305,12 +273,6 @@ js::Nursery::allocate(size_t size) MOZ_ASSERT(position() % gc::CellSize == 0); MOZ_ASSERT(size % gc::CellSize == 0); -#ifdef JS_GC_ZEAL - static const size_t CanarySize = (sizeof(Nursery::Canary) + CellSize - 1) & ~CellMask; - if (runtime()->gc.hasZealMode(ZealMode::CheckNursery)) - size += CanarySize; -#endif - if (currentEnd() < position() + size) { if (currentChunk_ + 1 == numChunks()) return nullptr; @@ -322,19 +284,6 @@ js::Nursery::allocate(size_t size) JS_EXTRA_POISON(thing, JS_ALLOCATED_NURSERY_PATTERN, size); -#ifdef JS_GC_ZEAL - if (runtime()->gc.hasZealMode(ZealMode::CheckNursery)) { - auto canary = reinterpret_cast(position() - CanarySize); - canary->magicValue = CanaryMagicValue; - canary->next = nullptr; - if (lastCanary_) { - MOZ_ASSERT(!lastCanary_->next); - lastCanary_->next = canary; - } - lastCanary_ = canary; - } -#endif - MemProfiler::SampleNursery(reinterpret_cast(thing), size); return thing; } @@ -561,14 +510,6 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason) rt->gc.incMinorGcNumber(); -#ifdef JS_GC_ZEAL - if (rt->gc.hasZealMode(ZealMode::CheckNursery)) { - for (auto canary = lastCanary_; canary; canary = canary->next) - MOZ_ASSERT(canary->magicValue == CanaryMagicValue); - } - lastCanary_ = nullptr; -#endif - rt->gc.stats.beginNurseryCollection(reason); TraceMinorGCStart(); @@ -752,10 +693,6 @@ js::Nursery::doCollection(JSRuntime* rt, JS::gcreason::Reason reason, // Make sure hashtables have been updated after the collection. maybeStartProfile(ProfileKey::CheckHashTables); -#ifdef JS_GC_ZEAL - if (rt->hasZealMode(ZealMode::CheckHashTablesOnMinorGC)) - CheckHashTablesAfterMovingGC(rt); -#endif maybeEndProfile(ProfileKey::CheckHashTables); // Calculate and return the promotion rate. @@ -828,17 +765,6 @@ js::Nursery::sweep() runSweepActions(); sweepDictionaryModeObjects(); -#ifdef JS_GC_ZEAL - /* Poison the nursery contents so touching a freed object will crash. */ - for (unsigned i = 0; i < numChunks(); i++) - chunk(i).poisonAndInit(runtime(), JS_SWEPT_NURSERY_PATTERN); - - if (runtime()->hasZealMode(ZealMode::GenerationalGC)) { - /* Only reset the alloc point when we are close to the end. */ - if (currentChunk_ + 1 == numChunks()) - setCurrentChunk(0); - } else -#endif { #ifdef JS_CRASH_DIAGNOSTICS for (unsigned i = 0; i < numChunks(); ++i) @@ -916,20 +842,12 @@ js::Nursery::growAllocableSpace() void js::Nursery::shrinkAllocableSpace() { -#ifdef JS_GC_ZEAL - if (runtime()->hasZealMode(ZealMode::GenerationalGC)) - return; -#endif updateNumChunks(Max(numChunks() - 1, 1u)); } void js::Nursery::minimizeAllocableSpace() { -#ifdef JS_GC_ZEAL - if (runtime()->hasZealMode(ZealMode::GenerationalGC)) - return; -#endif updateNumChunks(1); } diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index 69fb66b7a..9195e024d 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -252,11 +252,6 @@ class Nursery (numChunks() - currentChunk_ - 1) * NurseryChunkUsableSize; } -#ifdef JS_GC_ZEAL - void enterZealMode(); - void leaveZealMode(); -#endif - /* Print total profile times on shutdown. */ void printTotalProfileTimes(); @@ -374,11 +369,6 @@ class Nursery using NativeObjectVector = Vector; NativeObjectVector dictionaryModeObjects_; -#ifdef JS_GC_ZEAL - struct Canary; - Canary* lastCanary_; -#endif - NurseryChunk* allocChunk(); NurseryChunk& chunk(unsigned index) const { diff --git a/js/src/gc/Verifier.cpp b/js/src/gc/Verifier.cpp index dd4031606..3ebbbb4f6 100644 --- a/js/src/gc/Verifier.cpp +++ b/js/src/gc/Verifier.cpp @@ -26,420 +26,6 @@ using namespace js; using namespace js::gc; -#ifdef JS_GC_ZEAL - -/* - * Write barrier verification - * - * The next few functions are for write barrier verification. - * - * The VerifyBarriers function is a shorthand. It checks if a verification phase - * is currently running. If not, it starts one. Otherwise, it ends the current - * phase and starts a new one. - * - * The user can adjust the frequency of verifications, which causes - * VerifyBarriers to be a no-op all but one out of N calls. However, if the - * |always| parameter is true, it starts a new phase no matter what. - * - * Pre-Barrier Verifier: - * When StartVerifyBarriers is called, a snapshot is taken of all objects in - * the GC heap and saved in an explicit graph data structure. Later, - * EndVerifyBarriers traverses the heap again. Any pointer values that were in - * the snapshot and are no longer found must be marked; otherwise an assertion - * triggers. Note that we must not GC in between starting and finishing a - * verification phase. - */ - -struct EdgeValue -{ - void* thing; - JS::TraceKind kind; - const char* label; -}; - -struct VerifyNode -{ - void* thing; - JS::TraceKind kind; - uint32_t count; - EdgeValue edges[1]; -}; - -typedef HashMap, SystemAllocPolicy> NodeMap; - -/* - * The verifier data structures are simple. The entire graph is stored in a - * single block of memory. At the beginning is a VerifyNode for the root - * node. It is followed by a sequence of EdgeValues--the exact number is given - * in the node. After the edges come more nodes and their edges. - * - * The edgeptr and term fields are used to allocate out of the block of memory - * for the graph. If we run out of memory (i.e., if edgeptr goes beyond term), - * we just abandon the verification. - * - * The nodemap field is a hashtable that maps from the address of the GC thing - * to the VerifyNode that represents it. - */ -class js::VerifyPreTracer final : public JS::CallbackTracer -{ - JS::AutoDisableGenerationalGC noggc; - - void onChild(const JS::GCCellPtr& thing) override; - - public: - /* The gcNumber when the verification began. */ - uint64_t number; - - /* This counts up to gcZealFrequency to decide whether to verify. */ - int count; - - /* This graph represents the initial GC "snapshot". */ - VerifyNode* curnode; - VerifyNode* root; - char* edgeptr; - char* term; - NodeMap nodemap; - - explicit VerifyPreTracer(JSRuntime* rt) - : JS::CallbackTracer(rt), noggc(rt), number(rt->gc.gcNumber()), count(0), curnode(nullptr), - root(nullptr), edgeptr(nullptr), term(nullptr) - {} - - ~VerifyPreTracer() { - js_free(root); - } -}; - -/* - * This function builds up the heap snapshot by adding edges to the current - * node. - */ -void -VerifyPreTracer::onChild(const JS::GCCellPtr& thing) -{ - MOZ_ASSERT(!IsInsideNursery(thing.asCell())); - - // Skip things in other runtimes. - if (thing.asCell()->asTenured().runtimeFromAnyThread() != runtime()) - return; - - edgeptr += sizeof(EdgeValue); - if (edgeptr >= term) { - edgeptr = term; - return; - } - - VerifyNode* node = curnode; - uint32_t i = node->count; - - node->edges[i].thing = thing.asCell(); - node->edges[i].kind = thing.kind(); - node->edges[i].label = contextName(); - node->count++; -} - -static VerifyNode* -MakeNode(VerifyPreTracer* trc, void* thing, JS::TraceKind kind) -{ - NodeMap::AddPtr p = trc->nodemap.lookupForAdd(thing); - if (!p) { - VerifyNode* node = (VerifyNode*)trc->edgeptr; - trc->edgeptr += sizeof(VerifyNode) - sizeof(EdgeValue); - if (trc->edgeptr >= trc->term) { - trc->edgeptr = trc->term; - return nullptr; - } - - node->thing = thing; - node->count = 0; - node->kind = kind; - if (!trc->nodemap.add(p, thing, node)) { - trc->edgeptr = trc->term; - return nullptr; - } - - return node; - } - return nullptr; -} - -static VerifyNode* -NextNode(VerifyNode* node) -{ - if (node->count == 0) - return (VerifyNode*)((char*)node + sizeof(VerifyNode) - sizeof(EdgeValue)); - else - return (VerifyNode*)((char*)node + sizeof(VerifyNode) + - sizeof(EdgeValue)*(node->count - 1)); -} - -void -gc::GCRuntime::startVerifyPreBarriers() -{ - if (verifyPreData || isIncrementalGCInProgress()) - return; - - if (IsIncrementalGCUnsafe(rt) != AbortReason::None) - return; - - number++; - - VerifyPreTracer* trc = js_new(rt); - if (!trc) - return; - - AutoPrepareForTracing prep(rt->contextFromMainThread(), WithAtoms); - - for (auto chunk = allNonEmptyChunks(); !chunk.done(); chunk.next()) - chunk->bitmap.clear(); - - gcstats::AutoPhase ap(stats, gcstats::PHASE_TRACE_HEAP); - - const size_t size = 64 * 1024 * 1024; - trc->root = (VerifyNode*)js_malloc(size); - if (!trc->root) - goto oom; - trc->edgeptr = (char*)trc->root; - trc->term = trc->edgeptr + size; - - if (!trc->nodemap.init()) - goto oom; - - /* Create the root node. */ - trc->curnode = MakeNode(trc, nullptr, JS::TraceKind(0)); - - incrementalState = State::MarkRoots; - - /* Make all the roots be edges emanating from the root node. */ - traceRuntime(trc, prep.session().lock); - - VerifyNode* node; - node = trc->curnode; - if (trc->edgeptr == trc->term) - goto oom; - - /* For each edge, make a node for it if one doesn't already exist. */ - while ((char*)node < trc->edgeptr) { - for (uint32_t i = 0; i < node->count; i++) { - EdgeValue& e = node->edges[i]; - VerifyNode* child = MakeNode(trc, e.thing, e.kind); - if (child) { - trc->curnode = child; - js::TraceChildren(trc, e.thing, e.kind); - } - if (trc->edgeptr == trc->term) - goto oom; - } - - node = NextNode(node); - } - - verifyPreData = trc; - incrementalState = State::Mark; - marker.start(); - - for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { - PurgeJITCaches(zone); - if (!zone->usedByExclusiveThread) { - zone->setNeedsIncrementalBarrier(true, Zone::UpdateJit); - zone->arenas.purge(); - } - } - - return; - -oom: - incrementalState = State::NotActive; - js_delete(trc); - verifyPreData = nullptr; -} - -static bool -IsMarkedOrAllocated(TenuredCell* cell) -{ - return cell->isMarked() || cell->arena()->allocatedDuringIncremental; -} - -struct CheckEdgeTracer : public JS::CallbackTracer { - VerifyNode* node; - explicit CheckEdgeTracer(JSRuntime* rt) : JS::CallbackTracer(rt), node(nullptr) {} - void onChild(const JS::GCCellPtr& thing) override; -}; - -static const uint32_t MAX_VERIFIER_EDGES = 1000; - -/* - * This function is called by EndVerifyBarriers for every heap edge. If the edge - * already existed in the original snapshot, we "cancel it out" by overwriting - * it with nullptr. EndVerifyBarriers later asserts that the remaining - * non-nullptr edges (i.e., the ones from the original snapshot that must have - * been modified) must point to marked objects. - */ -void -CheckEdgeTracer::onChild(const JS::GCCellPtr& thing) -{ - // Skip things in other runtimes. - if (thing.asCell()->asTenured().runtimeFromAnyThread() != runtime()) - return; - - /* Avoid n^2 behavior. */ - if (node->count > MAX_VERIFIER_EDGES) - return; - - for (uint32_t i = 0; i < node->count; i++) { - if (node->edges[i].thing == thing.asCell()) { - MOZ_ASSERT(node->edges[i].kind == thing.kind()); - node->edges[i].thing = nullptr; - return; - } - } -} - -void -js::gc::AssertSafeToSkipBarrier(TenuredCell* thing) -{ - Zone* zone = thing->zoneFromAnyThread(); - MOZ_ASSERT(!zone->needsIncrementalBarrier() || zone->isAtomsZone()); -} - -static bool -IsMarkedOrAllocated(const EdgeValue& edge) -{ - if (!edge.thing || IsMarkedOrAllocated(TenuredCell::fromPointer(edge.thing))) - return true; - - // Permanent atoms and well-known symbols aren't marked during graph traversal. - if (edge.kind == JS::TraceKind::String && static_cast(edge.thing)->isPermanentAtom()) - return true; - if (edge.kind == JS::TraceKind::Symbol && static_cast(edge.thing)->isWellKnownSymbol()) - return true; - - return false; -} - -void -gc::GCRuntime::endVerifyPreBarriers() -{ - VerifyPreTracer* trc = verifyPreData; - - if (!trc) - return; - - MOZ_ASSERT(!JS::IsGenerationalGCEnabled(rt)); - - AutoPrepareForTracing prep(rt->contextFromMainThread(), SkipAtoms); - - bool compartmentCreated = false; - - /* We need to disable barriers before tracing, which may invoke barriers. */ - for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { - if (!zone->needsIncrementalBarrier()) - compartmentCreated = true; - - zone->setNeedsIncrementalBarrier(false, Zone::UpdateJit); - PurgeJITCaches(zone); - } - - /* - * We need to bump gcNumber so that the methodjit knows that jitcode has - * been discarded. - */ - MOZ_ASSERT(trc->number == number); - number++; - - verifyPreData = nullptr; - incrementalState = State::NotActive; - - if (!compartmentCreated && IsIncrementalGCUnsafe(rt) == AbortReason::None) { - CheckEdgeTracer cetrc(rt); - - /* Start after the roots. */ - VerifyNode* node = NextNode(trc->root); - while ((char*)node < trc->edgeptr) { - cetrc.node = node; - js::TraceChildren(&cetrc, node->thing, node->kind); - - if (node->count <= MAX_VERIFIER_EDGES) { - for (uint32_t i = 0; i < node->count; i++) { - EdgeValue& edge = node->edges[i]; - if (!IsMarkedOrAllocated(edge)) { - char msgbuf[1024]; - SprintfLiteral(msgbuf, - "[barrier verifier] Unmarked edge: %s %p '%s' edge to %s %p", - JS::GCTraceKindToAscii(node->kind), node->thing, - edge.label, - JS::GCTraceKindToAscii(edge.kind), edge.thing); - MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__); - MOZ_CRASH(); - } - } - } - - node = NextNode(node); - } - } - - marker.reset(); - marker.stop(); - - js_delete(trc); -} - -/*** Barrier Verifier Scheduling ***/ - -void -gc::GCRuntime::verifyPreBarriers() -{ - if (verifyPreData) - endVerifyPreBarriers(); - else - startVerifyPreBarriers(); -} - -void -gc::VerifyBarriers(JSRuntime* rt, VerifierType type) -{ - if (type == PreBarrierVerifier) - rt->gc.verifyPreBarriers(); -} - -void -gc::GCRuntime::maybeVerifyPreBarriers(bool always) -{ - if (!hasZealMode(ZealMode::VerifierPre)) - return; - - if (rt->mainThread.suppressGC) - return; - - if (verifyPreData) { - if (++verifyPreData->count < zealFrequency && !always) - return; - - endVerifyPreBarriers(); - } - - startVerifyPreBarriers(); -} - -void -js::gc::MaybeVerifyBarriers(JSContext* cx, bool always) -{ - GCRuntime* gc = &cx->runtime()->gc; - gc->maybeVerifyPreBarriers(always); -} - -void -js::gc::GCRuntime::finishVerifier() -{ - if (verifyPreData) { - js_delete(verifyPreData); - verifyPreData = nullptr; - } -} - -#endif /* JS_GC_ZEAL */ - #ifdef JSGC_HASH_TABLE_CHECKS class CheckHeapTracer : public JS::CallbackTracer diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 6700a6c51..9ad3e757f 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -5761,19 +5761,6 @@ JS_NewObjectForConstructor(JSContext* cx, const JSClass* clasp, const JS::CallAr /************************************************************************/ -#ifdef JS_GC_ZEAL -#define JS_DEFAULT_ZEAL_FREQ 100 - -extern JS_PUBLIC_API(void) -JS_GetGCZealBits(JSContext* cx, uint32_t* zealBits, uint32_t* frequency, uint32_t* nextScheduled); - -extern JS_PUBLIC_API(void) -JS_SetGCZeal(JSContext* cx, uint8_t zeal, uint32_t frequency); - -extern JS_PUBLIC_API(void) -JS_ScheduleGC(JSContext* cx, uint32_t count); -#endif - extern JS_PUBLIC_API(void) JS_SetParallelParsingEnabled(JSContext* cx, bool enabled); diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index 9cebb03a4..c6988d7af 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -42,12 +42,6 @@ inline void GCRuntime::poke() { poked = true; - -#ifdef JS_GC_ZEAL - /* Schedule a GC to happen "soon" after a GC poke. */ - if (hasZealMode(ZealMode::Poke)) - nextScheduled = 1; -#endif } class ArenaIter -- cgit v1.2.3 From 1cac08b9a2d2171593fc6737e1b649d81ff39784 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 22:20:37 +0200 Subject: Remove remaining conditional GCZeal code. Creates stubs: jsgc.h/cpp VerifyBarriers() stub MaybeVerifyBarriers() stub GCRuntime::computeNonIncrementalMarkingForValidation() stub GCRuntime::validateIncrementalMarking() stub GCRuntime::finishMarkingValidation() stub GCRuntime::pushZealSelectedObjects() stub bool useZeal? GCRuntime::runDebugGC() stub XPConnect: nsXPCComponents_Utils::SetGCZeal() stub (always NS_OK) --- ipc/testshell/XPCShellEnvironment.cpp | 18 - js/src/jit/CompileWrappers.h | 4 - js/src/jit/VMFunctions.cpp | 6 +- js/src/js-config.h.in | 4 - js/src/jsapi-tests/testGCFinalizeCallback.cpp | 30 -- js/src/jsapi-tests/testGCHeapPostBarriers.cpp | 4 - js/src/jsapi-tests/testGCMarking.cpp | 25 -- js/src/jsapi-tests/testGCUniqueId.cpp | 4 - js/src/jsapi-tests/tests.h | 35 -- js/src/jsapi.cpp | 20 - js/src/jsgc.cpp | 595 +------------------------- js/src/jsgc.h | 15 - js/src/jspubtd.h | 2 +- js/src/jsutil.h | 2 +- js/src/old-configure.in | 11 - js/src/shell/js.cpp | 27 -- js/src/vm/EnvironmentObject.h | 3 - js/xpconnect/src/XPCComponents.cpp | 3 - js/xpconnect/src/XPCJSContext.cpp | 10 - js/xpconnect/src/XPCShellImpl.cpp | 18 - 20 files changed, 4 insertions(+), 832 deletions(-) diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index a6979ccae..455a14610 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -231,21 +231,6 @@ GC(JSContext *cx, return true; } -#ifdef JS_GC_ZEAL -static bool -GCZeal(JSContext *cx, unsigned argc, JS::Value *vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - - uint32_t zeal; - if (!ToUint32(cx, args.get(0), &zeal)) - return false; - - JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ); - return true; -} -#endif - const JSFunctionSpec gGlobalFunctions[] = { JS_FS("print", Print, 0,0), @@ -255,9 +240,6 @@ const JSFunctionSpec gGlobalFunctions[] = JS_FS("dumpXPC", DumpXPC, 1,0), JS_FS("dump", Dump, 1,0), JS_FS("gc", GC, 0,0), - #ifdef JS_GC_ZEAL - JS_FS("gczeal", GCZeal, 1,0), - #endif JS_FS_END }; diff --git a/js/src/jit/CompileWrappers.h b/js/src/jit/CompileWrappers.h index bbec9ffa3..ccded4f13 100644 --- a/js/src/jit/CompileWrappers.h +++ b/js/src/jit/CompileWrappers.h @@ -51,10 +51,6 @@ class CompileRuntime // &runtime()->activation_ const void* addressOfActivation(); -#ifdef JS_GC_ZEAL - const void* addressOfGCZealModeBits(); -#endif - const void* addressOfInterruptUint32(); // We have to bake JSContext* into JIT code, but this pointer shouldn't be diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index 628b31fae..a299d27a5 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -627,11 +627,7 @@ PostWriteElementBarrier(JSRuntime* rt, JSObject* obj, int32_t index) if (obj->is() && !obj->as().isInWholeCellBuffer() && uint32_t(index) < obj->as().getDenseInitializedLength() && - (obj->as().getDenseInitializedLength() > MAX_WHOLE_CELL_BUFFER_SIZE -#ifdef JS_GC_ZEAL - || rt->hasZealMode(gc::ZealMode::ElementsBarrier) -#endif - )) + (obj->as().getDenseInitializedLength() > MAX_WHOLE_CELL_BUFFER_SIZE)) { rt->gc.storeBuffer.putSlot(&obj->as(), HeapSlot::Element, index, 1); return; diff --git a/js/src/js-config.h.in b/js/src/js-config.h.in index f2ce93e12..779446fd7 100644 --- a/js/src/js-config.h.in +++ b/js/src/js-config.h.in @@ -38,10 +38,6 @@ /* Define to 1 if SpiderMonkey should include ctypes support. */ #undef JS_HAS_CTYPES -/* Define to 1 if SpiderMonkey should support the ability to perform - entirely too much GC. */ -#undef JS_GC_ZEAL - /* Define to 1 if SpiderMonkey should use small chunks. */ #undef JS_GC_SMALL_CHUNK_SIZE diff --git a/js/src/jsapi-tests/testGCFinalizeCallback.cpp b/js/src/jsapi-tests/testGCFinalizeCallback.cpp index 48003ab0c..a8f7ba7f8 100644 --- a/js/src/jsapi-tests/testGCFinalizeCallback.cpp +++ b/js/src/jsapi-tests/testGCFinalizeCallback.cpp @@ -94,36 +94,6 @@ BEGIN_TEST(testGCFinalizeCallback) CHECK(checkFinalizeStatus()); CHECK(checkFinalizeIsZoneGC(true)); -#ifdef JS_GC_ZEAL - - /* Full GC with reset due to new zone, becoming zone GC. */ - - FinalizeCalls = 0; - JS_SetGCZeal(cx, 9, 1000000); - JS::PrepareForFullGC(cx); - js::SliceBudget budget(js::WorkBudget(1)); - cx->gc.startDebugGC(GC_NORMAL, budget); - CHECK(cx->gc.state() == js::gc::State::Mark); - CHECK(cx->gc.isFullGc()); - - JS::RootedObject global4(cx, createTestGlobal()); - budget = js::SliceBudget(js::WorkBudget(1)); - cx->gc.debugGCSlice(budget); - while (cx->gc.isIncrementalGCInProgress()) - cx->gc.debugGCSlice(budget); - CHECK(!cx->gc.isIncrementalGCInProgress()); - CHECK(!cx->gc.isFullGc()); - CHECK(checkMultipleGroups()); - CHECK(checkFinalizeStatus()); - - for (unsigned i = 0; i < FinalizeCalls - 1; ++i) - CHECK(!IsZoneGCBuffer[i]); - CHECK(IsZoneGCBuffer[FinalizeCalls - 1]); - - JS_SetGCZeal(cx, 0, 0); - -#endif - /* * Make some use of the globals here to ensure the compiler doesn't optimize * them away in release builds, causing the zones to be collected and diff --git a/js/src/jsapi-tests/testGCHeapPostBarriers.cpp b/js/src/jsapi-tests/testGCHeapPostBarriers.cpp index 74512a53f..00d47f111 100644 --- a/js/src/jsapi-tests/testGCHeapPostBarriers.cpp +++ b/js/src/jsapi-tests/testGCHeapPostBarriers.cpp @@ -40,10 +40,6 @@ JSFunction* CreateGCThing(JSContext* cx) BEGIN_TEST(testGCHeapPostBarriers) { -#ifdef JS_GC_ZEAL - AutoLeaveZeal nozeal(cx); -#endif /* JS_GC_ZEAL */ - /* Sanity check - objects start in the nursery and then become tenured. */ JS_GC(cx); JS::RootedObject obj(cx, CreateGCThing(cx)); diff --git a/js/src/jsapi-tests/testGCMarking.cpp b/js/src/jsapi-tests/testGCMarking.cpp index 684397392..b475c2d69 100644 --- a/js/src/jsapi-tests/testGCMarking.cpp +++ b/js/src/jsapi-tests/testGCMarking.cpp @@ -101,10 +101,6 @@ class CCWTestTracer : public JS::CallbackTracer { BEGIN_TEST(testTracingIncomingCCWs) { -#ifdef JS_GC_ZEAL - // Disable zeal modes because this test needs to control exactly when the GC happens. - JS_SetGCZeal(cx, 0, 100); -#endif JS_GC(cx); JS::RootedObject global1(cx, JS::CurrentGlobalOrNull(cx)); @@ -146,10 +142,6 @@ countWrappers(JSCompartment* comp) BEGIN_TEST(testDeadNurseryCCW) { -#ifdef JS_GC_ZEAL - // Disable zeal modes because this test needs to control exactly when the GC happens. - JS_SetGCZeal(cx, 0, 100); -#endif JS_GC(cx); JS::RootedObject global1(cx, JS::CurrentGlobalOrNull(cx)); @@ -177,10 +169,6 @@ END_TEST(testDeadNurseryCCW) BEGIN_TEST(testLiveNurseryCCW) { -#ifdef JS_GC_ZEAL - // Disable zeal modes because this test needs to control exactly when the GC happens. - JS_SetGCZeal(cx, 0, 100); -#endif JS_GC(cx); JS::RootedObject global1(cx, JS::CurrentGlobalOrNull(cx)); @@ -208,10 +196,6 @@ END_TEST(testLiveNurseryCCW) BEGIN_TEST(testLiveNurseryWrapperCCW) { -#ifdef JS_GC_ZEAL - // Disable zeal modes because this test needs to control exactly when the GC happens. - JS_SetGCZeal(cx, 0, 100); -#endif JS_GC(cx); JS::RootedObject global1(cx, JS::CurrentGlobalOrNull(cx)); @@ -244,10 +228,6 @@ END_TEST(testLiveNurseryWrapperCCW) BEGIN_TEST(testLiveNurseryWrappeeCCW) { -#ifdef JS_GC_ZEAL - // Disable zeal modes because this test needs to control exactly when the GC happens. - JS_SetGCZeal(cx, 0, 100); -#endif JS_GC(cx); JS::RootedObject global1(cx, JS::CurrentGlobalOrNull(cx)); @@ -280,11 +260,6 @@ BEGIN_TEST(testIncrementalRoots) { JSRuntime* rt = cx->runtime(); -#ifdef JS_GC_ZEAL - // Disable zeal modes because this test needs to control exactly when the GC happens. - JS_SetGCZeal(cx, 0, 100); -#endif - // Construct a big object graph to mark. In JS, the resulting object graph // is equivalent to: // diff --git a/js/src/jsapi-tests/testGCUniqueId.cpp b/js/src/jsapi-tests/testGCUniqueId.cpp index 71d66b722..d03d51b04 100644 --- a/js/src/jsapi-tests/testGCUniqueId.cpp +++ b/js/src/jsapi-tests/testGCUniqueId.cpp @@ -23,10 +23,6 @@ MinimizeHeap(JSContext* cx) BEGIN_TEST(testGCUID) { -#ifdef JS_GC_ZEAL - AutoLeaveZeal nozeal(cx); -#endif /* JS_GC_ZEAL */ - uint64_t uid = 0; uint64_t tmp = 0; diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 9955621ef..7f7309c16 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -418,39 +418,4 @@ class TestJSPrincipals : public JSPrincipals } }; -#ifdef JS_GC_ZEAL -/* - * Temporarily disable the GC zeal setting. This is only useful in tests that - * need very explicit GC behavior and should not be used elsewhere. - */ -class AutoLeaveZeal -{ - JSContext* cx_; - uint32_t zealBits_; - uint32_t frequency_; - - public: - explicit AutoLeaveZeal(JSContext* cx) : cx_(cx) { - uint32_t dummy; - JS_GetGCZealBits(cx_, &zealBits_, &frequency_, &dummy); - JS_SetGCZeal(cx_, 0, 0); - JS::PrepareForFullGC(cx_); - JS::GCForReason(cx_, GC_SHRINK, JS::gcreason::DEBUG_GC); - } - ~AutoLeaveZeal() { - for (size_t i = 0; i < sizeof(zealBits_) * 8; i++) { - if (zealBits_ & (1 << i)) - JS_SetGCZeal(cx_, i, frequency_); - } - -#ifdef DEBUG - uint32_t zealBitsAfter, frequencyAfter, dummy; - JS_GetGCZealBits(cx_, &zealBitsAfter, &frequencyAfter, &dummy); - MOZ_ASSERT(zealBitsAfter == zealBits_); - MOZ_ASSERT(frequencyAfter == frequency_); -#endif - } -}; -#endif /* JS_GC_ZEAL */ - #endif /* jsapi_tests_tests_h */ diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index e4e86effa..ee9c61059 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -6263,26 +6263,6 @@ JS_AbortIfWrongThread(JSContext* cx) MOZ_CRASH(); } -#ifdef JS_GC_ZEAL -JS_PUBLIC_API(void) -JS_GetGCZealBits(JSContext* cx, uint32_t* zealBits, uint32_t* frequency, uint32_t* nextScheduled) -{ - cx->runtime()->gc.getZealBits(zealBits, frequency, nextScheduled); -} - -JS_PUBLIC_API(void) -JS_SetGCZeal(JSContext* cx, uint8_t zeal, uint32_t frequency) -{ - cx->gc.setZeal(zeal, frequency); -} - -JS_PUBLIC_API(void) -JS_ScheduleGC(JSContext* cx, uint32_t count) -{ - cx->runtime()->gc.setNextScheduled(count); -} -#endif - JS_PUBLIC_API(void) JS_SetParallelParsingEnabled(JSContext* cx, bool enabled) { diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 42d10283c..4fa51417f 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -844,9 +844,6 @@ GCRuntime::GCRuntime(JSRuntime* rt) : arenasAllocatedDuringSweep(nullptr), startedCompacting(false), relocatedArenasToRelease(nullptr), -#ifdef JS_GC_ZEAL - markingValidator(nullptr), -#endif interFrameGC(false), defaultTimeBudget_(SliceBudget::UnlimitedTimeBudget), incrementalAllowed(true), @@ -856,13 +853,6 @@ GCRuntime::GCRuntime(JSRuntime* rt) : manipulatingDeadZones(false), objectsMarkedInDeadZones(0), poked(false), -#ifdef JS_GC_ZEAL - zealModeBits(0), - zealFrequency(0), - nextScheduled(0), - deterministicOnly(false), - incrementalLimit(0), -#endif fullCompartmentChecks(false), mallocBytesUntilGC(0), mallocGCTriggered(false), @@ -881,147 +871,6 @@ GCRuntime::GCRuntime(JSRuntime* rt) : setGCMode(JSGC_MODE_GLOBAL); } -#ifdef JS_GC_ZEAL - -void -GCRuntime::getZealBits(uint32_t* zealBits, uint32_t* frequency, uint32_t* scheduled) -{ - *zealBits = zealModeBits; - *frequency = zealFrequency; - *scheduled = nextScheduled; -} - -const char* gc::ZealModeHelpText = - " Specifies how zealous the garbage collector should be. Some of these modes can\n" - " be set simultaneously, by passing multiple level options, e.g. \"2;4\" will activate\n" - " both modes 2 and 4. Modes can be specified by name or number.\n" - " \n" - " Values:\n" - " 0: (None) Normal amount of collection (resets all modes)\n" - " 1: (Poke) Collect when roots are added or removed\n" - " 2: (Alloc) Collect when every N allocations (default: 100)\n" - " 3: (FrameGC) Collect when the window paints (browser only)\n" - " 4: (VerifierPre) Verify pre write barriers between instructions\n" - " 5: (FrameVerifierPre) Verify pre write barriers between paints\n" - " 6: (StackRooting) Verify stack rooting\n" - " 7: (GenerationalGC) Collect the nursery every N nursery allocations\n" - " 8: (IncrementalRootsThenFinish) Incremental GC in two slices: 1) mark roots 2) finish collection\n" - " 9: (IncrementalMarkAllThenFinish) Incremental GC in two slices: 1) mark all 2) new marking and finish\n" - " 10: (IncrementalMultipleSlices) Incremental GC in multiple slices\n" - " 11: (IncrementalMarkingValidator) Verify incremental marking\n" - " 12: (ElementsBarrier) Always use the individual element post-write barrier, regardless of elements size\n" - " 13: (CheckHashTablesOnMinorGC) Check internal hashtables on minor GC\n" - " 14: (Compact) Perform a shrinking collection every N allocations\n" - " 15: (CheckHeapAfterGC) Walk the heap to check its integrity after every GC\n" - " 16: (CheckNursery) Check nursery integrity on minor GC\n"; - -void -GCRuntime::setZeal(uint8_t zeal, uint32_t frequency) -{ - MOZ_ASSERT(zeal <= unsigned(ZealMode::Limit)); - - if (verifyPreData) - VerifyBarriers(rt, PreBarrierVerifier); - - if (zeal == 0 && hasZealMode(ZealMode::GenerationalGC)) { - evictNursery(JS::gcreason::DEBUG_GC); - nursery.leaveZealMode(); - } - - ZealMode zealMode = ZealMode(zeal); - if (zealMode == ZealMode::GenerationalGC) - nursery.enterZealMode(); - - // Zeal modes 8-10 are mutually exclusive. If we're setting one of those, - // we first reset all of them. - if (zealMode >= ZealMode::IncrementalRootsThenFinish && - zealMode <= ZealMode::IncrementalMultipleSlices) - { - clearZealMode(ZealMode::IncrementalRootsThenFinish); - clearZealMode(ZealMode::IncrementalMarkAllThenFinish); - clearZealMode(ZealMode::IncrementalMultipleSlices); - } - - bool schedule = zealMode >= ZealMode::Alloc; - if (zeal != 0) - zealModeBits |= 1 << unsigned(zeal); - else - zealModeBits = 0; - zealFrequency = frequency; - nextScheduled = schedule ? frequency : 0; -} - -void -GCRuntime::setNextScheduled(uint32_t count) -{ - nextScheduled = count; -} - -bool -GCRuntime::parseAndSetZeal(const char* str) -{ - int frequency = -1; - bool foundFrequency = false; - mozilla::Vector zeals; - - static const struct { - const char* const zealMode; - size_t length; - uint32_t zeal; - } zealModes[] = { -#define ZEAL_MODE(name, value) {#name, sizeof(#name) - 1, value}, - JS_FOR_EACH_ZEAL_MODE(ZEAL_MODE) -#undef ZEAL_MODE - {"None", 4, 0} - }; - - do { - int zeal = -1; - - const char* p = nullptr; - if (isdigit(str[0])) { - zeal = atoi(str); - - size_t offset = strspn(str, "0123456789"); - p = str + offset; - } else { - for (auto z : zealModes) { - if (!strncmp(str, z.zealMode, z.length)) { - zeal = z.zeal; - p = str + z.length; - break; - } - } - } - if (p) { - if (!*p || *p == ';') { - frequency = JS_DEFAULT_ZEAL_FREQ; - } else if (*p == ',') { - frequency = atoi(p + 1); - foundFrequency = true; - } - } - - if (zeal < 0 || zeal > int(ZealMode::Limit) || frequency <= 0) { - fprintf(stderr, "Format: JS_GC_ZEAL=level(;level)*[,N]\n"); - fputs(ZealModeHelpText, stderr); - return false; - } - - if (!zeals.emplaceBack(zeal)) { - return false; - } - } while (!foundFrequency && - (str = strchr(str, ';')) != nullptr && - str++); - - for (auto z : zeals) - setZeal(z, frequency); - return true; -} - -#endif - /* * Lifetime in number of major GCs for type sets attached to scripts containing * observed types. @@ -1063,12 +912,6 @@ GCRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes) } } -#ifdef JS_GC_ZEAL - const char* zealSpec = getenv("JS_GC_ZEAL"); - if (zealSpec && zealSpec[0] && !parseAndSetZeal(zealSpec)) - return false; -#endif - if (!InitTrace(*this)) return false; @@ -1094,11 +937,6 @@ GCRuntime::finish() allocTask.cancel(GCParallelTask::CancelAndWait); decommitTask.cancel(GCParallelTask::CancelAndWait); -#ifdef JS_GC_ZEAL - /* Free memory associated with GC verification. */ - finishVerifier(); -#endif - /* Delete all remaining zones. */ if (rt->gcInitialized) { AutoSetThreadIsSweeping threadIsSweeping; @@ -2635,7 +2473,7 @@ GCRuntime::releaseRelocatedArenasWithoutUnlocking(Arena* arenaList, const AutoLo // Mark arena as empty arena->setAsFullyUnused(); -#if defined(JS_CRASH_DIAGNOSTICS) || defined(JS_GC_ZEAL) +#if defined(JS_CRASH_DIAGNOSTICS) JS_POISON(reinterpret_cast(arena->thingsStart()), JS_MOVED_TENURED_PATTERN, arena->getThingsSpan()); #endif @@ -3048,13 +2886,6 @@ GCRuntime::triggerZoneGC(Zone* zone, JS::gcreason::Reason reason) if (rt->isHeapCollecting()) return false; -#ifdef JS_GC_ZEAL - if (hasZealMode(ZealMode::Alloc)) { - MOZ_RELEASE_ASSERT(triggerGC(reason)); - return true; - } -#endif - if (zone->isAtomsZone()) { /* We can't do a zone GC of the atoms compartment. */ if (rt->keepAtoms()) { @@ -3077,14 +2908,6 @@ GCRuntime::maybeGC(Zone* zone) { MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); -#ifdef JS_GC_ZEAL - if (hasZealMode(ZealMode::Alloc) || hasZealMode(ZealMode::Poke)) { - JS::PrepareForFullGC(rt->contextFromMainThread()); - gc(GC_NORMAL, JS::gcreason::DEBUG_GC); - return; - } -#endif - if (gcIfRequested()) return; @@ -3418,11 +3241,6 @@ GCRuntime::shouldReleaseObservedTypes() { bool releaseTypes = false; -#ifdef JS_GC_ZEAL - if (zealModeBits != 0) - releaseTypes = true; -#endif - /* We may miss the exact target GC due to resets. */ if (majorGCNumber >= jitReleaseNumber) releaseTypes = true; @@ -4068,290 +3886,19 @@ GCRuntime::markAllGrayReferences(gcstats::Phase phase) markGrayReferences(phase); } -#ifdef JS_GC_ZEAL - -struct GCChunkHasher { - typedef gc::Chunk* Lookup; - - /* - * Strip zeros for better distribution after multiplying by the golden - * ratio. - */ - static HashNumber hash(gc::Chunk* chunk) { - MOZ_ASSERT(!(uintptr_t(chunk) & gc::ChunkMask)); - return HashNumber(uintptr_t(chunk) >> gc::ChunkShift); - } - - static bool match(gc::Chunk* k, gc::Chunk* l) { - MOZ_ASSERT(!(uintptr_t(k) & gc::ChunkMask)); - MOZ_ASSERT(!(uintptr_t(l) & gc::ChunkMask)); - return k == l; - } -}; - -class js::gc::MarkingValidator -{ - public: - explicit MarkingValidator(GCRuntime* gc); - ~MarkingValidator(); - void nonIncrementalMark(AutoLockForExclusiveAccess& lock); - void validate(); - - private: - GCRuntime* gc; - bool initialized; - - typedef HashMap BitmapMap; - BitmapMap map; -}; - -js::gc::MarkingValidator::MarkingValidator(GCRuntime* gc) - : gc(gc), - initialized(false) -{} - -js::gc::MarkingValidator::~MarkingValidator() -{ - if (!map.initialized()) - return; - - for (BitmapMap::Range r(map.all()); !r.empty(); r.popFront()) - js_delete(r.front().value()); -} - -void -js::gc::MarkingValidator::nonIncrementalMark(AutoLockForExclusiveAccess& lock) -{ - /* - * Perform a non-incremental mark for all collecting zones and record - * the results for later comparison. - * - * Currently this does not validate gray marking. - */ - - if (!map.init()) - return; - - JSRuntime* runtime = gc->rt; - GCMarker* gcmarker = &gc->marker; - - gc->waitBackgroundSweepEnd(); - - /* Save existing mark bits. */ - for (auto chunk = gc->allNonEmptyChunks(); !chunk.done(); chunk.next()) { - ChunkBitmap* bitmap = &chunk->bitmap; - ChunkBitmap* entry = js_new(); - if (!entry) - return; - - memcpy((void*)entry->bitmap, (void*)bitmap->bitmap, sizeof(bitmap->bitmap)); - if (!map.putNew(chunk, entry)) - return; - } - - /* - * Temporarily clear the weakmaps' mark flags for the compartments we are - * collecting. - */ - - WeakMapSet markedWeakMaps; - if (!markedWeakMaps.init()) - return; - - /* - * For saving, smush all of the keys into one big table and split them back - * up into per-zone tables when restoring. - */ - gc::WeakKeyTable savedWeakKeys(SystemAllocPolicy(), runtime->randomHashCodeScrambler()); - if (!savedWeakKeys.init()) - return; - - for (GCZonesIter zone(runtime); !zone.done(); zone.next()) { - if (!WeakMapBase::saveZoneMarkedWeakMaps(zone, markedWeakMaps)) - return; - - AutoEnterOOMUnsafeRegion oomUnsafe; - for (gc::WeakKeyTable::Range r = zone->gcWeakKeys.all(); !r.empty(); r.popFront()) { - if (!savedWeakKeys.put(Move(r.front().key), Move(r.front().value))) - oomUnsafe.crash("saving weak keys table for validator"); - } - - if (!zone->gcWeakKeys.clear()) - oomUnsafe.crash("clearing weak keys table for validator"); - } - - /* - * After this point, the function should run to completion, so we shouldn't - * do anything fallible. - */ - initialized = true; - - /* Re-do all the marking, but non-incrementally. */ - js::gc::State state = gc->incrementalState; - gc->incrementalState = State::MarkRoots; - - { - gcstats::AutoPhase ap(gc->stats, gcstats::PHASE_MARK); - - { - gcstats::AutoPhase ap(gc->stats, gcstats::PHASE_UNMARK); - - for (GCZonesIter zone(runtime); !zone.done(); zone.next()) - WeakMapBase::unmarkZone(zone); - - MOZ_ASSERT(gcmarker->isDrained()); - gcmarker->reset(); - - for (auto chunk = gc->allNonEmptyChunks(); !chunk.done(); chunk.next()) - chunk->bitmap.clear(); - } - - gc->traceRuntimeForMajorGC(gcmarker, lock); - - gc->incrementalState = State::Mark; - auto unlimited = SliceBudget::unlimited(); - MOZ_RELEASE_ASSERT(gc->marker.drainMarkStack(unlimited)); - } - - gc->incrementalState = State::Sweep; - { - gcstats::AutoPhase ap1(gc->stats, gcstats::PHASE_SWEEP); - gcstats::AutoPhase ap2(gc->stats, gcstats::PHASE_SWEEP_MARK); - - gc->markAllWeakReferences(gcstats::PHASE_SWEEP_MARK_WEAK); - - /* Update zone state for gray marking. */ - for (GCZonesIter zone(runtime); !zone.done(); zone.next()) { - MOZ_ASSERT(zone->isGCMarkingBlack()); - zone->setGCState(Zone::MarkGray); - } - gc->marker.setMarkColorGray(); - - gc->markAllGrayReferences(gcstats::PHASE_SWEEP_MARK_GRAY); - gc->markAllWeakReferences(gcstats::PHASE_SWEEP_MARK_GRAY_WEAK); - - /* Restore zone state. */ - for (GCZonesIter zone(runtime); !zone.done(); zone.next()) { - MOZ_ASSERT(zone->isGCMarkingGray()); - zone->setGCState(Zone::Mark); - } - MOZ_ASSERT(gc->marker.isDrained()); - gc->marker.setMarkColorBlack(); - } - - /* Take a copy of the non-incremental mark state and restore the original. */ - for (auto chunk = gc->allNonEmptyChunks(); !chunk.done(); chunk.next()) { - ChunkBitmap* bitmap = &chunk->bitmap; - ChunkBitmap* entry = map.lookup(chunk)->value(); - Swap(*entry, *bitmap); - } - - for (GCZonesIter zone(runtime); !zone.done(); zone.next()) { - WeakMapBase::unmarkZone(zone); - AutoEnterOOMUnsafeRegion oomUnsafe; - if (!zone->gcWeakKeys.clear()) - oomUnsafe.crash("clearing weak keys table for validator"); - } - - WeakMapBase::restoreMarkedWeakMaps(markedWeakMaps); - - for (gc::WeakKeyTable::Range r = savedWeakKeys.all(); !r.empty(); r.popFront()) { - AutoEnterOOMUnsafeRegion oomUnsafe; - Zone* zone = gc::TenuredCell::fromPointer(r.front().key.asCell())->zone(); - if (!zone->gcWeakKeys.put(Move(r.front().key), Move(r.front().value))) - oomUnsafe.crash("restoring weak keys table for validator"); - } - - gc->incrementalState = state; -} - -void -js::gc::MarkingValidator::validate() -{ - /* - * Validates the incremental marking for a single compartment by comparing - * the mark bits to those previously recorded for a non-incremental mark. - */ - - if (!initialized) - return; - - gc->waitBackgroundSweepEnd(); - - for (auto chunk = gc->allNonEmptyChunks(); !chunk.done(); chunk.next()) { - BitmapMap::Ptr ptr = map.lookup(chunk); - if (!ptr) - continue; /* Allocated after we did the non-incremental mark. */ - - ChunkBitmap* bitmap = ptr->value(); - ChunkBitmap* incBitmap = &chunk->bitmap; - - for (size_t i = 0; i < ArenasPerChunk; i++) { - if (chunk->decommittedArenas.get(i)) - continue; - Arena* arena = &chunk->arenas[i]; - if (!arena->allocated()) - continue; - if (!arena->zone->isGCSweeping()) - continue; - if (arena->allocatedDuringIncremental) - continue; - - AllocKind kind = arena->getAllocKind(); - uintptr_t thing = arena->thingsStart(); - uintptr_t end = arena->thingsEnd(); - while (thing < end) { - Cell* cell = (Cell*)thing; - - /* - * If a non-incremental GC wouldn't have collected a cell, then - * an incremental GC won't collect it. - */ - MOZ_ASSERT_IF(bitmap->isMarked(cell, BLACK), incBitmap->isMarked(cell, BLACK)); - - /* - * If the cycle collector isn't allowed to collect an object - * after a non-incremental GC has run, then it isn't allowed to - * collected it after an incremental GC. - */ - MOZ_ASSERT_IF(!bitmap->isMarked(cell, GRAY), !incBitmap->isMarked(cell, GRAY)); - - thing += Arena::thingSize(kind); - } - } - } -} - -#endif // JS_GC_ZEAL - void GCRuntime::computeNonIncrementalMarkingForValidation(AutoLockForExclusiveAccess& lock) { -#ifdef JS_GC_ZEAL - MOZ_ASSERT(!markingValidator); - if (isIncremental && hasZealMode(ZealMode::IncrementalMarkingValidator)) - markingValidator = js_new(this); - if (markingValidator) - markingValidator->nonIncrementalMark(lock); -#endif } void GCRuntime::validateIncrementalMarking() { -#ifdef JS_GC_ZEAL - if (markingValidator) - markingValidator->validate(); -#endif } void GCRuntime::finishMarkingValidation() { -#ifdef JS_GC_ZEAL - js_delete(markingValidator); - markingValidator = nullptr; -#endif } static void @@ -5785,11 +5332,6 @@ AutoGCSlice::~AutoGCSlice() void GCRuntime::pushZealSelectedObjects() { -#ifdef JS_GC_ZEAL - /* Push selected objects onto the mark stack and clear the list. */ - for (JSObject** obj = selectedForMarking.begin(); obj != selectedForMarking.end(); obj++) - TraceManuallyBarrieredEdge(&marker, obj, "selected obj"); -#endif } static bool @@ -5818,16 +5360,6 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea gc::State initialState = incrementalState; bool useZeal = false; -#ifdef JS_GC_ZEAL - if (reason == JS::gcreason::DEBUG_GC && !budget.isUnlimited()) { - /* - * Do the incremental collection type specified by zeal mode if the - * collection was triggered by runDebugGC() and incremental GC has not - * been cancelled by resetIncrementalGC(). - */ - useZeal = true; - } -#endif MOZ_ASSERT_IF(isIncrementalGCInProgress(), isIncremental); isIncremental = !budget.isUnlimited(); @@ -6202,11 +5734,6 @@ GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason:: chunkAllocationSinceLastGC = false; -#ifdef JS_GC_ZEAL - /* Keeping these around after a GC is dangerous. */ - clearSelectedForMarking(); -#endif - /* Clear gcMallocBytes for all zones. */ for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) zone->resetGCMallocBytes(); @@ -6218,23 +5745,6 @@ GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason:: return false; } -#ifdef JS_GC_ZEAL -static bool -IsDeterministicGCReason(JS::gcreason::Reason reason) -{ - if (reason > JS::gcreason::DEBUG_GC && - reason != JS::gcreason::CC_FORCED && reason != JS::gcreason::SHUTDOWN_CC) - { - return false; - } - - if (reason == JS::gcreason::EAGER_ALLOC_TRIGGER) - return false; - - return true; -} -#endif - gcstats::ZoneGCStats GCRuntime::scanZonesBeforeGC() { @@ -6300,11 +5810,6 @@ GCRuntime::checkIfGCAllowedInCurrentState(JS::gcreason::Reason reason) if (rt->isBeingDestroyed() && !IsShutdownGC(reason)) return false; -#ifdef JS_GC_ZEAL - if (deterministicOnly && !IsDeterministicGCReason(reason)) - return false; -#endif - return true; } @@ -6360,13 +5865,6 @@ GCRuntime::collect(bool nonincrementalByAPI, SliceBudget budget, JS::gcreason::R if (reason == JS::gcreason::COMPARTMENT_REVIVED) maybeDoCycleCollection(); - -#ifdef JS_GC_ZEAL - if (rt->hasZealMode(ZealMode::CheckHeapAfterGC)) { - gcstats::AutoPhase ap(rt->gc.stats, gcstats::PHASE_TRACE_HEAP); - CheckHeapAfterGC(rt); - } -#endif } js::AutoEnqueuePendingParseTasksAfterGC::~AutoEnqueuePendingParseTasksAfterGC() @@ -6460,17 +5958,6 @@ GCRuntime::notifyDidPaint() { MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); -#ifdef JS_GC_ZEAL - if (hasZealMode(ZealMode::FrameVerifierPre)) - verifyPreBarriers(); - - if (hasZealMode(ZealMode::FrameGC)) { - JS::PrepareForFullGC(rt->contextFromMainThread()); - gc(GC_NORMAL, JS::gcreason::REFRESH_FRAME); - return; - } -#endif - if (isIncrementalGCInProgress() && !interFrameGC && tunables.areRefreshFrameSlicesEnabled()) { JS::PrepareForIncrementalGC(rt->contextFromMainThread()); gcSlice(JS::gcreason::REFRESH_FRAME); @@ -6566,11 +6053,6 @@ GCRuntime::minorGC(JS::gcreason::Reason reason, gcstats::Phase phase) blocksToFreeAfterMinorGC.freeAll(); -#ifdef JS_GC_ZEAL - if (rt->hasZealMode(ZealMode::CheckHeapAfterGC)) - CheckHeapAfterGC(rt); -#endif - { AutoLockGC lock(rt); for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) @@ -6756,59 +6238,6 @@ gc::MergeCompartments(JSCompartment* source, JSCompartment* target) void GCRuntime::runDebugGC() { -#ifdef JS_GC_ZEAL - if (rt->mainThread.suppressGC) - return; - - if (hasZealMode(ZealMode::GenerationalGC)) - return minorGC(JS::gcreason::DEBUG_GC); - - PrepareForDebugGC(rt); - - auto budget = SliceBudget::unlimited(); - if (hasZealMode(ZealMode::IncrementalRootsThenFinish) || - hasZealMode(ZealMode::IncrementalMarkAllThenFinish) || - hasZealMode(ZealMode::IncrementalMultipleSlices)) - { - js::gc::State initialState = incrementalState; - if (hasZealMode(ZealMode::IncrementalMultipleSlices)) { - /* - * Start with a small slice limit and double it every slice. This - * ensure that we get multiple slices, and collection runs to - * completion. - */ - if (!isIncrementalGCInProgress()) - incrementalLimit = zealFrequency / 2; - else - incrementalLimit *= 2; - budget = SliceBudget(WorkBudget(incrementalLimit)); - } else { - // This triggers incremental GC but is actually ignored by IncrementalMarkSlice. - budget = SliceBudget(WorkBudget(1)); - } - - if (!isIncrementalGCInProgress()) - invocationKind = GC_SHRINK; - collect(false, budget, JS::gcreason::DEBUG_GC); - - /* - * For multi-slice zeal, reset the slice size when we get to the sweep - * or compact phases. - */ - if (hasZealMode(ZealMode::IncrementalMultipleSlices)) { - if ((initialState == State::Mark && incrementalState == State::Sweep) || - (initialState == State::Sweep && incrementalState == State::Compact)) - { - incrementalLimit = zealFrequency / 2; - } - } - } else if (hasZealMode(ZealMode::Compact)) { - gc(GC_SHRINK, JS::gcreason::DEBUG_GC); - } else { - gc(GC_NORMAL, JS::gcreason::DEBUG_GC); - } - -#endif } void @@ -6818,28 +6247,6 @@ GCRuntime::setFullCompartmentChecks(bool enabled) fullCompartmentChecks = enabled; } -#ifdef JS_GC_ZEAL -bool -GCRuntime::selectForMarking(JSObject* object) -{ - MOZ_ASSERT(!rt->isHeapMajorCollecting()); - return selectedForMarking.append(object); -} - -void -GCRuntime::clearSelectedForMarking() -{ - selectedForMarking.clearAndFree(); -} - -void -GCRuntime::setDeterministic(bool enabled) -{ - MOZ_ASSERT(!rt->isHeapMajorCollecting()); - deterministicOnly = enabled; -} -#endif - #ifdef DEBUG /* Should only be called manually under gdb */ diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 79ac9596c..c0d86781d 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -1264,19 +1264,6 @@ enum VerifierType { PreBarrierVerifier }; -#ifdef JS_GC_ZEAL - -extern const char* ZealModeHelpText; - -/* Check that write barriers have been used correctly. See jsgc.cpp. */ -void -VerifyBarriers(JSRuntime* rt, VerifierType type); - -void -MaybeVerifyBarriers(JSContext* cx, bool always = false); - -#else - static inline void VerifyBarriers(JSRuntime* rt, VerifierType type) { @@ -1287,8 +1274,6 @@ MaybeVerifyBarriers(JSContext* cx, bool always = false) { } -#endif - /* * Instances of this class set the |JSRuntime::suppressGC| flag for the duration * that they are live. Use of this class is highly discouraged. Please carefully diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 309b9d746..20ea1ef8b 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -22,7 +22,7 @@ #include "js/TraceKind.h" #include "js/TypeDecls.h" -#if defined(JS_GC_ZEAL) || defined(DEBUG) +#if defined(DEBUG) # define JSGC_HASH_TABLE_CHECKS #endif diff --git a/js/src/jsutil.h b/js/src/jsutil.h index 790b97ddc..8ef4cac90 100644 --- a/js/src/jsutil.h +++ b/js/src/jsutil.h @@ -368,7 +368,7 @@ Poison(void* ptr, uint8_t value, size_t num) #endif /* Enable poisoning in crash-diagnostics and zeal builds. */ -#if defined(JS_CRASH_DIAGNOSTICS) || defined(JS_GC_ZEAL) +#if defined(JS_CRASH_DIAGNOSTICS) # define JS_POISON(p, val, size) Poison(p, val, size) #else # define JS_POISON(p, val, size) ((void) 0) diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 1c5c9e214..e4589b951 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -1805,17 +1805,6 @@ if test -n "$MOZ_DEBUG"; then AC_DEFINE(JS_DEBUG) fi -dnl ======================================================== -dnl Zealous JavaScript GC -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(gczeal, -[ --enable-gczeal Enable zealous GCing], - JS_GC_ZEAL=1, - JS_GC_ZEAL= ) -if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then - AC_DEFINE(JS_GC_ZEAL) -fi - dnl ======================================================== dnl Enable breakpoint for artificial OOMs dnl ======================================================== diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 00a4a503c..88d482a23 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -323,10 +323,6 @@ static bool enableNativeRegExp = false; static bool enableUnboxedArrays = false; static bool enableSharedMemory = SHARED_MEMORY_DEFAULT; static bool enableWasmAlwaysBaseline = false; -#ifdef JS_GC_ZEAL -static uint32_t gZealBits = 0; -static uint32_t gZealFrequency = 0; -#endif static bool printTiming = false; static const char* jsCacheDir = nullptr; static const char* jsCacheAsmJSPath = nullptr; @@ -7517,16 +7513,6 @@ SetContextOptions(JSContext* cx, const OptionParser& op) dumpEntrainedVariables = op.getBoolOption("dump-entrained-variables"); #endif -#ifdef JS_GC_ZEAL - const char* zealStr = op.getStringOption("gc-zeal"); - if (zealStr) { - if (!cx->gc.parseAndSetZeal(zealStr)) - return false; - uint32_t nextScheduled; - cx->gc.getZealBits(&gZealBits, &gZealFrequency, &nextScheduled); - } -#endif - return true; } @@ -7544,16 +7530,6 @@ SetWorkerContextOptions(JSContext* cx) cx->setOffthreadIonCompilationEnabled(offthreadCompilation); cx->profilingScripts = enableCodeCoverage || enableDisassemblyDumps; -#ifdef JS_GC_ZEAL - if (gZealBits && gZealFrequency) { -#define ZEAL_MODE(_, value) \ - if (gZealBits & (1 << value)) \ - cx->gc.setZeal(value, gZealFrequency); - JS_FOR_EACH_ZEAL_MODE(ZEAL_MODE) -#undef ZEAL_MODE - } -#endif - JS_SetNativeStackQuota(cx, gMaxStackSize); } @@ -7838,9 +7814,6 @@ main(int argc, char** argv, char** envp) "NUMBER of instructions.", -1) #endif || !op.addIntOption('\0', "nursery-size", "SIZE-MB", "Set the maximum nursery size in MB", 16) -#ifdef JS_GC_ZEAL - || !op.addStringOption('z', "gc-zeal", "LEVEL(;LEVEL)*[,N]", gc::ZealModeHelpText) -#endif || !op.addStringOption('\0', "module-load-path", "DIR", "Set directory to load modules from") ) { diff --git a/js/src/vm/EnvironmentObject.h b/js/src/vm/EnvironmentObject.h index 6bdaac89e..d457ca839 100644 --- a/js/src/vm/EnvironmentObject.h +++ b/js/src/vm/EnvironmentObject.h @@ -930,9 +930,6 @@ class DebugEnvironments void mark(JSTracer* trc); void sweep(JSRuntime* rt); void finish(); -#ifdef JS_GC_ZEAL - void checkHashTablesAfterMovingGC(JSRuntime* rt); -#endif // If a live frame has a synthesized entry in missingEnvs, make sure it's not // collected. diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index ca78234c9..02b0b4d14 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -3007,9 +3007,6 @@ GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Ion, ion, setIon) NS_IMETHODIMP nsXPCComponents_Utils::SetGCZeal(int32_t aValue, JSContext* cx) { -#ifdef JS_GC_ZEAL - JS_SetGCZeal(cx, uint8_t(aValue), JS_DEFAULT_ZEAL_FREQ); -#endif return NS_OK; } diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index 6981b525c..defd1b785 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -1473,16 +1473,6 @@ ReloadPrefsCallback(const char* pref, void* data) sExtraWarningsForSystemJS = Preferences::GetBool(JS_OPTIONS_DOT_STR "strict.debug"); #endif -#ifdef JS_GC_ZEAL - int32_t zeal = Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal", -1); - int32_t zeal_frequency = - Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal.frequency", - JS_DEFAULT_ZEAL_FREQ); - if (zeal >= 0) { - JS_SetGCZeal(cx, (uint8_t)zeal, zeal_frequency); - } -#endif // JS_GC_ZEAL - JS::ContextOptionsRef(cx).setBaseline(useBaseline) .setIon(useIon) .setAsmJS(useAsmJS) diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index d86b5c5d3..d9629bfed 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -440,21 +440,6 @@ GC(JSContext* cx, unsigned argc, Value* vp) return true; } -#ifdef JS_GC_ZEAL -static bool -GCZeal(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - uint32_t zeal; - if (!ToUint32(cx, args.get(0), &zeal)) - return false; - - JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ); - args.rval().setUndefined(); - return true; -} -#endif - static bool SendCommand(JSContext* cx, unsigned argc, Value* vp) { @@ -652,9 +637,6 @@ static const JSFunctionSpec glob_functions[] = { JS_FS("dumpXPC", DumpXPC, 1,0), JS_FS("dump", Dump, 1,0), JS_FS("gc", GC, 0,0), -#ifdef JS_GC_ZEAL - JS_FS("gczeal", GCZeal, 1,0), -#endif JS_FS("options", Options, 0,0), JS_FS("sendCommand", SendCommand, 1,0), JS_FS("atob", xpc::Atob, 1,0), -- cgit v1.2.3 From 0565262ff06f5d4d15aa712fb12337fbb26ec8b7 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 22:46:59 +0200 Subject: Remove "has-gczeal" property. --- js/src/builtin/TestingFunctions.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 92517df03..6765a05f3 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -188,10 +188,6 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) if (!JS_SetProperty(cx, info, "tsan", value)) return false; - value = BooleanValue(false); - if (!JS_SetProperty(cx, info, "has-gczeal", value)) - return false; - #ifdef JS_MORE_DETERMINISTIC value = BooleanValue(true); #else -- cgit v1.2.3 From 3ff383eaecedb3e86006704822a408daa20e3ccc Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 22:51:31 +0200 Subject: Remove isVerifyPreBarriersEnabled() stub and callers --- js/src/gc/GCRuntime.h | 2 -- js/src/gc/Nursery.cpp | 1 - js/src/jsgc.cpp | 2 +- js/src/vm/Runtime.cpp | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index d4bbe29db..5252903f3 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -838,8 +838,6 @@ class GCRuntime AutoMaybeStartBackgroundAllocation& maybeStartBGAlloc); void recycleChunk(Chunk* chunk, const AutoLockGC& lock); - bool isVerifyPreBarriersEnabled() const { return false; } - // Free certain LifoAlloc blocks when it is safe to do so. void freeUnusedLifoBlocksAfterSweeping(LifoAlloc* lifo); void freeAllLifoBlocksAfterSweeping(LifoAlloc* lifo); diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index d37c1673b..3a3860d6d 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -188,7 +188,6 @@ void js::Nursery::enable() { MOZ_ASSERT(isEmpty()); - MOZ_ASSERT(!runtime()->gc.isVerifyPreBarriersEnabled()); if (isEnabled()) return; diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 4fa51417f..52a8c9f71 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -6744,7 +6744,7 @@ JS::IsIncrementalGCEnabled(JSContext* cx) JS_PUBLIC_API(bool) JS::IsIncrementalGCInProgress(JSContext* cx) { - return cx->gc.isIncrementalGCInProgress() && !cx->gc.isVerifyPreBarriersEnabled(); + return cx->gc.isIncrementalGCInProgress(); } JS_PUBLIC_API(bool) diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 646d48299..0d6a3922c 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -868,8 +868,7 @@ bool JSRuntime::activeGCInAtomsZone() { Zone* zone = atomsCompartment_->zone(); - return (zone->needsIncrementalBarrier() && !gc.isVerifyPreBarriersEnabled()) || - zone->wasGCStarted(); + return zone->needsIncrementalBarrier() || zone->wasGCStarted(); } void -- cgit v1.2.3 From 6f342b2269e769a27dd0476cc4dc8a9c93c20235 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:08:26 +0200 Subject: Remove hasZealMode(mode) and callers --- js/src/gc/GCRuntime.h | 2 -- js/src/gc/Nursery.cpp | 7 ++----- js/src/gc/Zone.h | 6 +----- js/src/jsgc.cpp | 27 +-------------------------- js/src/vm/Runtime.h | 2 -- 5 files changed, 4 insertions(+), 40 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 5252903f3..a426d759b 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -600,7 +600,6 @@ class GCRuntime void finishRoots(); void finish(); - inline bool hasZealMode(ZealMode mode); inline void clearZealMode(ZealMode mode); inline bool upcomingZealousGC(); inline bool needZealousGC(); @@ -1355,7 +1354,6 @@ class MOZ_RAII AutoMaybeStartBackgroundAllocation } }; -inline bool GCRuntime::hasZealMode(ZealMode mode) { return false; } inline void GCRuntime::clearZealMode(ZealMode mode) { } inline bool GCRuntime::upcomingZealousGC() { return false; } inline bool GCRuntime::needZealousGC() { return false; } diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 3a3860d6d..72530b31b 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -219,11 +219,8 @@ js::Nursery::isEmpty() const MOZ_ASSERT(runtime_); if (!isEnabled()) return true; - - if (!runtime_->hasZealMode(ZealMode::GenerationalGC)) { - MOZ_ASSERT(currentStartChunk_ == 0); - MOZ_ASSERT(currentStartPosition_ == chunk(0).start()); - } + MOZ_ASSERT(currentStartChunk_ == 0); + MOZ_ASSERT(currentStartPosition_ == chunk(0).start()); return position() == currentStartPosition_; } diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index a3a6dc07f..84d6f03dd 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -253,11 +253,7 @@ struct Zone : public JS::shadow::Zone, // possibly at other times too. uint64_t gcNumber(); - bool compileBarriers() const { return compileBarriers(needsIncrementalBarrier()); } - bool compileBarriers(bool needsIncrementalBarrier) const { - return needsIncrementalBarrier || - runtimeFromMainThread()->hasZealMode(js::gc::ZealMode::VerifierPre); - } + bool compileBarriers() const { return needsIncrementalBarrier(); } enum ShouldUpdateJit { DontUpdateJit, UpdateJit }; void setNeedsIncrementalBarrier(bool needs, ShouldUpdateJit updateJit); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 52a8c9f71..039d8f2b0 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5359,21 +5359,9 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea gc::State initialState = incrementalState; - bool useZeal = false; - MOZ_ASSERT_IF(isIncrementalGCInProgress(), isIncremental); isIncremental = !budget.isUnlimited(); - if (useZeal && (hasZealMode(ZealMode::IncrementalRootsThenFinish) || - hasZealMode(ZealMode::IncrementalMarkAllThenFinish))) - { - /* - * Yields between slices occurs at predetermined points in these modes; - * the budget is not used. - */ - budget.makeUnlimited(); - } - switch (incrementalState) { case State::NotActive: initialReason = reason; @@ -5396,9 +5384,6 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea incrementalState = State::Mark; - if (isIncremental && useZeal && hasZealMode(ZealMode::IncrementalRootsThenFinish)) - break; - MOZ_FALLTHROUGH; case State::Mark: @@ -5427,10 +5412,7 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea * We will need to mark anything new on the stack when we resume, so * we stay in Mark state. */ - if (!lastMarkSlice && isIncremental && - ((initialState == State::Mark && - !(useZeal && hasZealMode(ZealMode::IncrementalRootsThenFinish))) || - (useZeal && hasZealMode(ZealMode::IncrementalMarkAllThenFinish)))) + if (!lastMarkSlice && isIncremental && initialState == State::Mark) { lastMarkSlice = true; break; @@ -5446,13 +5428,6 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea if (budget.isOverBudget()) break; - /* - * Always yield here when running in incremental multi-slice zeal - * mode, so RunDebugGC can reset the slice buget. - */ - if (isIncremental && useZeal && hasZealMode(ZealMode::IncrementalMultipleSlices)) - break; - MOZ_FALLTHROUGH; case State::Sweep: diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 4f7755b9d..734543c4e 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -866,8 +866,6 @@ struct JSRuntime : public JS::shadow::Runtime, /* Garbage collector state has been successfully initialized. */ bool gcInitialized; - bool hasZealMode(js::gc::ZealMode mode) { return gc.hasZealMode(mode); } - void lockGC() { gc.lockGC(); } -- cgit v1.2.3 From 7a59ec756adc8fc4d394b221abcba5757c030f6d Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:10:53 +0200 Subject: Remove clearZealMode(mode) --- js/src/gc/GCRuntime.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index a426d759b..2cad0b3b3 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -600,7 +600,6 @@ class GCRuntime void finishRoots(); void finish(); - inline void clearZealMode(ZealMode mode); inline bool upcomingZealousGC(); inline bool needZealousGC(); @@ -1354,7 +1353,6 @@ class MOZ_RAII AutoMaybeStartBackgroundAllocation } }; -inline void GCRuntime::clearZealMode(ZealMode mode) { } inline bool GCRuntime::upcomingZealousGC() { return false; } inline bool GCRuntime::needZealousGC() { return false; } -- cgit v1.2.3 From 95badd197469e377bbed2319b8c5ee1e9581fa12 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:13:01 +0200 Subject: Remove upcomingZealousGC() and caller --- js/src/gc/GCRuntime.h | 2 -- js/src/vm/Caches-inl.h | 3 --- 2 files changed, 5 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 2cad0b3b3..cc558c2db 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -600,7 +600,6 @@ class GCRuntime void finishRoots(); void finish(); - inline bool upcomingZealousGC(); inline bool needZealousGC(); MOZ_MUST_USE bool addRoot(Value* vp, const char* name); @@ -1353,7 +1352,6 @@ class MOZ_RAII AutoMaybeStartBackgroundAllocation } }; -inline bool GCRuntime::upcomingZealousGC() { return false; } inline bool GCRuntime::needZealousGC() { return false; } } /* namespace gc */ diff --git a/js/src/vm/Caches-inl.h b/js/src/vm/Caches-inl.h index 4eb8ecaa6..56e69a0d9 100644 --- a/js/src/vm/Caches-inl.h +++ b/js/src/vm/Caches-inl.h @@ -57,9 +57,6 @@ NewObjectCache::newObjectFromHit(JSContext* cx, EntryIndex entryIndex, gc::Initi if (group->shouldPreTenure()) heap = gc::TenuredHeap; - if (cx->runtime()->gc.upcomingZealousGC()) - return nullptr; - NativeObject* obj = static_cast(Allocate(cx, entry->kind, 0, heap, group->clasp())); if (!obj) -- cgit v1.2.3 From 548e31e1ed8512662d8c0676bd059766e884be8e Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:14:55 +0200 Subject: Remove needZealousGC() --- js/src/gc/GCRuntime.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index cc558c2db..0e6969055 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -600,8 +600,6 @@ class GCRuntime void finishRoots(); void finish(); - inline bool needZealousGC(); - MOZ_MUST_USE bool addRoot(Value* vp, const char* name); void removeRoot(Value* vp); void setMarkStackLimit(size_t limit, AutoLockGC& lock); @@ -1352,8 +1350,6 @@ class MOZ_RAII AutoMaybeStartBackgroundAllocation } }; -inline bool GCRuntime::needZealousGC() { return false; } - } /* namespace gc */ } /* namespace js */ -- cgit v1.2.3 From cec903c6b2fd64b076d4b3232ef8f6bf02eebead Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:20:27 +0200 Subject: Remove AutoStopVerifyingBarriers RAII stub struct no longer in use. --- js/src/gc/GCInternals.h | 5 ----- js/src/gc/Nursery.cpp | 1 - js/src/jsgc.cpp | 3 --- 3 files changed, 9 deletions(-) diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index 0d2bed0c1..4919b87a5 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -61,11 +61,6 @@ class MOZ_RAII AutoPrepareForTracing AbortReason IsIncrementalGCUnsafe(JSRuntime* rt); -struct MOZ_RAII AutoStopVerifyingBarriers -{ - AutoStopVerifyingBarriers(JSRuntime*, bool) {} -}; - #ifdef JSGC_HASH_TABLE_CHECKS void CheckHashTablesAfterMovingGC(JSRuntime* rt); void CheckHeapAfterGC(JSRuntime* rt); diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 72530b31b..bce2b74aa 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -596,7 +596,6 @@ js::Nursery::doCollection(JSRuntime* rt, JS::gcreason::Reason reason, { AutoTraceSession session(rt, JS::HeapState::MinorCollecting); AutoSetThreadIsPerformingGC performingGC; - AutoStopVerifyingBarriers av(rt, false); AutoDisableProxyCheck disableStrictProxyChecking(rt); mozilla::DebugOnly oomUnsafeRegion; diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 039d8f2b0..cf2981dbc 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -1153,7 +1153,6 @@ GCRuntime::setMarkStackLimit(size_t limit, AutoLockGC& lock) { MOZ_ASSERT(!rt->isHeapBusy()); AutoUnlockGC unlock(lock); - AutoStopVerifyingBarriers pauseVerification(rt, false); marker.setMaxCapacity(limit); } @@ -5799,7 +5798,6 @@ GCRuntime::collect(bool nonincrementalByAPI, SliceBudget budget, JS::gcreason::R return; AutoTraceLog logGC(TraceLoggerForMainThread(rt), TraceLogger_GC); - AutoStopVerifyingBarriers av(rt, IsShutdownGC(reason)); AutoEnqueuePendingParseTasksAfterGC aept(*this); AutoScheduleZonesForGC asz(rt); @@ -5915,7 +5913,6 @@ GCRuntime::abortGC() checkCanCallAPI(); MOZ_ASSERT(!rt->mainThread.suppressGC); - AutoStopVerifyingBarriers av(rt, false); AutoEnqueuePendingParseTasksAfterGC aept(*this); gcstats::AutoGCSlice agc(stats, scanZonesBeforeGC(), invocationKind, -- cgit v1.2.3 From 77a482feace5aed4a61245d5894994a50517aa40 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:40:37 +0200 Subject: Remove VerifyBarriers() and MaybeVerifyBarriers() stubs and callers. --- js/src/jit-test/tests/ion/bug730152.js | 4 ---- js/src/jit-test/tests/ion/bug732758.js | 1 - js/src/jit/VMFunctions.cpp | 4 ---- js/src/jsgc.h | 10 ---------- js/src/vm/Interpreter.cpp | 10 ---------- 5 files changed, 29 deletions(-) delete mode 100644 js/src/jit-test/tests/ion/bug730152.js diff --git a/js/src/jit-test/tests/ion/bug730152.js b/js/src/jit-test/tests/ion/bug730152.js deleted file mode 100644 index fe4ecfe14..000000000 --- a/js/src/jit-test/tests/ion/bug730152.js +++ /dev/null @@ -1,4 +0,0 @@ -if (typeof verifybarriers !== "undefined") { - for (var i = 0; i < 30; i++) {} - for (i in Function("gc(verifybarriers()); yield")()) {} -} diff --git a/js/src/jit-test/tests/ion/bug732758.js b/js/src/jit-test/tests/ion/bug732758.js index 91da521c7..8196c3e03 100644 --- a/js/src/jit-test/tests/ion/bug732758.js +++ b/js/src/jit-test/tests/ion/bug732758.js @@ -38,5 +38,4 @@ tryItOut("{t:g}"); tryItOut("r"); tryItOut("p"); tryItOut("gc()"); -tryItOut("verifybarriers()"); tryItOut("/**/yield"); diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index a299d27a5..4edbc3c83 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -135,7 +135,6 @@ CheckOverRecursed(JSContext* cx) #else JS_CHECK_RECURSION(cx, return false); #endif - gc::MaybeVerifyBarriers(cx); return cx->runtime()->handleInterrupt(cx); } @@ -180,7 +179,6 @@ CheckOverRecursedWithExtra(JSContext* cx, BaselineFrame* frame, JS_CHECK_RECURSION_WITH_SP(cx, checkSp, return false); #endif - gc::MaybeVerifyBarriers(cx); return cx->runtime()->handleInterrupt(cx); } @@ -465,8 +463,6 @@ SetProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, HandleValu bool InterruptCheck(JSContext* cx) { - gc::MaybeVerifyBarriers(cx); - { JSRuntime* rt = cx->runtime(); JitRuntime::AutoPreventBackedgePatching apbp(rt); diff --git a/js/src/jsgc.h b/js/src/jsgc.h index c0d86781d..7ad176d84 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -1264,16 +1264,6 @@ enum VerifierType { PreBarrierVerifier }; -static inline void -VerifyBarriers(JSRuntime* rt, VerifierType type) -{ -} - -static inline void -MaybeVerifyBarriers(JSContext* cx, bool always = false) -{ -} - /* * Instances of this class set the |JSRuntime::suppressGC| flag for the duration * that they are live. Use of this class is highly discouraged. Please carefully diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 3ca379d01..fbf526ae5 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -1647,7 +1647,6 @@ Interpret(JSContext* cx, RunState& state) #define ADVANCE_AND_DISPATCH(N) \ JS_BEGIN_MACRO \ REGS.pc += (N); \ - SANITY_CHECKS(); \ DISPATCH_TO(*REGS.pc | activation.opMask()); \ JS_END_MACRO @@ -1727,12 +1726,6 @@ Interpret(JSContext* cx, RunState& state) activation.enableInterruptsUnconditionally(); \ JS_END_MACRO -#define SANITY_CHECKS() \ - JS_BEGIN_MACRO \ - js::gc::MaybeVerifyBarriers(cx); \ - JS_END_MACRO - - gc::MaybeVerifyBarriers(cx, true); MOZ_ASSERT(!cx->zone()->types.activeAnalysis); InterpreterFrame* entryFrame = state.pushInterpreterFrame(cx); @@ -1863,7 +1856,6 @@ CASE(EnableInterruptsPseudoOpcode) activation.clearInterruptsMask(); /* Commence executing the actual opcode. */ - SANITY_CHECKS(); DISPATCH_TO(op); } @@ -4184,8 +4176,6 @@ DEFAULT() REGS.fp()->epilogue(cx, REGS.pc); } - gc::MaybeVerifyBarriers(cx, true); - TraceLogStopEvent(logger, TraceLogger_Engine); TraceLogStopEvent(logger, scriptEvent); -- cgit v1.2.3 From 93e6b657d10e5c74d0cc07cb59095cab8041be9c Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:43:05 +0200 Subject: Remove computeNonIncrementalMarkingForValidation(lock) and caller --- js/src/gc/GCRuntime.h | 1 - js/src/jsgc.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 0e6969055..b1b4ffcba 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -977,7 +977,6 @@ class GCRuntime void releaseRelocatedArenasWithoutUnlocking(Arena* arenaList, const AutoLockGC& lock); void finishCollection(JS::gcreason::Reason reason); - void computeNonIncrementalMarkingForValidation(AutoLockForExclusiveAccess& lock); void validateIncrementalMarking(); void finishMarkingValidation(); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index cf2981dbc..5082d0371 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -3885,11 +3885,6 @@ GCRuntime::markAllGrayReferences(gcstats::Phase phase) markGrayReferences(phase); } -void -GCRuntime::computeNonIncrementalMarkingForValidation(AutoLockForExclusiveAccess& lock) -{ -} - void GCRuntime::validateIncrementalMarking() { @@ -4761,8 +4756,6 @@ GCRuntime::beginSweepPhase(bool destroyingRuntime, AutoLockForExclusiveAccess& l releaseHeldRelocatedArenas(); - computeNonIncrementalMarkingForValidation(lock); - gcstats::AutoPhase ap(stats, gcstats::PHASE_SWEEP); sweepOnBackgroundThread = -- cgit v1.2.3 From da7e96fc7ae070e390eb05dae02e70f98d109d2c Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:45:04 +0200 Subject: Remove validateIncrementalMarking() and caller --- js/src/gc/GCRuntime.h | 1 - js/src/jsgc.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index b1b4ffcba..872e649fa 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -977,7 +977,6 @@ class GCRuntime void releaseRelocatedArenasWithoutUnlocking(Arena* arenaList, const AutoLockGC& lock); void finishCollection(JS::gcreason::Reason reason); - void validateIncrementalMarking(); void finishMarkingValidation(); #ifdef DEBUG diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 5082d0371..6fcb72b70 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -3885,11 +3885,6 @@ GCRuntime::markAllGrayReferences(gcstats::Phase phase) markGrayReferences(phase); } -void -GCRuntime::validateIncrementalMarking() -{ -} - void GCRuntime::finishMarkingValidation() { @@ -4529,8 +4524,6 @@ GCRuntime::beginSweepingZoneGroup(AutoLockForExclusiveAccess& lock) #endif } - validateIncrementalMarking(); - FreeOp fop(rt); SweepAtomsTask sweepAtomsTask(rt); SweepCCWrappersTask sweepCCWrappersTask(rt); -- cgit v1.2.3 From 6b289446151b6c672e33a5de4f97edf9e83b27a9 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:55:48 +0200 Subject: Remove finishMarkingValidation and caller --- js/src/gc/GCRuntime.h | 2 -- js/src/jsgc.cpp | 7 ------- 2 files changed, 9 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 872e649fa..638bd18c7 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -977,8 +977,6 @@ class GCRuntime void releaseRelocatedArenasWithoutUnlocking(Arena* arenaList, const AutoLockGC& lock); void finishCollection(JS::gcreason::Reason reason); - void finishMarkingValidation(); - #ifdef DEBUG void checkForCompartmentMismatches(); #endif diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 6fcb72b70..04aaeba68 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -3885,11 +3885,6 @@ GCRuntime::markAllGrayReferences(gcstats::Phase phase) markGrayReferences(phase); } -void -GCRuntime::finishMarkingValidation() -{ -} - static void DropStringWrappers(JSRuntime* rt) { @@ -4994,8 +4989,6 @@ GCRuntime::endSweepPhase(bool destroyingRuntime, AutoLockForExclusiveAccess& loc rt->setGCGrayBitsValid(true); } - finishMarkingValidation(); - #ifdef DEBUG for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { for (auto i : AllAllocKinds()) { -- cgit v1.2.3 From d184e493d92de8a99adb83a0fe34f90f576b064c Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 26 Jun 2017 23:57:55 +0200 Subject: Remove pushZealSelectedObjects() and caller --- js/src/gc/GCRuntime.h | 1 - js/src/jsgc.cpp | 8 -------- 2 files changed, 9 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 638bd18c7..ae4f03cea 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -921,7 +921,6 @@ class GCRuntime void incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason reason, AutoLockForExclusiveAccess& lock); - void pushZealSelectedObjects(); void purgeRuntime(AutoLockForExclusiveAccess& lock); MOZ_MUST_USE bool beginMarkPhase(JS::gcreason::Reason reason, AutoLockForExclusiveAccess& lock); bool shouldPreserveJITCode(JSCompartment* comp, int64_t currentTime, diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 04aaeba68..d61df8fe3 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5307,11 +5307,6 @@ AutoGCSlice::~AutoGCSlice() } } -void -GCRuntime::pushZealSelectedObjects() -{ -} - static bool IsShutdownGC(JS::gcreason::Reason reason) { @@ -5357,9 +5352,6 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea return; } - if (!destroyingRuntime) - pushZealSelectedObjects(); - incrementalState = State::Mark; MOZ_FALLTHROUGH; -- cgit v1.2.3 From f7352531b6f7442278bb8a7b95385db05ba4ae3c Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 27 Jun 2017 00:00:57 +0200 Subject: Remove runDebugGC() stub --- js/src/gc/GCRuntime.h | 1 - js/src/jsgc.cpp | 5 ----- 2 files changed, 6 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index ae4f03cea..19737c9ee 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -633,7 +633,6 @@ class GCRuntime MOZ_RELEASE_ASSERT(triggerGC(JS::gcreason::ALLOC_TRIGGER)); } - void runDebugGC(); inline void poke(); enum TraceOrMarkRuntime { diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index d61df8fe3..45301dac8 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -6178,11 +6178,6 @@ gc::MergeCompartments(JSCompartment* source, JSCompartment* target) target->zone()->types.typeLifoAlloc.transferFrom(&source->zone()->types.typeLifoAlloc); } -void -GCRuntime::runDebugGC() -{ -} - void GCRuntime::setFullCompartmentChecks(bool enabled) { -- cgit v1.2.3 From 648b569a2227b76cf39e060deff8b4081ba26f06 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 27 Jun 2017 00:12:45 +0200 Subject: Remove SetGCZeal() stub and its callers. --- js/src/builtin/TestingFunctions.cpp | 2 -- js/src/gc/Nursery.h | 2 -- js/src/tests/shell.js | 15 --------------- js/xpconnect/idl/xpccomponents.idl | 5 +---- js/xpconnect/src/XPCComponents.cpp | 6 ------ testing/specialpowers/content/specialpowersAPI.js | 4 ---- 6 files changed, 1 insertion(+), 33 deletions(-) diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 6765a05f3..acf449b7e 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -1264,8 +1264,6 @@ OOMTest(JSContext* cx, unsigned argc, Value* vp) MOZ_ASSERT(!cx->isExceptionPending()); rt->hadOutOfMemory = false; - JS_SetGCZeal(cx, 0, JS_DEFAULT_ZEAL_FREQ); - for (unsigned thread = threadStart; thread < threadEnd; thread++) { if (verbose) fprintf(stderr, "thread %d\n", thread); diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index 9195e024d..0d215d997 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -58,8 +58,6 @@ class NativeObject; class Nursery; class HeapSlot; -void SetGCZeal(JSRuntime*, uint8_t, uint32_t); - namespace gc { class AutoMaybeStartBackgroundAllocation; struct Cell; diff --git a/js/src/tests/shell.js b/js/src/tests/shell.js index 36dbc79da..c7a57953e 100644 --- a/js/src/tests/shell.js +++ b/js/src/tests/shell.js @@ -32,8 +32,6 @@ // Certain cached functionality only exists (and is only needed) when // running in the browser. Segregate that caching here. - var SpecialPowersSetGCZeal = - global.SpecialPowers ? global.SpecialPowers.setGCZeal : undefined; } var runningInShell = typeof window === "undefined"; @@ -205,19 +203,6 @@ global.quit = quit; } - var gczeal = global.gczeal; - if (typeof gczeal !== "function") { - if (typeof SpecialPowersSetGCZeal === "function") { - gczeal = function gczeal(z) { - SpecialPowersSetGCZeal(z); - }; - } else { - gczeal = function() {}; // no-op if not available - } - - global.gczeal = gczeal; - } - /****************************************************** * TEST METADATA EXPORTS (these are of dubious value) * ******************************************************/ diff --git a/js/xpconnect/idl/xpccomponents.idl b/js/xpconnect/idl/xpccomponents.idl index 711ea4c64..611091c4b 100644 --- a/js/xpconnect/idl/xpccomponents.idl +++ b/js/xpconnect/idl/xpccomponents.idl @@ -123,7 +123,7 @@ interface ScheduledGCCallback : nsISupports /** * interface of Components.utils */ -[scriptable, uuid(86003fe3-ee9a-4620-91dc-eef8b1e58815)] +[scriptable, uuid(a6e66965-4b9a-4846-8985-985e71aaf549)] interface nsIXPCComponents_Utils : nsISupports { @@ -529,9 +529,6 @@ interface nsIXPCComponents_Utils : nsISupports [implicit_jscontext] attribute boolean ion; - [implicit_jscontext] - void setGCZeal(in long zeal); - [implicit_jscontext] void nukeSandbox(in jsval obj); diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 02b0b4d14..dbb63092e 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -3004,12 +3004,6 @@ GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Ion, ion, setIon) #undef GENERATE_JSCONTEXTOPTION_GETTER_SETTER -NS_IMETHODIMP -nsXPCComponents_Utils::SetGCZeal(int32_t aValue, JSContext* cx) -{ - return NS_OK; -} - NS_IMETHODIMP nsXPCComponents_Utils::NukeSandbox(HandleValue obj, JSContext* cx) { diff --git a/testing/specialpowers/content/specialpowersAPI.js b/testing/specialpowers/content/specialpowersAPI.js index ee94e84a3..8f1ff7465 100644 --- a/testing/specialpowers/content/specialpowersAPI.js +++ b/testing/specialpowers/content/specialpowersAPI.js @@ -1479,10 +1479,6 @@ SpecialPowersAPI.prototype = { Cu.schedulePreciseGC(genGCCallback(callback)); }, - setGCZeal: function(zeal) { - Cu.setGCZeal(zeal); - }, - isMainProcess: function() { try { return Cc["@mozilla.org/xre/app-info;1"]. -- cgit v1.2.3 From e27da6cc5e825b58f810b368b2bd59bca2164ab0 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 27 Jun 2017 00:21:45 +0200 Subject: Remove unused compileBarriers() --- js/src/gc/Zone.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index 84d6f03dd..50d06319d 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -253,8 +253,6 @@ struct Zone : public JS::shadow::Zone, // possibly at other times too. uint64_t gcNumber(); - bool compileBarriers() const { return needsIncrementalBarrier(); } - enum ShouldUpdateJit { DontUpdateJit, UpdateJit }; void setNeedsIncrementalBarrier(bool needs, ShouldUpdateJit updateJit); const bool* addressOfNeedsIncrementalBarrier() const { return &needsIncrementalBarrier_; } -- cgit v1.2.3