зеркало из https://github.com/mozilla/gecko-dev.git
Bug 613551 - "JSGC_MAX_MALLOC_BYTES is too large on mobile" [r=jst] a=blocking-fennec
--HG-- extra : rebase_source : 5899ff657273a08bed317edadc3eeab090d94208
This commit is contained in:
Родитель
027a7ceb1f
Коммит
ff569fdddb
|
@ -4004,26 +4004,24 @@ ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
|
|||
static int
|
||||
SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||
{
|
||||
PRInt32 highwatermark = nsContentUtils::GetIntPref(aPrefName, 32);
|
||||
PRInt32 highwatermark = nsContentUtils::GetIntPref(aPrefName, 128);
|
||||
|
||||
if (highwatermark >= 32) {
|
||||
/*
|
||||
* There are two ways to allocate memory in SpiderMonkey. One is
|
||||
* to use jsmalloc() and the other is to use GC-owned memory
|
||||
* (e.g. js_NewGCThing()).
|
||||
*
|
||||
* In the browser, we don't cap the amount of GC-owned memory.
|
||||
*/
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_MALLOC_BYTES,
|
||||
128L * 1024L * 1024L);
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES,
|
||||
0xffffffff);
|
||||
} else {
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_MALLOC_BYTES,
|
||||
highwatermark * 1024L * 1024L);
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES,
|
||||
highwatermark * 1024L * 1024L);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||
{
|
||||
PRUint32 max = nsContentUtils::GetIntPref(aPrefName, -1);
|
||||
if (max == -1UL)
|
||||
max = 0xffffffff;
|
||||
else
|
||||
max = max * 1024L * 1024L;
|
||||
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES,
|
||||
max);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4161,6 +4159,12 @@ nsJSRuntime::Init()
|
|||
SetMemoryHighWaterMarkPrefChangedCallback("javascript.options.mem.high_water_mark",
|
||||
nsnull);
|
||||
|
||||
nsContentUtils::RegisterPrefCallback("javascript.options.mem.max",
|
||||
SetMemoryMaxPrefChangedCallback,
|
||||
nsnull);
|
||||
SetMemoryMaxPrefChangedCallback("javascript.options.mem.max",
|
||||
nsnull);
|
||||
|
||||
nsContentUtils::RegisterPrefCallback("javascript.options.mem.gc_frequency",
|
||||
SetMemoryGCFrequencyPrefChangedCallback,
|
||||
nsnull);
|
||||
|
|
Загрузка…
Ссылка в новой задаче