Bug 1222420 - Make AutoFinishGC into a function r=terrence

This commit is contained in:
Jon Coppeard 2016-03-15 11:16:13 +00:00
Родитель 083cea5e81
Коммит 81113c32fa
7 изменённых файлов: 12 добавлений и 22 удалений

Просмотреть файл

@ -8,6 +8,7 @@
#define gc_GCInternals_h
#include "mozilla/ArrayUtils.h"
#include "mozilla/Maybe.h"
#include "mozilla/PodOperations.h"
#include "jscntxt.h"
@ -19,10 +20,7 @@
namespace js {
namespace gc {
struct MOZ_RAII AutoFinishGC
{
explicit AutoFinishGC(JSRuntime* rt);
};
void FinishGC(JSRuntime* rt);
/*
* This class should be used by any code that needs to exclusive access to the
@ -48,8 +46,7 @@ class MOZ_RAII AutoTraceSession
struct MOZ_RAII AutoPrepareForTracing
{
AutoFinishGC finish;
AutoTraceSession session;
mozilla::Maybe<AutoTraceSession> session;
AutoPrepareForTracing(JSRuntime* rt, ZoneSelector selector);
};

Просмотреть файл

@ -48,7 +48,7 @@ BEGIN_TEST(testGCAllocator)
#endif
/* Finish any ongoing background free activity. */
js::gc::AutoFinishGC finishGC(rt);
js::gc::FinishGC(rt);
bool growUp;
CHECK(addressesGrowUp(&growUp));

Просмотреть файл

@ -18,7 +18,7 @@ MinimizeHeap(JSRuntime* rt)
// sweeping that the first GC started to finish.
JS_GC(rt);
JS_GC(rt);
js::gc::AutoFinishGC finish(rt);
js::gc::FinishGC(rt);
}
BEGIN_TEST(testGCUID)

Просмотреть файл

@ -2007,7 +2007,7 @@ AutoDisableCompactingGC::AutoDisableCompactingGC(JSRuntime* rt)
{
gc.disableCompactingGC();
if (gc.isIncrementalGCInProgress() && gc.isCompactingGc())
AutoFinishGC finishGC(rt);
FinishGC(rt);
}
AutoDisableCompactingGC::~AutoDisableCompactingGC()
@ -6726,21 +6726,20 @@ GCRuntime::gcIfRequested(JSContext* cx /* = nullptr */)
return false;
}
AutoFinishGC::AutoFinishGC(JSRuntime* rt)
void js::gc::FinishGC(JSRuntime* rt)
{
if (JS::IsIncrementalGCInProgress(rt)) {
JS::PrepareForIncrementalGC(rt);
JS::FinishIncrementalGC(rt, JS::gcreason::API);
}
rt->gc.waitBackgroundSweepEnd();
rt->gc.nursery.waitBackgroundFreeEnd();
}
AutoPrepareForTracing::AutoPrepareForTracing(JSRuntime* rt, ZoneSelector selector)
: finish(rt),
session(rt)
{
js::gc::FinishGC(rt);
session.emplace(rt);
}
JSCompartment*

Просмотреть файл

@ -789,12 +789,6 @@ const size_t MAX_EMPTY_CHUNK_AGE = 4;
} /* namespace gc */
extern bool
InitGC(JSRuntime* rt, uint32_t maxbytes);
extern void
FinishGC(JSRuntime* rt);
class InterpreterFrame;
extern void

Просмотреть файл

@ -3812,7 +3812,7 @@ runOffThreadScript(JSContext* cx, unsigned argc, Value* vp)
JSRuntime* rt = cx->runtime();
if (OffThreadParsingMustWaitForGC(rt))
gc::AutoFinishGC finishgc(rt);
gc::FinishGC(rt);
void* token = offThreadState.waitUntilDone(cx, ScriptKind::Script);
if (!token) {
@ -3914,7 +3914,7 @@ FinishOffThreadModule(JSContext* cx, unsigned argc, Value* vp)
JSRuntime* rt = cx->runtime();
if (OffThreadParsingMustWaitForGC(rt))
gc::AutoFinishGC finishgc(rt);
gc::FinishGC(rt);
void* token = offThreadState.waitUntilDone(cx, ScriptKind::Module);
if (!token) {

Просмотреть файл

@ -1240,7 +1240,7 @@ GlobalHelperThreadState::mergeParseTaskCompartment(JSRuntime* rt, ParseTask* par
// finished merging the contents of the parse task's compartment into the
// destination compartment. Finish any ongoing incremental GC first and
// assert that no allocation can occur.
gc::AutoFinishGC finishGC(rt);
gc::FinishGC(rt);
JS::AutoAssertNoAlloc noAlloc(rt);
LeaveParseTaskZone(rt, parseTask);