Bug 1038274 - Really fix previous problem with landing r=me

This commit is contained in:
Jon Coppeard 2014-07-16 12:04:33 +01:00
Родитель 2ed8ff7bfc
Коммит e02ddd1af3
3 изменённых файлов: 11 добавлений и 5 удалений

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

@ -103,9 +103,6 @@ const uint32_t DefaultNurseryBytes = 16 * 1024 * 1024;
/* Default maximum heap size in bytes to pass to JS_NewRuntime(). */
const uint32_t DefaultHeapMaxBytes = 32 * 1024 * 1024;
/* Value indicating no maximum heap size to pass to JS_NewRuntime(). */
const uint32_t UnlimitedHeapMaxBytes = 0xffffffff;
/*
* We cannot expose the class hierarchy: the implementation is hidden. Instead
* we provide cast functions with strong debug-mode assertions.

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

@ -6419,7 +6419,7 @@ main(int argc, char **argv, char **envp)
#endif
/* Use the same parameters as the browser in xpcjsruntime.cpp. */
rt = JS_NewRuntime(JS::UnlimitedHeapMaxBytes, nurseryBytes);
rt = JS_NewRuntime(JS::DefaultHeapMaxBytes, nurseryBytes);
if (!rt)
return 1;
@ -6429,6 +6429,7 @@ main(int argc, char **argv, char **envp)
gInterruptFunc.construct(rt, NullValue());
JS_SetGCParameter(rt, JSGC_MAX_BYTES, 0xffffffff);
#ifdef JSGC_GENERATIONAL
Maybe<JS::AutoDisableGenerationalGC> noggc;
if (op.getBoolOption("no-ggc"))

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

@ -3069,7 +3069,7 @@ static const JSWrapObjectCallbacks WrapObjectCallbacks = {
};
XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
: CycleCollectedJSRuntime(nullptr, JS::UnlimitedHeapMaxBytes),
: CycleCollectedJSRuntime(nullptr, JS::DefaultHeapMaxBytes),
mJSContextStack(new XPCJSContextStack(MOZ_THIS_IN_INITIALIZER_LIST())),
mCallContext(nullptr),
mAutoRoots(nullptr),
@ -3108,6 +3108,14 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
memset(rtPrivate, 0, sizeof(PerThreadAtomCache));
JS_SetRuntimePrivate(runtime, rtPrivate);
// Unconstrain the runtime's threshold on nominal heap size, to avoid
// triggering GC too often if operating continuously near an arbitrary
// finite threshold (0xffffffff is infinity for uint32_t parameters).
// This leaves the maximum-JS_malloc-bytes threshold still in effect
// to cause period, and we hope hygienic, last-ditch GCs from within
// the GC's allocator.
JS_SetGCParameter(runtime, JSGC_MAX_BYTES, 0xffffffff);
// The JS engine permits us to set different stack limits for system code,
// trusted script, and untrusted script. We have tests that ensure that
// we can always execute 10 "heavy" (eval+with) stack frames deeper in