зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
89e731c043
Коммит
eaf4a57860
|
@ -107,8 +107,6 @@ class CompileOrDecodeTask : public mozilla::Task {
|
||||||
void Cancel();
|
void Cancel();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static constexpr size_t kDefaultStackQuota = 128 * sizeof(size_t) * 1024;
|
|
||||||
|
|
||||||
// This mutex is locked during running the task or cancelling task.
|
// This mutex is locked during running the task or cancelling task.
|
||||||
mozilla::Mutex mMutex;
|
mozilla::Mutex mMutex;
|
||||||
|
|
||||||
|
|
|
@ -1827,8 +1827,16 @@ class ScriptOrModuleCompileTask final : public CompileOrDecodeTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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() {
|
already_AddRefed<JS::Stencil> Compile() {
|
||||||
JS::SetNativeStackQuota(mFrontendContext, kDefaultStackQuota);
|
size_t stackSize = TaskController::GetThreadStackSize();
|
||||||
|
JS::SetNativeStackQuota(mFrontendContext,
|
||||||
|
ThreadStackQuotaForSize(stackSize));
|
||||||
|
|
||||||
JS::CompilationStorage compileStorage;
|
JS::CompilationStorage compileStorage;
|
||||||
auto compile = [&](auto& source) {
|
auto compile = [&](auto& source) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче