WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
41765
JavaScriptCore C API should have a notification mechanism to facilitate long-running scripts
https://bugs.webkit.org/show_bug.cgi?id=41765
Summary
JavaScriptCore C API should have a notification mechanism to facilitate long-...
Kent Hansen
Reported
2010-07-07 07:08:48 PDT
For a long-running script, JSEvaluateScript() will eventually throw a timeout error. There's no way to control how long should pass before the script times out. There's no way to receive notifications while the script is running (e.g. whether it should be aborted or not). It would be nice to be able install a callback that the runtime would invoke, say, every N milliseconds to query whether evaluation should be aborted.
Attachments
Add attachment
proposed patch, testcase, etc.
Gavin Barraclough
Comment 1
2012-03-13 13:25:48 PDT
I think the key question here would be whether we want this to be push or pull – whether JSC should be responsible for yielding after a period of execution, or whether there should be the ability to message JSC asynchronously to request a callback be made. The latter might be be more useful in a shell debugger (e.g. to handle ctrl-C), and may or may not also be useful for a profiler (depending on how close to the point a signal is received we'd be able to handle it). It is also possible that we could support both, and it is possible the two mechanisms might not be unrelated.
Gavin Barraclough
Comment 2
2012-03-13 13:26:00 PDT
***
Bug 24478
has been marked as a duplicate of this bug. ***
Andy Wingo
Comment 3
2012-03-21 09:15:37 PDT
FWIW what V8 does is to insert stack-bounds checks at function calls and backwards branches. The stack limit is read from the heap. If the stack pointer is beyond the limit, the code executes some trap handler. The code is in a known safe place, suitable to throw exceptions or do OSR. Timeouts and asynchronous interrupts set various state flags, then reset the stack limit so that the next limit check invokes the handler.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug