зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1341326 - Set stack limit and stack size properly for helper threads, r=jandem.
This commit is contained in:
Родитель
3afb565f72
Коммит
c6152d786f
|
@ -0,0 +1,15 @@
|
|||
if (helperThreadCount() == 0)
|
||||
quit();
|
||||
function eval(source) {
|
||||
offThreadCompileModule(source);
|
||||
}
|
||||
var N = 10000;
|
||||
var left = repeat_str('(1&', N);
|
||||
var right = repeat_str(')', N);
|
||||
var str = 'actual = '.concat(left, '1', right, ';');
|
||||
eval(str);
|
||||
function repeat_str(str, repeat_count) {
|
||||
var arr = new Array(--repeat_count);
|
||||
while (repeat_count != 0) arr[--repeat_count] = str;
|
||||
return str.concat.apply(str, arr);
|
||||
}
|
|
@ -78,6 +78,7 @@ js::Thread::Thread(Thread&& aOther)
|
|||
{
|
||||
id_ = aOther.id_;
|
||||
aOther.id_ = Id();
|
||||
options_ = aOther.options_;
|
||||
}
|
||||
|
||||
js::Thread&
|
||||
|
@ -86,6 +87,7 @@ js::Thread::operator=(Thread&& aOther)
|
|||
MOZ_RELEASE_ASSERT(!joinable());
|
||||
id_ = aOther.id_;
|
||||
aOther.id_ = Id();
|
||||
options_ = aOther.options_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ js::Thread::Thread(Thread&& aOther)
|
|||
{
|
||||
id_ = aOther.id_;
|
||||
aOther.id_ = Id();
|
||||
options_ = aOther.options_;
|
||||
}
|
||||
|
||||
js::Thread&
|
||||
|
@ -67,6 +68,7 @@ js::Thread::operator=(Thread&& aOther)
|
|||
MOZ_RELEASE_ASSERT(!joinable());
|
||||
id_ = aOther.id_;
|
||||
aOther.id_ = Id();
|
||||
options_ = aOther.options_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1663,7 +1663,7 @@ JSContext::addPendingOutOfMemory()
|
|||
}
|
||||
|
||||
void
|
||||
HelperThread::handleParseWorkload(AutoLockHelperThreadState& locked, uintptr_t stackLimit)
|
||||
HelperThread::handleParseWorkload(AutoLockHelperThreadState& locked)
|
||||
{
|
||||
MOZ_ASSERT(HelperThreadState().canStartParseTask(locked));
|
||||
MOZ_ASSERT(idle());
|
||||
|
@ -1903,14 +1903,7 @@ HelperThread::threadLoop()
|
|||
oomUnsafe.crash("HelperThread cx.init()");
|
||||
}
|
||||
cx.setHelperThread(this);
|
||||
|
||||
// Compute the thread's stack limit, for over-recursed checks.
|
||||
uintptr_t stackLimit = GetNativeStackBase();
|
||||
#if JS_STACK_GROWTH_DIRECTION > 0
|
||||
stackLimit += HELPER_STACK_QUOTA;
|
||||
#else
|
||||
stackLimit -= HELPER_STACK_QUOTA;
|
||||
#endif
|
||||
JS_SetNativeStackQuota(&cx, HELPER_STACK_QUOTA);
|
||||
|
||||
while (true) {
|
||||
MOZ_ASSERT(idle());
|
||||
|
@ -1946,7 +1939,7 @@ HelperThread::threadLoop()
|
|||
handlePromiseTaskWorkload(lock);
|
||||
} else if (HelperThreadState().canStartParseTask(lock)) {
|
||||
js::oom::SetThreadType(js::oom::THREAD_TYPE_PARSE);
|
||||
handleParseWorkload(lock, stackLimit);
|
||||
handleParseWorkload(lock);
|
||||
} else if (HelperThreadState().canStartCompressionTask(lock)) {
|
||||
js::oom::SetThreadType(js::oom::THREAD_TYPE_COMPRESS);
|
||||
handleCompressionWorkload(lock);
|
||||
|
|
|
@ -384,7 +384,7 @@ struct HelperThread
|
|||
void handleWasmWorkload(AutoLockHelperThreadState& locked);
|
||||
void handlePromiseTaskWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleIonWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleParseWorkload(AutoLockHelperThreadState& locked, uintptr_t stackLimit);
|
||||
void handleParseWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleCompressionWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleGCHelperWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleGCParallelWorkload(AutoLockHelperThreadState& locked);
|
||||
|
|
Загрузка…
Ссылка в новой задаче