зеркало из https://github.com/mozilla/gecko-dev.git
Bug 899361 - Make sure the JSRuntimes created for testOOM.cpp and testGCOutOfMemory.cpp have a native stack quota set. r=till
--HG-- extra : rebase_source : 8c19a3129db941c48c14fe5ef9bf882d3f231aaf
This commit is contained in:
Родитель
82031380b0
Коммит
67cfe2d626
|
@ -55,7 +55,11 @@ BEGIN_TEST(testGCOutOfMemory)
|
|||
}
|
||||
|
||||
virtual JSRuntime * createRuntime() {
|
||||
return JS_NewRuntime(768 * 1024, JS_USE_HELPER_THREADS);
|
||||
JSRuntime *rt = JS_NewRuntime(768 * 1024, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
setNativeStackQuota(rt);
|
||||
return rt;
|
||||
}
|
||||
|
||||
virtual void destroyRuntime() {
|
||||
|
|
|
@ -17,7 +17,10 @@ BEGIN_TEST(testOOM)
|
|||
virtual JSRuntime * createRuntime()
|
||||
{
|
||||
JSRuntime *rt = JS_NewRuntime(0, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
JS_SetGCParameter(rt, JSGC_MAX_BYTES, (uint32_t)-1);
|
||||
setNativeStackQuota(rt);
|
||||
return rt;
|
||||
}
|
||||
END_TEST(testOOM)
|
||||
|
|
|
@ -259,11 +259,8 @@ class JSAPITest
|
|||
|
||||
bool definePrint();
|
||||
|
||||
virtual JSRuntime * createRuntime() {
|
||||
JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
|
||||
static void setNativeStackQuota(JSRuntime *rt)
|
||||
{
|
||||
const size_t MAX_STACK_SIZE =
|
||||
/* Assume we can't use more than 5e5 bytes of C stack by default. */
|
||||
#if (defined(DEBUG) && defined(__SUNPRO_CC)) || defined(JS_CPU_SPARC)
|
||||
|
@ -278,6 +275,13 @@ class JSAPITest
|
|||
;
|
||||
|
||||
JS_SetNativeStackQuota(rt, MAX_STACK_SIZE);
|
||||
}
|
||||
|
||||
virtual JSRuntime * createRuntime() {
|
||||
JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
setNativeStackQuota(rt);
|
||||
return rt;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче