зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868635 - Make merging CC heuristics go through scx. r=mccr8
This commit is contained in:
Родитель
ff37abce70
Коммит
768211fa86
|
@ -2541,11 +2541,11 @@ nsJSContext::ShrinkGCBuffersNow()
|
|||
JS::ShrinkGCBuffers(nsJSRuntime::sRuntime);
|
||||
}
|
||||
|
||||
// Return true if any JSContext has a "global object" with a gray
|
||||
// parent. The intent is to look for JS Object windows. We don't merge
|
||||
// Return true if there exists a JSContext with a default global whose current
|
||||
// inner is gray. The intent is to look for JS Object windows. We don't merge
|
||||
// system compartments, so we don't use them to trigger merging CCs.
|
||||
static bool
|
||||
AnyGrayGlobalParent()
|
||||
AnyGrayCurrentContentInnerWindows()
|
||||
{
|
||||
if (!nsJSRuntime::sRuntime) {
|
||||
return false;
|
||||
|
@ -2553,13 +2553,20 @@ AnyGrayGlobalParent()
|
|||
JSContext *iter = nullptr;
|
||||
JSContext *cx;
|
||||
while ((cx = JS_ContextIterator(nsJSRuntime::sRuntime, &iter))) {
|
||||
if (JSObject *global = JS_GetGlobalObject(cx)) {
|
||||
if (JSObject *parent = js::GetObjectParent(global)) {
|
||||
if (JS::GCThingIsMarkedGray(parent) &&
|
||||
!js::IsSystemCompartment(js::GetObjectCompartment(parent))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Skip anything without an nsIScriptContext, as well as any scx whose
|
||||
// NativeGlobal() is not an outer window (this happens with XUL Prototype
|
||||
// compilation scopes, for example, which we're not interested in).
|
||||
nsIScriptContext *scx = GetScriptContextFromJSContext(cx);
|
||||
JS::RootedObject global(cx, scx ? scx->GetNativeGlobal() : nullptr);
|
||||
if (!global || !js::GetObjectParent(global)) {
|
||||
continue;
|
||||
}
|
||||
// Grab the inner from the outer.
|
||||
global = JS_ObjectToInnerObject(cx, global);
|
||||
MOZ_ASSERT(!js::GetObjectParent(global));
|
||||
if (JS::GCThingIsMarkedGray(global) &&
|
||||
!js::IsSystemCompartment(js::GetObjectCompartment(global))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -2590,7 +2597,7 @@ DoMergingCC(bool aForced)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!aForced && AnyGrayGlobalParent()) {
|
||||
if (!aForced && AnyGrayCurrentContentInnerWindows()) {
|
||||
sMergedInARow++;
|
||||
return true;
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче