зеркало из https://github.com/mozilla/pjs.git
Bug 623105 - Back out 350fa5d366df on suspicion of breaking regress-290575.js on 64-bit, a=bustage
This commit is contained in:
Родитель
7c571ea308
Коммит
513a7b023a
|
@ -4004,19 +4004,26 @@ ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||||
static int
|
static int
|
||||||
SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
|
SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||||
{
|
{
|
||||||
PRInt32 highwatermark = nsContentUtils::GetIntPref(aPrefName, 80);
|
PRInt32 highwatermark = nsContentUtils::GetIntPref(aPrefName, 32);
|
||||||
|
|
||||||
|
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,
|
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_MALLOC_BYTES,
|
||||||
highwatermark * 1024L * 1024L);
|
highwatermark * 1024L * 1024L);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
|
|
||||||
{
|
|
||||||
PRInt32 max = nsContentUtils::GetIntPref(aPrefName, -1);
|
|
||||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES,
|
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES,
|
||||||
max * 1024L * 1024L);
|
highwatermark * 1024L * 1024L);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4154,12 +4161,6 @@ nsJSRuntime::Init()
|
||||||
SetMemoryHighWaterMarkPrefChangedCallback("javascript.options.mem.high_water_mark",
|
SetMemoryHighWaterMarkPrefChangedCallback("javascript.options.mem.high_water_mark",
|
||||||
nsnull);
|
nsnull);
|
||||||
|
|
||||||
nsContentUtils::RegisterPrefCallback("javascript.options.mem.max",
|
|
||||||
SetMemoryMaxPrefChangedCallback,
|
|
||||||
nsnull);
|
|
||||||
SetMemoryMaxPrefChangedCallback("javascript.options.mem.max",
|
|
||||||
nsnull);
|
|
||||||
|
|
||||||
nsContentUtils::RegisterPrefCallback("javascript.options.mem.gc_frequency",
|
nsContentUtils::RegisterPrefCallback("javascript.options.mem.gc_frequency",
|
||||||
SetMemoryGCFrequencyPrefChangedCallback,
|
SetMemoryGCFrequencyPrefChangedCallback,
|
||||||
nsnull);
|
nsnull);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче