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