I don't think that's been observed, so I guess my coworker just wrote
this part of our code not knowing the frequency at which the interrupt
flag is checked. It'd kind of be nice as a user to have a guarantee,
since there's no way to know for sure that v8 is inserting those
interrupt checks, though I suppose it is indeed a pretty safe assumption
that there would be a stack check on every call. If what you say is
true, I guess we don't actually have a need for this, so thank you. (I
do still think it'd be a reasonable API to provide for e.g. recursive or
long-running host calls.)
On 4/23/26 5:00 AM, Erik Corry wrote:
The stack guard should be checked on every call and on every back edge
of a loop in JS, so it should be happening quite fast. Are you seeing
that it doesn't immediately stop when you return to JS?
On Wed, Apr 22, 2026 at 5:59 PM Noa <[email protected]> wrote:
Hi all,
I'm using `v8::Isolate::TerminateExecution` for a couple of different things,
and am trying to make sure that execution will stop as soon as possible after
it's requested. In one place, we call TerminateExecution inside of a host
function, in the context of a HandleScope, and I'd like to make sure that
execution doesn't continue in JS after that function returns (currently,
`IsExecutionTerminating() == false` directly after calling TerminateExecution).
I also want to check that there's no execution termination in-queue at the
start of the call of a host function.
Looking at the v8 source, it seems like
`v8::internal::StackGuard::HandleInterrupts` (or perhaps
`v8::internal::StackLimitCheck::HandleStackOverflowAndTerminationRequest`)
would be the ideal function to call in both of these situations, but neither
are exposed in the public API. Would it be reasonable to expose a
`v8::Isolate::HandleInterrupts` method that would forward to one of those
internal functions?
Alternatively, my first case could be fixed by a non-thread-safe
`v8::Isolate::TerminateExecutionNow`, which directly calls
`v8::internal::Isolate::TerminateExecution` (i.e,
`Throw(termination_exception)`). This would be nice to have, but not
fundamentally different from `TerminateExecution(); HandleInterrupts()`.
In any case, I'd be willing to submit a patch implementing this method, if that
would be welcomed.
Best,
Noa
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/v8-dev/d104b942-e71d-469f-893c-ad04e805ad14n%40googlegroups.com.
--
Noa, they/she
github.com/coolreader18
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/v8-dev/156c3229-b2fa-4217-b87e-8b513eb845aa%40gmail.com.