Closed Bug 1781255 Opened 2 years ago Closed 2 years ago

Directly pass the stack limit from GlobalHelperThreadState to AutoCheckRecursionLimit

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(2 files, 1 obsolete file)

The helper thread's stack quota is passed from embedding, and stored into GlobalHelperThreadState.stackQuota:

https://searchfox.org/mozilla-central/rev/d5edb4a4538657b7d691a41c00e6796a19ade6e7/js/src/vm/HelperThreads.cpp#155-157,165

void GlobalHelperThreadState::setDispatchTaskCallback(
    JS::HelperThreadTaskCallback callback, size_t threadCount, size_t stackSize,
    const AutoLockHelperThreadState& lock) {
...
  this->stackQuota = ThreadStackQuotaForSize(stackSize);

And then set to RootingContext::nativeStackLimit:

https://searchfox.org/mozilla-central/rev/d5edb4a4538657b7d691a41c00e6796a19ade6e7/js/src/vm/HelperThreads.cpp#508-510,516

AutoSetHelperThreadContext::AutoSetHelperThreadContext(
    const JS::ContextOptions& options, AutoLockHelperThreadState& lock)
    : lock(lock) {
...
  JS_SetNativeStackQuota(cx, HelperThreadState().stackQuota);

and used by AutoCheckRecursionLimit

https://searchfox.org/mozilla-central/rev/d5edb4a4538657b7d691a41c00e6796a19ade6e7/js/public/friend/StackLimits.h#136-138

MOZ_ALWAYS_INLINE uintptr_t AutoCheckRecursionLimit::getStackLimitHelper(
    JSContext* cx, JS::StackKind kind, int extraAllowance) const {
  uintptr_t limit = JS::RootingContext::get(cx)->nativeStackLimit[kind];

Bug 1781008 patch will make AutoCheckRecursionLimit possible to directly receive the stack limit.
After that, we should directly pass the limit from GlobalHelperThreadState

Depends on: 1781641
Blocks: 1782704
Blocks: 1782705
Blocks: 1782706

Comment on attachment 9287208 [details]
Bug 1781255 - Part 3: Do not set JSContext::nativeStackBase_ in helper thread. r?bthrall!

Revision D152857 was moved to bug 1782706. Setting attachment 9287208 [details] to obsolete.

Attachment #9287208 - Attachment is obsolete: true
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/ee33ca7b2fc9
Part 1: Add JS::NativeStackLimit parameter to compilation functions. r=bthrall
https://hg.mozilla.org/integration/autoland/rev/bb102b309f93
Part 2: Add {ParseTask,DelazifyTask}::stackLimit and directly pass it to compilation. r=bthrall
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: