Backed out changeset fbf84e79c44c (bug 1376891) for bustage CycleCollectedJSRuntime.h:254 r=backout on a CLOSED TREE

This commit is contained in:
Csoregi Natalia 2017-11-01 15:32:09 +02:00
Родитель 2e1447501d
Коммит b0832d7215
8 изменённых файлов: 1 добавлений и 97 удалений

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

@ -67,7 +67,7 @@ namespace JS {
D(EVICT_NURSERY) \
D(DELAYED_ATOMS_GC) \
D(SHARED_MEMORY_LIMIT) \
D(IDLE_TIME_COLLECTION) \
D(UNUSED1) \
D(INCREMENTAL_TOO_SLOW) \
D(ABORT_GC) \
D(FULL_WHOLE_CELL_BUFFER) \

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

@ -279,20 +279,12 @@ class Nursery
JS::gcreason::Reason minorGCTriggerReason() const { return minorGCTriggerReason_; }
void clearMinorGCRequest() { minorGCTriggerReason_ = JS::gcreason::NO_REASON; }
bool needIdleTimeCollection() const {
return minorGCRequested() ||
(freeSpace() < kIdleTimeCollectionThreshold);
}
bool enableProfiling() const { return enableProfiling_; }
private:
/* The amount of space in the mapped nursery available to allocations. */
static const size_t NurseryChunkUsableSize = gc::ChunkSize - gc::ChunkTrailerSize;
/* Attemp to run a minor GC in the idle time if the free space falls below this threshold. */
static constexpr size_t kIdleTimeCollectionThreshold = NurseryChunkUsableSize / 4;
JSRuntime* runtime_;
/* Vector of allocated chunks to allocate from. */

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

@ -1439,20 +1439,6 @@ JS_RemoveExtraGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data)
return cx->runtime()->gc.removeBlackRootsTracer(traceOp, data);
}
JS_PUBLIC_API(bool)
JS::IsIdleGCTaskNeeded(JSRuntime* rt) {
// Currently, we only collect nursery during idle time.
return rt->gc.nursery().needIdleTimeCollection();
}
JS_PUBLIC_API(void)
JS::RunIdleTimeGCTask(JSRuntime* rt) {
GCRuntime& gc = rt->gc;
if (gc.nursery().needIdleTimeCollection()) {
gc.minorGC(JS::gcreason::IDLE_TIME_COLLECTION);
}
}
JS_PUBLIC_API(void)
JS_GC(JSContext* cx)
{

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

@ -1748,16 +1748,6 @@ JS_RemoveExtraGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data);
/*
* Garbage collector API.
*/
namespace JS {
extern JS_PUBLIC_API(bool)
IsIdleGCTaskNeeded(JSRuntime* rt);
extern JS_PUBLIC_API(void)
RunIdleTimeGCTask(JSRuntime* rt);
} // namespace JS
extern JS_PUBLIC_API(void)
JS_GC(JSContext* cx);

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

@ -370,9 +370,6 @@ CycleCollectedJSContext::AfterProcessTask(uint32_t aRecursionDepth)
// Step 4.2 Execute any events that were waiting for a stable state.
ProcessStableStateQueue();
// This should be a fast test so that it won't affect the next task processing.
IsIdleGCTaskNeeded();
}
void
@ -382,36 +379,6 @@ CycleCollectedJSContext::AfterProcessMicrotask()
AfterProcessMicrotask(RecursionDepth());
}
void CycleCollectedJSContext::IsIdleGCTaskNeeded()
{
class IdleTimeGCTaskRunnable : public mozilla::IdleRunnable
{
public:
using mozilla::IdleRunnable::IdleRunnable;
public:
NS_IMETHOD Run() override
{
CycleCollectedJSRuntime* ccrt = CycleCollectedJSRuntime::Get();
if (ccrt) {
ccrt->RunIdleTimeGCTask();
}
return NS_OK;
}
nsresult Cancel() override
{
return NS_OK;
}
};
if (Runtime()->IsIdleGCTaskNeeded()) {
nsCOMPtr<nsIRunnable> gc_task = new IdleTimeGCTaskRunnable();
NS_IdleDispatchToCurrentThread(gc_task.forget());
Runtime()->SetPendingIdleGCTask();
}
}
void
CycleCollectedJSContext::AfterProcessMicrotask(uint32_t aRecursionDepth)
{

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

@ -194,9 +194,6 @@ public:
// microtask processor entry point
void AfterProcessMicrotask();
// Check whether we need an idle GC task.
void IsIdleGCTaskNeeded();
uint32_t RecursionDepth();
// Run in stable state (call through nsContentUtils)

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

@ -510,7 +510,6 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSContext* aCx)
: mGCThingCycleCollectorGlobal(sGCThingCycleCollectorGlobal)
, mJSZoneCycleCollectorGlobal(sJSZoneCycleCollectorGlobal)
, mJSRuntime(JS_GetRuntime(aCx))
, mHasPendingIdleGCTask(false)
, mPrevGCSliceCallback(nullptr)
, mPrevGCNurseryCollectionCallback(nullptr)
, mJSHolderMap(256)

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

@ -248,32 +248,6 @@ public:
JSRuntime* Runtime() { return mJSRuntime; }
bool HasPendingIdleGCTask() const
{
// Idle GC task associates with JSRuntime.
MOZ_ASSERT_IF(mHasPendingIdleGCTask, Runtime());
return mHasPendingIdleGCTask;
}
void SetPendingIdleGCTask()
{
// Idle GC task associates with JSRuntime.
MOZ_ASSERT(Runtime());
mHasPendingIdleGCTask = true;
}
void ClearPendingIdleGCTask() { mHasPendingIdleGCTask = false; }
void RunIdleTimeGCTask()
{
if (HasPendingIdleGCTask()) {
JS::RunIdleTimeGCTask(Runtime());
ClearPendingIdleGCTask();
}
}
bool IsIdleGCTaskNeeded()
{
return !HasPendingIdleGCTask() && Runtime() && JS::IsIdleGCTaskNeeded(Runtime());
}
public:
void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer);
void RemoveJSHolder(void* aHolder);
@ -334,7 +308,6 @@ private:
JSZoneParticipant mJSZoneCycleCollectorGlobal;
JSRuntime* mJSRuntime;
bool mHasPendingIdleGCTask;
JS::GCSliceCallback mPrevGCSliceCallback;
JS::GCNurseryCollectionCallback mPrevGCNurseryCollectionCallback;