Closed Bug 739899 Opened 8 years ago Closed 8 years ago
GC: Compartment creation during incremental GC shouldn't reset the GC
Right now, if a compartment is created during an incremental GC, we reset the current GC and finish with a non-incremental GC. This seems to happen pretty frequently during normal browsing. In theory, we should be able to carry on with the GC as normal without touching the new compartment (i.e., don't mark it and don't collect any of its objects). In practice, this could be a little difficult since it will be hard to avoid marking into the new compartment. Bug 716142 may simplify the problem: maybe we could switch the GC to a multi-compartment GC of every compartment except the newly-created one.
Now that multi-compartment GC has landed, we can make headway on this. Unfortunately, the multi-compartment GC patch preserved a difference between "full" GCs and compartment GCs (even if the compartment GC collected every compartment). This patch removes that distinction. The main changes in behavior from this patch are: 1. If a compartment is created during an incremental GC, we don't reset the GC or switch to non-incremental GC. In fact, we don't do anything. The new compartment won't be collected. 2. We now collect atoms only if every compartment that existed at the beginning of the GC is being collected. 3. Now any GC can delete a compartment if it has no live objects. Previously only "full" GCs could do this. Note that most of the time we'll still collect all compartments. It's just that collecting all compartments is no longer a special case.
Attachment #612375 - Flags: review?(igor)
Comment on attachment 612375 [details] [diff] [review] patch Review of attachment 612375 [details] [diff] [review]: ----------------------------------------------------------------- nice cleanup! ::: js/src/jsatom.cpp @@ +241,5 @@ > return true; > } > > void > +js::FinishCommonAtoms(JSContext *cx) As you are changing this, replace the cx argument with the rt here ::: js/src/jsgc.cpp @@ +2277,5 @@ > + if (!c->isCollecting()) > + isFullGC = false; > + } > + } > + MarkAtomState(trc, rt->gcKeepAtoms || !isFullGC); We need a bug to stop marking atoms when the atom compartment is not under the GC itself.
Attachment #612375 - Flags: review?(igor) → review+
Target Milestone: --- → mozilla14
8 years ago
Duplicate of this bug: 742003
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.