Bug 70578

Summary: DFG should not try to predict argument types by looking at the values of argument registers at the time of compilation
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 69996    
Attachments:
Description Flags
the patch oliver: review+

Description Filip Pizlo 2011-10-20 20:58:46 PDT
DFG is invoked from loops or when a function returns.  By that point, the registers holding arguments may hold a different value than what the arguments would have held at the prologue.  Hence it is unprofitable to try to augment argument predictions by looking at argument registers at time of compilation.

This is also an opportunity to kill some code.
Comment 1 Filip Pizlo 2011-10-20 21:00:45 PDT
Created attachment 111892 [details]
the patch
Comment 2 Filip Pizlo 2011-10-20 21:02:15 PDT
This blocks https://bugs.webkit.org/show_bug.cgi?id=69996 in the sense that inlining reveals some bugs in trying to read argument registers during return.  I don't want to fix those bugs, since this code is pointless anyway.
Comment 3 Oliver Hunt 2011-10-20 21:04:13 PDT
Comment on attachment 111892 [details]
the patch

Any perf impact?
Comment 4 Filip Pizlo 2011-10-20 21:09:51 PDT
(In reply to comment #3)
> (From update of attachment 111892 [details])
> Any perf impact?

None whatsover. :-)
Comment 5 Filip Pizlo 2011-10-20 21:16:33 PDT
Benchmark report for SunSpider, V8, and Kraken.

VMs tested:
"TipOfTree" at /Volumes/Data/pizlo/quinary/OpenSource/WebKitBuild/Release/jsc
"NoCompTimeArgs" at /Volumes/Data/pizlo/senary/OpenSource/WebKitBuild/Release/jsc

Collected 12 samples per benchmark/VM, with 4 VM invocations per benchmark. Emitted a call to gc() between sample
measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the jsc-specific preciseTime()
function to get microsecond-level timing. Reporting benchmark execution times with 95% confidence intervals in
milliseconds.

                                            TipOfTree             NoCompTimeArgs                                 
SunSpider:
   3d-cube                                7.3723+-0.1421          7.3718+-0.1683       
   3d-morph                               7.5918+-0.1756    ?     7.6909+-0.1443       ? might be 1.0130x slower
   3d-raytrace                            7.4912+-0.1396    ?     7.5606+-0.1668       ?
   access-binary-trees                    1.6921+-0.0328    ?     1.7380+-0.0622       ? might be 1.0271x slower
   access-fannkuch                        6.5964+-0.1435          6.4074+-0.1125         might be 1.0295x faster
   access-nbody                           3.3254+-0.0996    ?     3.3516+-0.0844       ?
   access-nsieve                          2.5642+-0.0691          2.5588+-0.0626       
   bitops-3bit-bits-in-byte               1.7538+-0.0365    ?     1.7549+-0.0348       ?
   bitops-bits-in-byte                    2.7935+-0.0715          2.7635+-0.0485         might be 1.0109x faster
   bitops-bitwise-and                     3.4800+-0.0846          3.4311+-0.1203         might be 1.0143x faster
   bitops-nsieve-bits                     5.4330+-0.1049    ?     5.6038+-0.1305       ? might be 1.0314x slower
   controlflow-recursive                  2.1088+-0.0302          2.0993+-0.0372       
   crypto-aes                             6.7030+-0.1589    ?     6.7458+-0.1328       ?
   crypto-md5                             2.8391+-0.0752          2.8132+-0.0666       
   crypto-sha1                            2.5540+-0.0592          2.4981+-0.0651         might be 1.0224x faster
   date-format-tofte                      9.9222+-0.1246    ?    10.2834+-0.6119       ? might be 1.0364x slower
   date-format-xparb                      8.8578+-0.1634    ?     8.9056+-0.1820       ?
   math-cordic                            6.3843+-0.1158    ?     6.4119+-0.0593       ?
   math-partial-sums                      7.6487+-0.1453    ?     7.6995+-0.1202       ?
   math-spectral-norm                     2.9134+-0.0943          2.8859+-0.0645       
   regexp-dna                            11.4696+-0.1283    ?    11.6820+-0.2139       ? might be 1.0185x slower
   string-base64                          4.4170+-0.0872          4.3391+-0.0614         might be 1.0180x faster
   string-fasta                           6.4018+-0.1135          6.3781+-0.1241       
   string-tagcloud                       11.4927+-0.2361    ?    11.5964+-0.2181       ?
   string-unpack-code                    20.5333+-0.3631         20.1617+-0.1621         might be 1.0184x faster
   string-validate-input                  5.2815+-0.0860          5.2707+-0.0874       

   <arithmetic> *                         6.1393+-0.0354    ?     6.1540+-0.0280       ?
   <geometric>                            5.0460+-0.0270    ?     5.0513+-0.0221       ?
   <harmonic>                             4.1623+-0.0263          4.1611+-0.0291       

                                            TipOfTree             NoCompTimeArgs                                 
V8:
   crypto                                72.9880+-0.3284    ?    73.0395+-0.3671       ?
   deltablue                            223.6140+-1.4193    ?   225.3372+-1.1424       ?
   earley-boyer                          91.8322+-1.7376    ?    92.5651+-1.9726       ?
   raytrace                              58.4976+-0.9168    ?    58.7943+-0.7432       ?
   regexp                               106.2676+-0.3634    ?   107.4226+-0.9603       ? might be 1.0109x slower
   richards                             182.5372+-0.5436    !   184.3530+-0.2627       ! definitely 1.0099x slower
   splay                                 97.2508+-0.6331         96.4778+-0.4111       

   <arithmetic>                         118.9982+-0.4084    ?   119.7128+-0.3716       ?
   <geometric> *                        107.4427+-0.4634    ?   107.9671+-0.4743       ?
   <harmonic>                            98.1164+-0.5333    ?    98.5162+-0.5509       ?

                                            TipOfTree             NoCompTimeArgs                                 
Kraken:
   ai-astar                             502.6183+-3.6015    ?   506.2388+-4.7345       ?
   audio-beat-detection                 192.8065+-0.8792    ?   193.9236+-1.3722       ?
   audio-dft                            272.8947+-1.8728        272.4993+-3.5137       
   audio-fft                            125.4737+-0.6517    ?   126.1636+-1.0248       ?
   audio-oscillator                     255.4600+-1.6487        255.3413+-1.9681       
   imaging-darkroom                     422.4700+-0.4584    ^   419.7746+-1.4165       ^ definitely 1.0064x faster
   imaging-desaturate                   221.6168+-0.4444        221.3184+-0.8106       
   imaging-gaussian-blur                562.8225+-0.9280    ?   563.5646+-1.4490       ?
   json-parse-financial                  57.5406+-0.4912         57.4979+-0.2811       
   json-stringify-tinderbox              68.5846+-0.3008    ?    68.7109+-0.3577       ?
   stanford-crypto-aes                  133.2974+-2.0460    ?   134.2106+-1.9429       ?
   stanford-crypto-ccm                  102.7151+-0.7707        101.8204+-0.5318       
   stanford-crypto-pbkdf2               195.1052+-1.2864    !   198.6756+-2.0544       ! definitely 1.0183x slower
   stanford-crypto-sha256-iterative      71.6124+-0.2288    ?    71.8927+-0.6898       ?

   <arithmetic> *                       227.5013+-0.4851    ?   227.9737+-0.7908       ?
   <geometric>                          178.6384+-0.4575    ?   179.0348+-0.5937       ?
   <harmonic>                           140.4540+-0.4462    ?   140.7147+-0.4567       ?

                                            TipOfTree             NoCompTimeArgs                                 
All benchmarks:
   <arithmetic>                          88.8857+-0.1819    ?    89.1410+-0.2656       ?
   <geometric>                           23.0240+-0.0935    ?    23.0693+-0.0827       ?
   <harmonic>                             7.3236+-0.0456          7.3221+-0.0503       

                                            TipOfTree             NoCompTimeArgs                                 
Geomean of preferred means:
   <scaled-result>                       53.1401+-0.1801    ?    53.3057+-0.1747       ?
Comment 6 Filip Pizlo 2011-10-21 01:21:16 PDT
Landed in http://trac.webkit.org/changeset/98082