Bug 1853480 - Part 1: Use TaskController thread stack size as JS stack quota in ScriptLoader off-thread compilation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D188556
This commit is contained in:
@@ -1827,8 +1827,16 @@ class ScriptOrModuleCompileTask final : public CompileOrDecodeTask {
|
||||
}
|
||||
|
||||
private:
|
||||
static size_t ThreadStackQuotaForSize(size_t size) {
|
||||
// Set the stack quota to 10% less that the actual size.
|
||||
// NOTE: This follows what JS helper thread does.
|
||||
return size_t(double(size) * 0.9);
|
||||
}
|
||||
|
||||
already_AddRefed<JS::Stencil> Compile() {
|
||||
JS::SetNativeStackQuota(mFrontendContext, kDefaultStackQuota);
|
||||
size_t stackSize = TaskController::GetThreadStackSize();
|
||||
JS::SetNativeStackQuota(mFrontendContext,
|
||||
ThreadStackQuotaForSize(stackSize));
|
||||
|
||||
JS::CompilationStorage compileStorage;
|
||||
auto compile = [&](auto& source) {
|
||||
|
||||
Reference in New Issue
Block a user