Bug 69322

Summary: DFG should be capable of a broader range of speculations on branch and not
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 69321    
Bug Blocks:    
Attachments:
Description Flags
work in progress
none
the patch oliver: review+

Description Filip Pizlo 2011-10-04 00:04:02 PDT
The Branch and LogicalNot nodes may take any JS value.  Currently they are only capable of speculating that the value is a boolean.  But there are cases where these nodes are used for null checks, among other things.  DFG should be able to make the appropriate speculation based on the prediction of the child node.
Comment 1 Filip Pizlo 2011-10-04 01:05:06 PDT
Created attachment 109589 [details]
work in progress

This boosts V8 performance by a decent amount.


Benchmark report for SunSpider, V8, and Kraken.

VMs tested:
"TipOfTree" at /Volumes/Data/pizlo/quinary/OpenSource/WebKitBuild/Release/jsc
"BetterBranch" at /Volumes/Data/pizlo/septenary/OpenSource/WebKitBuild/Release/jsc

Collected 12 samples per benchmark/VM, with 4 VM invocations per benchmark. 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              BetterBranch                                  
SunSpider:
   3d-cube                                7.4862+-0.2303          7.4407+-0.1867       
   3d-morph                               7.4372+-0.2109          7.3692+-0.1329       
   3d-raytrace                            7.5381+-0.2667          7.5366+-0.1559       
   access-binary-trees                    1.7708+-0.0529          1.7450+-0.0765         might be 1.0148x faster
   access-fannkuch                        6.4389+-0.1258          6.3115+-0.0905         might be 1.0202x faster
   access-nbody                           3.4741+-0.0653    ?     3.5484+-0.0954       ? might be 1.0214x slower
   access-nsieve                          2.6006+-0.0750    ?     2.6779+-0.0623       ? might be 1.0297x slower
   bitops-3bit-bits-in-byte               1.7211+-0.0251          1.7178+-0.0313       
   bitops-bits-in-byte                    2.7789+-0.0697          2.6863+-0.0669         might be 1.0345x faster
   bitops-bitwise-and                     3.5273+-0.1354          3.3771+-0.1045         might be 1.0445x faster
   bitops-nsieve-bits                     5.4515+-0.1457          5.4010+-0.1522       
   controlflow-recursive                  2.0884+-0.0502          2.0741+-0.0493       
   crypto-aes                             6.6547+-0.2610          6.5233+-0.2116         might be 1.0201x faster
   crypto-md5                             2.7261+-0.0626    ?     2.7558+-0.0760       ? might be 1.0109x slower
   crypto-sha1                            2.4994+-0.0769          2.4907+-0.0650       
   date-format-tofte                      9.9591+-0.2039    ?    10.2103+-0.2621       ? might be 1.0252x slower
   date-format-xparb                      9.4223+-0.3017          9.3798+-0.2827       
   math-cordic                            6.3661+-0.0935    ?     6.5290+-0.1993       ? might be 1.0256x slower
   math-partial-sums                      7.6179+-0.1193    ?     7.6684+-0.1775       ?
   math-spectral-norm                     2.7889+-0.0816    ?     2.8738+-0.0771       ? might be 1.0304x slower
   regexp-dna                            10.8016+-0.2973    ?    10.8941+-0.2345       ?
   string-base64                          5.4812+-0.1156    ?     5.5595+-0.2529       ? might be 1.0143x slower
   string-fasta                           6.8691+-0.2140          6.6995+-0.1728         might be 1.0253x faster
   string-tagcloud                       11.7154+-0.3687    ?    11.8161+-0.3781       ?
   string-unpack-code                    21.2979+-0.4546         21.0217+-0.4061         might be 1.0131x faster
   string-validate-input                  6.6042+-0.2719          6.3652+-0.2468         might be 1.0376x faster

   <arithmetic> *                         6.2737+-0.0372          6.2567+-0.0333       
   <geometric>                            5.1451+-0.0318          5.1313+-0.0249       
   <harmonic>                             4.2180+-0.0337          4.2059+-0.0305       

                                            TipOfTree              BetterBranch                                  
V8:
   crypto                                72.0374+-0.3624    ?    72.1185+-0.3399       ?
   deltablue                            214.6783+-1.0184    ?   216.0820+-1.2420       ?
   earley-boyer                          87.7386+-0.8656    ?    88.2202+-1.4012       ?
   raytrace                              61.5332+-0.3629    ^    57.8440+-0.4749       ^ definitely 1.0638x faster
   regexp                               103.0834+-0.4982    ?   103.4798+-0.5179       ?
   richards                             185.3879+-0.5735    ?   186.2984+-0.8325       ?
   splay                                 91.3363+-0.6340         90.5186+-0.5669       

   <arithmetic>                         116.5422+-0.2563        116.3659+-0.1903       
   <geometric> *                        105.5238+-0.2539    ^   104.7846+-0.1695       ^ definitely 1.0071x faster
   <harmonic>                            96.9026+-0.2719    ^    95.6197+-0.2223       ^ definitely 1.0134x faster

                                            TipOfTree              BetterBranch                                  
Kraken:
   ai-astar                             491.9563+-4.0277    ?   492.9658+-2.1950       ?
   audio-beat-detection                 190.2766+-0.9526        189.2783+-1.2611       
   audio-dft                            270.8751+-2.6753        270.4489+-2.6225       
   audio-fft                            125.8853+-0.8666        125.3651+-0.4597       
   audio-oscillator                     246.5480+-1.7126        246.3990+-1.6485       
   imaging-darkroom                     418.2428+-1.2805    ?   420.7685+-1.8173       ?
   imaging-desaturate                   224.6155+-0.5200    !   230.8769+-0.6319       ! definitely 1.0279x slower
   imaging-gaussian-blur                581.5427+-1.2182        581.2523+-2.1482       
   json-parse-financial                  48.7181+-0.3893         48.4358+-0.3936       
   json-stringify-tinderbox              68.1482+-0.2456    ^    67.6601+-0.2085       ^ definitely 1.0072x faster
   stanford-crypto-aes                  130.5927+-1.3596        129.1095+-1.3129         might be 1.0115x faster
   stanford-crypto-ccm                  101.0150+-0.6277    ?   101.9456+-1.5832       ?
   stanford-crypto-pbkdf2               192.8562+-1.5205        192.3827+-1.4093       
   stanford-crypto-sha256-iterative      74.6896+-0.2253    ?    77.4587+-2.8886       ? might be 1.0371x slower

   <arithmetic> *                       226.1401+-0.6133    ?   226.7391+-0.6994       ?
   <geometric>                          175.8822+-0.4818    ?   176.3939+-0.7048       ?
   <harmonic>                           136.0794+-0.4157    ?   136.4451+-0.7318       ?

                                            TipOfTree              BetterBranch                                  
All benchmarks:
   <arithmetic>                          88.1888+-0.1780    ?    88.3315+-0.2029       ?
   <geometric>                           23.1031+-0.0880         23.0647+-0.0682       
   <harmonic>                             7.4143+-0.0578          7.3928+-0.0523       

                                            TipOfTree              BetterBranch                                  
Geomean of preferred means:
   <scaled-result>                       53.0982+-0.1242         52.9724+-0.0768
Comment 2 Filip Pizlo 2011-10-04 17:15:39 PDT
Created attachment 109721 [details]
the patch

Updated performance after merging.


Benchmark report for SunSpider, V8, and Kraken.

VMs tested:
"TipOfTree" at /Volumes/Data/pizlo/quinary/OpenSource/WebKitBuild/Release/jsc
"BetterBranch" at /Volumes/Data/pizlo/septenary/OpenSource/WebKitBuild/Release/jsc

Collected 12 samples per benchmark/VM, with 4 VM invocations per benchmark. 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              BetterBranch                                  
SunSpider:
   3d-cube                                7.4812+-0.1460    ?     7.5067+-0.1737       ?
   3d-morph                               7.3919+-0.1335          7.3708+-0.1453       
   3d-raytrace                            7.5996+-0.1626    ?     7.7081+-0.1909       ? might be 1.0143x slower
   access-binary-trees                    1.7566+-0.0562          1.7154+-0.0455         might be 1.0240x faster
   access-fannkuch                        6.3631+-0.0820    ?     6.3847+-0.1062       ?
   access-nbody                           3.6076+-0.0756          3.5630+-0.0802         might be 1.0125x faster
   access-nsieve                          2.7525+-0.1543          2.5887+-0.0714         might be 1.0633x faster
   bitops-3bit-bits-in-byte               1.7318+-0.0244          1.7168+-0.0479       
   bitops-bits-in-byte                    2.7818+-0.0539          2.7355+-0.0740         might be 1.0169x faster
   bitops-bitwise-and                     3.4696+-0.0807    ?     3.9148+-0.5005       ? might be 1.1283x slower
   bitops-nsieve-bits                     5.4481+-0.0925          5.4103+-0.1025       
   controlflow-recursive                  2.0624+-0.0400          2.0529+-0.0372       
   crypto-aes                             6.4679+-0.1676    ?     6.5114+-0.1765       ?
   crypto-md5                             2.7490+-0.0700    ?     2.8099+-0.0835       ? might be 1.0222x slower
   crypto-sha1                            2.4743+-0.0590          2.4562+-0.0486       
   date-format-tofte                     10.1093+-0.2269          9.8557+-0.1560         might be 1.0257x faster
   date-format-xparb                      9.5077+-0.2055          9.2729+-0.1515         might be 1.0253x faster
   math-cordic                            6.3826+-0.1270          6.3111+-0.1125         might be 1.0113x faster
   math-partial-sums                      7.6905+-0.1866          7.4815+-0.1294         might be 1.0279x faster
   math-spectral-norm                     2.7907+-0.0630    ?     2.8314+-0.0866       ? might be 1.0146x slower
   regexp-dna                            10.7219+-0.2144         10.7126+-0.1027       
   string-base64                          5.5707+-0.1089          5.4329+-0.0964         might be 1.0254x faster
   string-fasta                           6.5750+-0.1426    ?     6.6665+-0.1379       ? might be 1.0139x slower
   string-tagcloud                       11.6204+-0.1419    ?    11.8170+-0.1822       ? might be 1.0169x slower
   string-unpack-code                    21.1400+-0.3545         20.9919+-0.2841       
   string-validate-input                  6.2364+-0.1875    ?     6.2398+-0.1595       ?

   <arithmetic> *                         6.2493+-0.0159          6.2330+-0.0383       
   <geometric>                            5.1367+-0.0177          5.1242+-0.0332       
   <harmonic>                             4.2210+-0.0260          4.2030+-0.0362       

                                            TipOfTree              BetterBranch                                  
V8:
   crypto                                72.8145+-0.5199         72.6473+-0.4037       
   deltablue                            214.1124+-1.0016    !   217.9888+-1.8622       ! definitely 1.0181x slower
   earley-boyer                          88.2514+-0.5703    ^    87.2301+-0.2962       ^ definitely 1.0117x faster
   raytrace                              62.1892+-0.5513    ^    58.1012+-0.4594       ^ definitely 1.0704x faster
   regexp                               102.9545+-0.5633    ?   104.1702+-0.7198       ? might be 1.0118x slower
   richards                             187.3573+-0.4727    ?   188.5787+-0.8794       ?
   splay                                 90.9779+-0.8013         90.6149+-1.0160       

   <arithmetic>                         116.9510+-0.1704    ?   117.0473+-0.2610       ?
   <geometric> *                        105.9743+-0.1602    ^   105.2228+-0.1759       ^ definitely 1.0071x faster
   <harmonic>                            97.4046+-0.1800    ^    95.9244+-0.2019       ^ definitely 1.0154x faster

                                            TipOfTree              BetterBranch                                  
Kraken:
   ai-astar                             495.4805+-2.3816    !   502.2475+-3.9661       ! definitely 1.0137x slower
   audio-beat-detection                 190.5182+-0.9920    ?   191.6489+-1.1051       ?
   audio-dft                            270.7026+-2.4880        269.3619+-3.1474       
   audio-fft                            125.9513+-0.6101    ?   126.4527+-0.9342       ?
   audio-oscillator                     247.7809+-1.8248        247.3469+-1.9099       
   imaging-darkroom                     427.8471+-7.5061        426.0058+-2.2012       
   imaging-desaturate                   225.0271+-1.6814    !   232.7494+-1.0558       ! definitely 1.0343x slower
   imaging-gaussian-blur                585.0237+-2.6857        583.4547+-3.3415       
   json-parse-financial                  49.2309+-0.2701    ^    48.5261+-0.4178       ^ definitely 1.0145x faster
   json-stringify-tinderbox              68.9585+-0.7374    ?    70.1904+-1.0000       ? might be 1.0179x slower
   stanford-crypto-aes                  130.2263+-1.5949    ?   132.4506+-1.9081       ? might be 1.0171x slower
   stanford-crypto-ccm                  100.7143+-0.7437    !   103.0105+-1.1431       ! definitely 1.0228x slower
   stanford-crypto-pbkdf2               190.2549+-1.9168    ?   190.8994+-2.4199       ?
   stanford-crypto-sha256-iterative      76.2882+-1.1701         75.8700+-1.1122       

   <arithmetic> *                       227.4289+-0.7199    ?   228.5868+-0.4489       ?
   <geometric>                          176.7279+-0.5544    !   177.7903+-0.3950       ! definitely 1.0060x slower
   <harmonic>                           136.9439+-0.4958    ?   137.5425+-0.4616       ?

                                            TipOfTree              BetterBranch                                  
All benchmarks:
   <arithmetic>                          88.6201+-0.2244    !    88.9703+-0.1221       ! definitely 1.0040x slower
   <geometric>                           23.1301+-0.0572         23.1154+-0.0733       
   <harmonic>                             7.4206+-0.0446          7.3890+-0.0619       

                                            TipOfTree              BetterBranch                                  
Geomean of preferred means:
   <scaled-result>                       53.2057+-0.0926         53.1228+-0.0961
Comment 3 Filip Pizlo 2011-10-05 14:35:57 PDT
Landed in r96750.