зеркало из https://github.com/mozilla/gecko-dev.git
bug 560471 - followup to fix restoration of weak roots
This commit is contained in:
Родитель
7bf54364f0
Коммит
6e3f664dff
|
@ -1710,16 +1710,21 @@ class AutoGCRooter {
|
||||||
void operator=(AutoGCRooter &ida);
|
void operator=(AutoGCRooter &ida);
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoSaveWeakRoots : private AutoGCRooter
|
class AutoSaveRestoreWeakRoots : private AutoGCRooter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AutoSaveWeakRoots(JSContext *cx
|
explicit AutoSaveRestoreWeakRoots(JSContext *cx
|
||||||
JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||||
: AutoGCRooter(cx, WEAKROOTS), savedRoots(cx->weakRoots)
|
: AutoGCRooter(cx, WEAKROOTS), savedRoots(cx->weakRoots)
|
||||||
{
|
{
|
||||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~AutoSaveRestoreWeakRoots()
|
||||||
|
{
|
||||||
|
context->weakRoots = savedRoots;
|
||||||
|
}
|
||||||
|
|
||||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -78,7 +78,7 @@ AutoGCRooter::trace(JSTracer *trc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WEAKROOTS:
|
case WEAKROOTS:
|
||||||
static_cast<AutoSaveWeakRoots *>(this)->savedRoots.mark(trc);
|
static_cast<AutoSaveRestoreWeakRoots *>(this)->savedRoots.mark(trc);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case PARSER:
|
case PARSER:
|
||||||
|
|
|
@ -1408,7 +1408,7 @@ LastDitchGC(JSContext *cx)
|
||||||
JS_ASSERT(!JS_ON_TRACE(cx));
|
JS_ASSERT(!JS_ON_TRACE(cx));
|
||||||
|
|
||||||
/* The last ditch GC preserves weak roots and all atoms. */
|
/* The last ditch GC preserves weak roots and all atoms. */
|
||||||
AutoSaveWeakRoots save(cx);
|
AutoSaveRestoreWeakRoots save(cx);
|
||||||
AutoKeepAtoms keep(cx->runtime);
|
AutoKeepAtoms keep(cx->runtime);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче