diff options
Diffstat (limited to 'js/src/builtin/TestingFunctions.cpp')
-rw-r--r-- | js/src/builtin/TestingFunctions.cpp | 208 |
1 files changed, 0 insertions, 208 deletions
diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 5bc69a346..acf449b7e 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -188,14 +188,6 @@ 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; - #ifdef JS_MORE_DETERMINISTIC value = BooleanValue(true); #else @@ -731,171 +723,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) { @@ -1437,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); @@ -4387,39 +4212,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" |