зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1302645 - Only relazify functions on shrinking GCs to avoid reparsing too much. r=terrence
This commit is contained in:
Родитель
ed2743696a
Коммит
0b8211b299
|
@ -479,10 +479,15 @@ RelazifyFunctions(JSContext* cx, unsigned argc, Value* vp)
|
|||
// not active. To aid fuzzing, this testing function allows us to relazify
|
||||
// even if the compartment is active.
|
||||
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
SetAllowRelazification(cx, true);
|
||||
bool res = GC(cx, argc, vp);
|
||||
|
||||
JS::PrepareForFullGC(cx);
|
||||
JS::GCForReason(cx, GC_SHRINK, JS::gcreason::API);
|
||||
|
||||
SetAllowRelazification(cx, false);
|
||||
return res;
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -111,7 +111,7 @@ test = "function f() { }; f();"
|
|||
+ "assertEq(isLazyFunction(f), false);"
|
||||
+ "var expect = isRelazifiableFunction(f);";
|
||||
checkAfter = function (ctx) {
|
||||
gc(ctx.global.f); // relazify f, if possible.
|
||||
gc(ctx.global.f, "shrinking"); // relazify f, if possible.
|
||||
evaluate("assertEq(isLazyFunction(f), expect);", ctx);
|
||||
};
|
||||
evalWithCache(test, {
|
||||
|
@ -128,7 +128,7 @@ test = "function f() { return isRelazifiableFunction(f) }; var expect = f();"
|
|||
+ "assertEq(isLazyFunction(f), false);"
|
||||
+ "expect";
|
||||
checkAfter = function (ctx) {
|
||||
gc(ctx.global.f); // relazify f, if possible.
|
||||
gc(ctx.global.f, "shrinking"); // relazify f, if possible.
|
||||
evaluate("assertEq(isLazyFunction(f), expect);", ctx);
|
||||
};
|
||||
evalWithCache(test, {
|
||||
|
|
|
@ -3841,12 +3841,17 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason, AutoLockForExclusiveAcces
|
|||
* Relazify functions after discarding JIT code (we can't relazify
|
||||
* functions with JIT code) and before the actual mark phase, so that
|
||||
* the current GC can collect the JSScripts we're unlinking here.
|
||||
* We do this only when we're performing a shrinking GC, as too much
|
||||
* relazification can cause performance issues when we have to reparse
|
||||
* the same functions over and over.
|
||||
*/
|
||||
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
|
||||
if (invocationKind == GC_SHRINK) {
|
||||
gcstats::AutoPhase ap(stats, gcstats::PHASE_RELAZIFY_FUNCTIONS);
|
||||
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
|
||||
RelazifyFunctions(zone, AllocKind::FUNCTION);
|
||||
RelazifyFunctions(zone, AllocKind::FUNCTION_EXTENDED);
|
||||
}
|
||||
}
|
||||
|
||||
startNumber = number;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче