Bug 147998 - Implement JSC watchdog support for tail calls
Summary: Implement JSC watchdog support for tail calls
Status: RESOLVED DUPLICATE of bug 151972
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-13 16:07 PDT by Mark Lam
Modified: 2015-12-08 12:37 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2015-08-13 16:07:47 PDT
The existing JSC watchdog mechanism relies on the fact that no JS code can run for long before hitting a loop hint.  The only exception to that would be infinitely recursing code, but that would hit a stack overflow eventually and terminate.  With the support for tail calls added, we can now have a JS script hang by doing infinite recursion without every hitting a stack overflow.  We should teach the watchdog to handle this as well.

Fun!
Comment 1 Mark Lam 2015-08-13 16:15:28 PDT
I plan to implement this by having the watchdog timer simulate a stack overflow, and teaching the existing stack check slow path code in function prologues to discern between a stack overflow and a watchdog timer check request.

Unlike with stack overflows, the stack check slow path can return without throwing an exception.  This is because the watchdog timer firing only means that we need to check the watchdog's deadlines.  It doesn't necessarily mean that the watchdog fired.  We will only throw the TerminatedExecutionException if the watchdog deadlines have been reached.  Hence, I'll also have to teach the function prologues to not expect that the stack check slow path will throw unconditionally.
Comment 2 Mark Lam 2015-08-14 14:38:20 PDT
I spoke with Geoff offline.  Per our discussion, we won't overload the stack check.  Instead, will add a watchdog check to the tail call opcode.  The DFG and FTL can optimize these away if appropriate.
Comment 3 Mark Lam 2015-12-08 12:37:55 PST

*** This bug has been marked as a duplicate of bug 151972 ***