Bug 1214961 - Sweep XPConnect incrementally; r=mccr8, r=jonco

This patch splits up the "wrapped-js" table by compartment in order to allow us
to visit the miminal number of wrapped-js in each GC sweeping slice, instead of
visiting the entire table repeatedly. This dramatically reduces our sweeping
overhead, reducing the number of GC slices, and making them more likely to fall
within budget.
This commit is contained in:
Terrence Cole
2015-10-15 13:43:28 -07:00
parent 9f31923a12
commit 1c8b147a2d
13 changed files with 311 additions and 89 deletions

View File

@@ -21,7 +21,7 @@ using namespace mozilla::jsipc;
using mozilla::AutoSafeJSContext;
static void
UpdateChildWeakPointersAfterGC(JSRuntime* rt, void* data)
UpdateChildWeakPointersBeforeSweepingZoneGroup(JSRuntime* rt, void* data)
{
static_cast<JavaScriptChild*>(data)->updateWeakPointers();
}
@@ -34,7 +34,7 @@ JavaScriptChild::JavaScriptChild(JSRuntime* rt)
JavaScriptChild::~JavaScriptChild()
{
JS_RemoveWeakPointerCallback(rt_, UpdateChildWeakPointersAfterGC);
JS_RemoveWeakPointerZoneGroupCallback(rt_, UpdateChildWeakPointersBeforeSweepingZoneGroup);
}
bool
@@ -45,7 +45,7 @@ JavaScriptChild::init()
if (!WrapperAnswer::init())
return false;
JS_AddWeakPointerCallback(rt_, UpdateChildWeakPointersAfterGC, this);
JS_AddWeakPointerZoneGroupCallback(rt_, UpdateChildWeakPointersBeforeSweepingZoneGroup, this);
return true;
}