Bug 1037510, part 1 - Add nursery size as a parameter of CycleCollectedJSRuntime. r=khuey

This commit is contained in:
Andrew McCreight 2014-07-29 15:38:14 -07:00
parent f8c0cdd095
commit 80073f0306
4 changed files with 11 additions and 5 deletions

View File

@ -84,6 +84,9 @@ using mozilla::Preferences;
// The size of the worker runtime heaps in bytes. May be changed via pref.
#define WORKER_DEFAULT_RUNTIME_HEAPSIZE 32 * 1024 * 1024
// The size of the generational GC nursery for workers, in bytes.
#define WORKER_DEFAULT_NURSERY_SIZE JS::DefaultNurseryBytes
// The size of the worker JS allocation threshold in MB. May be changed via pref.
#define WORKER_DEFAULT_ALLOCATION_THRESHOLD 30
@ -862,7 +865,8 @@ public:
// call to JS_SetGCParameter inside CreateJSContextForWorker.
WorkerJSRuntime(JSRuntime* aParentRuntime, WorkerPrivate* aWorkerPrivate)
: CycleCollectedJSRuntime(aParentRuntime,
WORKER_DEFAULT_RUNTIME_HEAPSIZE),
WORKER_DEFAULT_RUNTIME_HEAPSIZE,
WORKER_DEFAULT_NURSERY_SIZE),
mWorkerPrivate(aWorkerPrivate)
{
}

View File

@ -3095,7 +3095,7 @@ static const JSWrapObjectCallbacks WrapObjectCallbacks = {
};
XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
: CycleCollectedJSRuntime(nullptr, JS::DefaultHeapMaxBytes),
: CycleCollectedJSRuntime(nullptr, JS::DefaultHeapMaxBytes, JS::DefaultNurseryBytes),
mJSContextStack(new XPCJSContextStack(MOZ_THIS_IN_INITIALIZER_LIST())),
mCallContext(nullptr),
mAutoRoots(nullptr),

View File

@ -467,7 +467,8 @@ NoteJSChildGrayWrapperShim(void* aData, void* aThing)
static const JSZoneParticipant sJSZoneCycleCollectorGlobal;
CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
uint32_t aMaxbytes)
uint32_t aMaxBytes,
uint32_t aMaxNurseryBytes)
: mGCThingCycleCollectorGlobal(sGCThingCycleCollectorGlobal)
, mJSZoneCycleCollectorGlobal(sJSZoneCycleCollectorGlobal)
, mJSRuntime(nullptr)
@ -477,7 +478,7 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
{
mozilla::dom::InitScriptSettings();
mJSRuntime = JS_NewRuntime(aMaxbytes, JS::DefaultNurseryBytes, aParentRuntime);
mJSRuntime = JS_NewRuntime(aMaxBytes, aMaxNurseryBytes, aParentRuntime);
if (!mJSRuntime) {
MOZ_CRASH();
}

View File

@ -114,7 +114,8 @@ class CycleCollectedJSRuntime
friend class IncrementalFinalizeRunnable;
protected:
CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
uint32_t aMaxbytes);
uint32_t aMaxBytes,
uint32_t aMaxNurseryBytes);
virtual ~CycleCollectedJSRuntime();
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;