Bug 396049: the last ditch GC gcPoke checks are moved to js_NewGCThing. r=brendan
git-svn-id: svn://10.0.0.236/trunk@236198 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
8ff8d1d60d
commit
230369cb84
@ -1054,7 +1054,6 @@ js_DumpGCStats(JSRuntime *rt, FILE *fp)
|
||||
#endif
|
||||
fprintf(fp, " maximum GC nesting level: %lu\n", ULSTAT(maxlevel));
|
||||
fprintf(fp, "potentially useful GC calls: %lu\n", ULSTAT(poke));
|
||||
fprintf(fp, " useless GC calls: %lu\n", ULSTAT(nopoke));
|
||||
fprintf(fp, " thing arenas freed so far: %lu\n", ULSTAT(afree));
|
||||
fprintf(fp, " stack segments scanned: %lu\n", ULSTAT(stackseg));
|
||||
fprintf(fp, "stack segment slots scanned: %lu\n", ULSTAT(segslots));
|
||||
@ -1403,14 +1402,10 @@ js_NewGCThing(JSContext *cx, uintN flags, size_t nbytes)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
doGC = (rt->gcMallocBytes >= rt->gcMaxMallocBytes);
|
||||
doGC = (rt->gcMallocBytes >= rt->gcMaxMallocBytes && rt->gcPoke);
|
||||
#ifdef JS_GC_ZEAL
|
||||
if (rt->gcZeal >= 1) {
|
||||
doGC = JS_TRUE;
|
||||
if (rt->gcZeal >= 2)
|
||||
rt->gcPoke = JS_TRUE;
|
||||
}
|
||||
#endif /* !JS_GC_ZEAL */
|
||||
doGC = doGC || rt->gcZeal >= 2 || (rt->gcZeal >= 1 && rt->gcPoke);
|
||||
#endif
|
||||
|
||||
arenaList = &rt->gcArenaList[flindex];
|
||||
for (;;) {
|
||||
@ -1477,7 +1472,6 @@ js_NewGCThing(JSContext *cx, uintN flags, size_t nbytes)
|
||||
if (rt->gcBytes >= rt->gcMaxBytes || !(a = NewGCArena(rt))) {
|
||||
if (doGC)
|
||||
goto fail;
|
||||
rt->gcPoke = JS_TRUE;
|
||||
doGC = JS_TRUE;
|
||||
continue;
|
||||
}
|
||||
@ -2432,11 +2426,9 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
|
||||
/* The last ditch GC preserves all atoms and weak roots. */
|
||||
keepAtoms = JS_TRUE;
|
||||
} else {
|
||||
JS_CLEAR_WEAK_ROOTS(&cx->weakRoots);
|
||||
rt->gcPoke = JS_TRUE;
|
||||
|
||||
/* Keep atoms when a suspended compile is running on another context. */
|
||||
keepAtoms = (rt->gcKeepAtoms != 0);
|
||||
JS_CLEAR_WEAK_ROOTS(&cx->weakRoots);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2463,13 +2455,6 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
|
||||
if (gckind != GC_LAST_DITCH)
|
||||
JS_LOCK_GC(rt);
|
||||
|
||||
/* Do nothing if no mutator has executed since the last GC. */
|
||||
if (!rt->gcPoke) {
|
||||
METER(rt->gcStats.nopoke++);
|
||||
if (gckind != GC_LAST_DITCH)
|
||||
JS_UNLOCK_GC(rt);
|
||||
return;
|
||||
}
|
||||
METER(rt->gcStats.poke++);
|
||||
rt->gcPoke = JS_FALSE;
|
||||
|
||||
|
||||
@ -262,7 +262,6 @@ typedef struct JSGCStats {
|
||||
#endif
|
||||
uint32 maxlevel; /* maximum GC nesting (indirect recursion) level */
|
||||
uint32 poke; /* number of potentially useful GC calls */
|
||||
uint32 nopoke; /* useless GC calls where js_PokeGC was not set */
|
||||
uint32 afree; /* thing arenas freed so far */
|
||||
uint32 stackseg; /* total extraordinary stack segments scanned */
|
||||
uint32 segslots; /* total stack segment jsval slots scanned */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user