mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 742570 - Remove the compartment option for gczeal (r=igor)
This commit is contained in:
parent
1eff4f5687
commit
3ace6566fe
@ -915,7 +915,6 @@ static const char js_relimit_option_str[]= JS_OPTIONS_DOT_STR "relimit";
|
||||
#ifdef JS_GC_ZEAL
|
||||
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
|
||||
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
|
||||
static const char js_zeal_compartment_str[] = JS_OPTIONS_DOT_STR "gczeal.compartment_gc";
|
||||
#endif
|
||||
static const char js_methodjit_content_str[] = JS_OPTIONS_DOT_STR "methodjit.content";
|
||||
static const char js_methodjit_chrome_str[] = JS_OPTIONS_DOT_STR "methodjit.chrome";
|
||||
@ -1022,9 +1021,8 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
#ifdef JS_GC_ZEAL
|
||||
PRInt32 zeal = Preferences::GetInt(js_zeal_option_str, -1);
|
||||
PRInt32 frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);
|
||||
bool compartment = Preferences::GetBool(js_zeal_compartment_str, false);
|
||||
if (zeal >= 0)
|
||||
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, frequency, compartment);
|
||||
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, frequency);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -320,7 +320,7 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate)
|
||||
NS_ASSERTION(zeal <= 3, "Bad zeal value!");
|
||||
|
||||
PRUint32 frequency = zeal <= 2 ? JS_DEFAULT_ZEAL_FREQ : 1;
|
||||
JS_SetGCZeal(workerCx, zeal, frequency, false);
|
||||
JS_SetGCZeal(workerCx, zeal, frequency);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3877,7 +3877,7 @@ WorkerPrivate::UpdateGCZealInternal(JSContext* aCx, PRUint8 aGCZeal)
|
||||
AssertIsOnWorkerThread();
|
||||
|
||||
PRUint32 frequency = aGCZeal <= 2 ? JS_DEFAULT_ZEAL_FREQ : 1;
|
||||
JS_SetGCZeal(aCx, aGCZeal, frequency, false);
|
||||
JS_SetGCZeal(aCx, aGCZeal, frequency);
|
||||
|
||||
for (PRUint32 index = 0; index < mChildWorkers.Length(); index++) {
|
||||
mChildWorkers[index]->UpdateGCZeal(aCx, aGCZeal);
|
||||
|
@ -430,7 +430,7 @@ GCZeal(JSContext *cx,
|
||||
if (!JS_ValueToECMAUint32(cx, argv[0], &zeal))
|
||||
return JS_FALSE;
|
||||
|
||||
JS_SetGCZeal(cx, PRUint8(zeal), JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
|
||||
JS_SetGCZeal(cx, PRUint8(zeal), JS_DEFAULT_ZEAL_FREQ);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
@ -154,9 +154,8 @@ static JSBool
|
||||
GCZeal(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
uint32_t zeal, frequency = JS_DEFAULT_ZEAL_FREQ;
|
||||
JSBool compartment = JS_FALSE;
|
||||
|
||||
if (argc > 3) {
|
||||
if (argc > 2) {
|
||||
ReportUsageError(cx, &JS_CALLEE(cx, vp).toObject(), "Too many arguments");
|
||||
return JS_FALSE;
|
||||
}
|
||||
@ -165,10 +164,8 @@ GCZeal(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (argc >= 2)
|
||||
if (!JS_ValueToECMAUint32(cx, vp[3], &frequency))
|
||||
return JS_FALSE;
|
||||
if (argc >= 3)
|
||||
compartment = js_ValueToBoolean(vp[3]);
|
||||
|
||||
JS_SetGCZeal(cx, (uint8_t)zeal, frequency, compartment);
|
||||
JS_SetGCZeal(cx, (uint8_t)zeal, frequency);
|
||||
*vp = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -177,18 +174,15 @@ static JSBool
|
||||
ScheduleGC(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
uint32_t count;
|
||||
bool compartment = false;
|
||||
|
||||
if (argc != 1 && argc != 2) {
|
||||
if (argc != 1) {
|
||||
ReportUsageError(cx, &JS_CALLEE(cx, vp).toObject(), "Wrong number of arguments");
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!JS_ValueToECMAUint32(cx, vp[2], &count))
|
||||
return JS_FALSE;
|
||||
if (argc == 2)
|
||||
compartment = js_ValueToBoolean(vp[3]);
|
||||
|
||||
JS_ScheduleGC(cx, count, compartment);
|
||||
JS_ScheduleGC(cx, count);
|
||||
*vp = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -502,7 +496,7 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
JS_FN_HELP("gczeal", GCZeal, 2, 0,
|
||||
"gczeal(level, [period], [compartmentGC?])",
|
||||
"gczeal(level, [period])",
|
||||
" Specifies how zealous the garbage collector should be. Values for level:\n"
|
||||
" 0: Normal amount of collection\n"
|
||||
" 1: Collect when roots are added or removed\n"
|
||||
@ -510,11 +504,10 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
" 3: Collect when the window paints (browser only)\n"
|
||||
" 4: Verify write barriers between instructions\n"
|
||||
" 5: Verify write barriers between paints\n"
|
||||
" Period specifies that collection happens every n allocations.\n"
|
||||
" If compartmentGC is true, the collections will be compartmental."),
|
||||
" Period specifies that collection happens every n allocations.\n"),
|
||||
|
||||
JS_FN_HELP("schedulegc", ScheduleGC, 1, 0,
|
||||
"schedulegc(num, [compartmentGC?])",
|
||||
"schedulegc(num)",
|
||||
" Schedule a GC to happen after num allocations."),
|
||||
|
||||
JS_FN_HELP("verifybarriers", VerifyBarriers, 0, 0,
|
||||
|
@ -747,7 +747,6 @@ JSRuntime::JSRuntime()
|
||||
gcZeal_(0),
|
||||
gcZealFrequency(0),
|
||||
gcNextScheduled(0),
|
||||
gcDebugCompartmentGC(false),
|
||||
gcDeterministicOnly(false),
|
||||
#endif
|
||||
gcCallback(NULL),
|
||||
@ -6565,14 +6564,13 @@ JS_AbortIfWrongThread(JSRuntime *rt)
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency, JSBool compartment)
|
||||
JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency)
|
||||
{
|
||||
#ifdef JS_GC_ZEAL
|
||||
const char *env = getenv("JS_GC_ZEAL");
|
||||
if (env) {
|
||||
zeal = atoi(env);
|
||||
frequency = 1;
|
||||
compartment = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -6580,14 +6578,12 @@ JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency, JSBool compartment
|
||||
cx->runtime->gcZeal_ = zeal;
|
||||
cx->runtime->gcZealFrequency = frequency;
|
||||
cx->runtime->gcNextScheduled = schedule ? frequency : 0;
|
||||
cx->runtime->gcDebugCompartmentGC = !!compartment;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_ScheduleGC(JSContext *cx, uint32_t count, JSBool compartment)
|
||||
JS_ScheduleGC(JSContext *cx, uint32_t count)
|
||||
{
|
||||
cx->runtime->gcNextScheduled = count;
|
||||
cx->runtime->gcDebugCompartmentGC = !!compartment;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -5531,10 +5531,10 @@ JS_NewObjectForConstructor(JSContext *cx, JSClass *clasp, const jsval *vp);
|
||||
#define JS_DEFAULT_ZEAL_FREQ 100
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency, JSBool compartment);
|
||||
JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ScheduleGC(JSContext *cx, uint32_t count, JSBool compartment);
|
||||
JS_ScheduleGC(JSContext *cx, uint32_t count);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -445,7 +445,6 @@ struct JSRuntime : js::RuntimeFriendFields
|
||||
int gcZeal_;
|
||||
int gcZealFrequency;
|
||||
int gcNextScheduled;
|
||||
bool gcDebugCompartmentGC;
|
||||
bool gcDeterministicOnly;
|
||||
|
||||
int gcZeal() { return gcZeal_; }
|
||||
|
@ -3932,16 +3932,7 @@ void
|
||||
RunDebugGC(JSContext *cx)
|
||||
{
|
||||
#ifdef JS_GC_ZEAL
|
||||
JSRuntime *rt = cx->runtime;
|
||||
|
||||
/*
|
||||
* If rt->gcDebugCompartmentGC is true, only GC the current
|
||||
* compartment. But don't GC the atoms compartment.
|
||||
*/
|
||||
if (rt->gcDebugCompartmentGC)
|
||||
PrepareCompartmentForGC(cx->compartment);
|
||||
else
|
||||
PrepareForFullGC(cx->runtime);
|
||||
PrepareForFullGC(cx->runtime);
|
||||
RunLastDitchGC(cx, gcreason::DEBUG_GC);
|
||||
#endif
|
||||
}
|
||||
|
@ -652,25 +652,6 @@ MapContextOptionNameToFlag(JSContext* cx, const char* name)
|
||||
|
||||
extern JSClass global_class;
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
static void
|
||||
ParseZealArg(JSContext *cx, const char *arg)
|
||||
{
|
||||
int zeal, freq = 1, compartment = 0;
|
||||
const char *p = strchr(arg, ',');
|
||||
|
||||
zeal = atoi(arg);
|
||||
if (p) {
|
||||
freq = atoi(p + 1);
|
||||
p = strchr(p + 1, ',');
|
||||
if (p)
|
||||
compartment = atoi(p + 1);
|
||||
}
|
||||
|
||||
JS_SetGCZeal(cx, (uint8_t)zeal, freq, !!compartment);
|
||||
}
|
||||
#endif
|
||||
|
||||
static JSBool
|
||||
Version(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -4674,11 +4655,6 @@ ProcessArgs(JSContext *cx, JSObject *obj, OptionParser *op)
|
||||
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
|
||||
}
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
if (const char *zeal = op->getStringOption('Z'))
|
||||
ParseZealArg(cx, zeal);
|
||||
#endif
|
||||
|
||||
if (op->getBoolOption('d')) {
|
||||
JS_SetRuntimeDebugMode(JS_GetRuntime(cx), true);
|
||||
JS_SetDebugMode(cx, true);
|
||||
|
@ -568,7 +568,7 @@ GCZeal(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (!JS_ValueToECMAUint32(cx, argc ? JS_ARGV(cx, vp)[0] : JSVAL_VOID, &zeal))
|
||||
return false;
|
||||
|
||||
JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ, false);
|
||||
JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return true;
|
||||
}
|
||||
|
@ -3929,7 +3929,7 @@ NS_IMETHODIMP
|
||||
nsXPCComponents_Utils::SetGCZeal(PRInt32 aValue, JSContext* cx)
|
||||
{
|
||||
#ifdef JS_GC_ZEAL
|
||||
JS_SetGCZeal(cx, PRUint8(aValue), JS_DEFAULT_ZEAL_FREQ, false);
|
||||
JS_SetGCZeal(cx, PRUint8(aValue), JS_DEFAULT_ZEAL_FREQ);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user