LibJS: Mark stack overflow exception code path as [[unlikely]]

This is supposed to be exceedingly rare, so a great candidate for
[[unlikely]] annotation.
This commit is contained in:
Andreas Kling 2025-04-28 01:55:08 +02:00 committed by Tim Flynn
commit 6ec4d0f5ba
Notes: github-actions[bot] 2025-04-28 14:40:51 +00:00

View file

@ -112,8 +112,9 @@ public:
ThrowCompletionOr<void> push_execution_context(ExecutionContext& context, CheckStackSpaceLimitTag)
{
// Ensure we got some stack space left, so the next function call doesn't kill us.
if (did_reach_stack_space_limit())
if (did_reach_stack_space_limit()) [[unlikely]] {
return throw_completion<InternalError>(ErrorType::CallStackSizeExceeded);
}
push_execution_context(context);
return {};
}