Bug 152255

Summary: We should not employ the snippet code in the DFG if no OSR exit was previously encountered.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, keith_miller, msaboff, saam
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch.
saam: review+
x86_64 benchmark result. none

Description Mark Lam 2015-12-14 09:27:05 PST
We already tried to do this but was doing it wrong.  The is what we do now:

     if (Node::shouldSpeculateUntypedForArithmetic(leftChild.node(), rightChild.node())
         || m_graph.hasExitSite(node->origin.semantic, BadType)) {
         fixEdge<UntypedUse>(leftChild);
         fixEdge<UntypedUse>(rightChild);
         ...

The || should be a &&.  We only want to employ the snippet code if we have actually encountered an OSR exit due to untyped operands not being supported.
Comment 1 Mark Lam 2015-12-14 09:29:59 PST
Created attachment 267301 [details]
proposed patch.
Comment 2 Mark Lam 2015-12-14 09:33:12 PST
Created attachment 267302 [details]
x86_64 benchmark result.
Comment 3 Mark Lam 2015-12-14 09:33:58 PST
With this change, we see the following progression in JSRegress:

   arguments-out-of-bounds                           12.9152+-1.3205     ^     10.2297+-0.3642        ^ definitely 1.2625x faster
Comment 4 Saam Barati 2015-12-14 11:35:48 PST
Comment on attachment 267301 [details]
proposed patch.

r=me
Comment 5 Mark Lam 2015-12-14 11:41:04 PST
Thanks for the review.  Landed in r194040: <http://trac.webkit.org/r194040>.
Comment 6 Filip Pizlo 2015-12-14 11:52:59 PST
Comment on attachment 267301 [details]
proposed patch.

This is the wrong policy.  We usually only rely on exit sites as a last resort.

Why did you do this?
Comment 7 Mark Lam 2015-12-14 11:54:46 PST
(In reply to comment #6)
> Comment on attachment 267301 [details]
> proposed patch.
> 
> This is the wrong policy.  We usually only rely on exit sites as a last
> resort.
> 
> Why did you do this?

This was suggested by Geoff, and was implemented this way since the first op_sub snippet.  The only issue was that I had a bug in how I implemented it.