[Webkit-unassigned] [Bug 74170] New: DFG's interpretation of rare case profiles should be frequency-based not count-based

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 8 23:44:28 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=74170

           Summary: DFG's interpretation of rare case profiles should be
                    frequency-based not count-based
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: fpizlo at apple.com


Consider the following code:

function foo(...) {
    a = b / c; // b and c are integers, but b / c returns a fractional number
    for (var i = 0; i < 100000; ++i) { ... }
}

This will get optimized while in the loop, so the rare case counter for b / c will be 1 - not enough to force b / c to be a double division.  foo() will then fail speculation the next time it is called, but even then, the rare case counter will just be at 2 - still not enough.  The threshold is currently around 100 before b / c would be viewed by the DFG as a double division - but in this case, that won't happen for a very long time, so the loop will never benefit from DFG optimization due to this one overzealous speculation.

The solution is to decide b / c is double based on the frequency of slow path execution, rather than the absolute count of how many times it was taken.  This requires knowing the total number of times that an instruction executed, which in turn requires a bit more profiling in the old JIT.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list