Status: New
Owner: ----

New issue 2361 by [email protected]: Ability to stop unrolling stack upon TerminateException()
http://code.google.com/p/v8/issues/detail?id=2361

TerminateExecution() can be used to stop execution of a script stuck in an infinite loop. The way that TerminateExecution() is currently implemented means that the application embedding V8 can not call 'script->Run()' and decide to handle the termination and either throw a catchable exception or continue execution if there are still JS stack frames left to unwind.

Use case: In Node, there will always be more stack frames above the desired boundary because all of Node is itself implemented in JS. I desire to modify the 'vm.runIn*Context()' functions to take a timeout parameter and if the timeout expires, that 'vm.runIn*Context()' call should throw an exception, even though there will be other JS frames in the stack. The timeout is implemented using TerminateExecution(), which forces the entire stack to unwind, preventing the Node implementation from handling the termination correctly at the 'vm.runIn*Context()' boundary.

This was discussed here: https://gist.github.com/3879707

Feature Request: I desire the ability for the C++ code embedding the engine to completely handle TerminateExecution() at any 'script->Run()' boundary, even when there are remaining JS frames on the stack. The C++ code calling 'script->Run()' can swallow the termination at that point and continue calling into the engine.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to