If you look into v8::internal::StackGuard::Interrupt() you will see that it actually piggy-backs on the stack overflow check. It lowers the stack limit to make sure that a stack overflow exception is triggered. When the stack overflow exception is handles it is checked whether it was actually a real stack overflow. The piggy-backing on stack overflow is also used by v8::Debug::DebugBreak() and by our thread preemption mechanism. Regards, Søren
On Mon, Dec 15, 2008 at 4:59 PM, <[email protected]> wrote: > > > Thanks for the reply. I was able to accomplish the runaway breaking > behavior for a single-threaded model by generating checks in both of > the loops, similar to how the stack overflow is checked in trunk. > > > On Dec 15, 12:52 am, Søren Gjesse <[email protected]> wrote: > > Hi, > > Calling v8::Debug::DebugBreak() from another thread than the one > currently > > running V8 will cause V8 to act as if a break point was hit and call the > > registered debug handler. The debug handle can then do debugger actions > and > > continue execution at the place of where the break occurred. This just > > pauses script execution for debugging as execution continues after the > > debugger returns control. If there is not debugger callback registered > > calling v8::Debug::DebugBreak() has no effect. > > > > There is no way to stop scripts running through the API at the moment. If > > Chrome detects a run-away script the only user option is to either kill > the > > whole page or continue execution. There is no option to just disable > > JavaScript execution - which in most cases does not make sense anyway. > You > > might be able to call v8::internal::StackGuard::Interrupt(), which is how > we > > used to support breaking execution in the JavaScript shell. It is, > > however currently not in the D8 shell. > > > > Regards, > > Søren > > > > On Sun, Dec 14, 2008 at 6:43 AM, <[email protected]> wrote: > > > > > Is DebugBreak() an effective method of breaking the execution of run- > > > away scripts? I suppose the alternative is to instrument loop > > > generators. > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
