Hi Martin, you are not missing anything. Currently, using a separate process that you can kill if your JavaScript enters an infinite loop or otherwise takes too much time is the only way to go. We are considering adding a way of terminating V8 execution from the side (which would lead to throwing a thread termination exception which cannot be caught by JavaScript try catch handlers), but it is not there yet.
Cheers, -- Mads On Thu, Jul 23, 2009 at 10:12 AM, Martin Lemke<[email protected]> wrote: > > I would like to monitor the execution of the script in v8, > interrupting it if the execution takes an excessive amount of time, > e.g. as a result of an endless loop. If you are familiar, SpiderMonkey > JS engine has JS_SetOperationCallback (JS_SetBranchCallback) API which > can be adopted for that purpose. > > From what I learned about v8, the only way would be to run an instance > of the v8 interpreter in a separate process, monitor it externally and > terminate the process when I decide that the processing takes too much > time. > > I hoped that SetCounterFunction and SetCreateHistogramFunction may > help but apparently they do not cover the execution stage, or at least > they do not produce anything if I am inside an endless loop which > doesn't affect the garbage collection. > > Could be that I missed something? Is there a better way to monitor the > time of the execution and interrupt it when necessary? > > Thanks, > Martin > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
