Bug 832425 - gcPreserveCode() should be defined when not using JS_GC_ZEAL, r=h4writer.

This commit is contained in:
Brian Hackett 2013-01-19 17:30:05 -07:00
parent f086d4a270
commit cf01f4f12b

View File

@ -327,6 +327,23 @@ InternalConst(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
static JSBool
GCPreserveCode(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (argc != 0) {
RootedObject callee(cx, &args.callee());
ReportUsageError(cx, callee, "Wrong number of arguments");
return JS_FALSE;
}
cx->runtime->alwaysPreserveCode = true;
*vp = JSVAL_VOID;
return JS_TRUE;
}
#ifdef JS_GC_ZEAL
static JSBool
GCZeal(JSContext *cx, unsigned argc, jsval *vp)
@ -476,23 +493,6 @@ GCState(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
static JSBool
GCPreserveCode(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (argc != 0) {
RootedObject callee(cx, &args.callee());
ReportUsageError(cx, callee, "Wrong number of arguments");
return JS_FALSE;
}
cx->runtime->alwaysPreserveCode = true;
*vp = JSVAL_VOID;
return JS_TRUE;
}
static JSBool
DeterministicGC(JSContext *cx, unsigned argc, jsval *vp)
{
@ -899,6 +899,10 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
" Return the current value of the finalization counter that is incremented\n"
" each time an object returned by the makeFinalizeObserver is finalized."),
JS_FN_HELP("gcPreserveCode", GCPreserveCode, 0, 0,
"gcPreserveCode()",
" Preserve JIT code during garbage collections."),
#ifdef JS_GC_ZEAL
JS_FN_HELP("gczeal", GCZeal, 2, 0,
"gczeal(level, [period])",
@ -944,10 +948,6 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
"gcstate()",
" Report the global GC state."),
JS_FN_HELP("gcPreserveCode", GCPreserveCode, 0, 0,
"gcPreserveCode()",
" Preserve JIT code during garbage collections."),
JS_FN_HELP("deterministicgc", DeterministicGC, 1, 0,
"deterministicgc(true|false)",
" If true, only allow determinstic GCs to run."),