Bug 155066 - [JSC] Improve DFG's Int32 ArithMul if one operand is a constant
Summary: [JSC] Improve DFG's Int32 ArithMul if one operand is a constant
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-05 13:18 PST by Benjamin Poulain
Modified: 2016-07-06 01:49 PDT (History)
6 users (show)

See Also:


Attachments
Patch (7.75 KB, patch)
2016-03-05 13:20 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch for landing (5.92 KB, patch)
2016-03-06 18:13 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2016-03-05 13:18:18 PST
[JSC] Improve DFG's Int32 ArithMul if one operand is a constant
Comment 1 Benjamin Poulain 2016-03-05 13:20:56 PST
Created attachment 273095 [details]
Patch
Comment 2 Benjamin Poulain 2016-03-05 13:24:03 PST
On x86:

                                                  Conf#1                    Conf#2                                      
SunSpider:
   3d-cube                                    4.8574+-0.0942     ?      4.9586+-0.4402        ? might be 1.0208x slower
   3d-morph                                   5.4292+-0.1108            5.2627+-0.1277          might be 1.0316x faster
   3d-raytrace                                5.7309+-0.0814     ?      5.7358+-0.1402        ?
   access-binary-trees                        2.1811+-0.0356     ?      2.2704+-0.1346        ? might be 1.0409x slower
   access-fannkuch                            6.0306+-0.0310     ?      6.1673+-0.1569        ? might be 1.0227x slower
   access-nbody                               2.6757+-0.0282     ?      2.7220+-0.0931        ? might be 1.0173x slower
   access-nsieve                              3.0526+-0.1448     ?      3.1037+-0.0760        ? might be 1.0168x slower
   bitops-3bit-bits-in-byte                   1.1945+-0.0199            1.1929+-0.0217        
   bitops-bits-in-byte                        3.4227+-0.1034            3.3877+-0.0882          might be 1.0103x faster
   bitops-bitwise-and                         2.0744+-0.0540     ?      2.0977+-0.0887        ? might be 1.0112x slower
   bitops-nsieve-bits                         3.0978+-0.0797            3.0790+-0.0487        
   controlflow-recursive                      2.3872+-0.0456     ?      2.3875+-0.0353        ?
   crypto-aes                                 4.0471+-0.0578     ?      4.0732+-0.1036        ?
   crypto-md5                                 2.6192+-0.0518     ?      2.6222+-0.0522        ?
   crypto-sha1                                2.4140+-0.0805            2.3640+-0.0562          might be 1.0211x faster
   date-format-tofte                          6.9142+-0.1727            6.8816+-0.2214        
   date-format-xparb                          4.9666+-0.1661     ?      4.9904+-0.2258        ?
   math-cordic                                2.9794+-0.0564            2.9450+-0.0476          might be 1.0117x faster
   math-partial-sums                          4.9584+-0.0882     ?      5.1454+-0.1990        ? might be 1.0377x slower
   math-spectral-norm                         2.0969+-0.0865            2.0386+-0.0222          might be 1.0286x faster
   regexp-dna                                 6.2249+-0.3411            6.0432+-0.0780          might be 1.0301x faster
   string-base64                              4.6161+-0.1515            4.5806+-0.1563        
   string-fasta                               5.9429+-0.0534     ?      6.0599+-0.1392        ? might be 1.0197x slower
   string-tagcloud                            8.3477+-0.3241            8.1136+-0.0791          might be 1.0289x faster
   string-unpack-code                        19.3762+-0.7380           19.3469+-0.5949        
   string-validate-input                      4.2718+-0.0704            4.2703+-0.0463        

   <arithmetic>                               4.6888+-0.0323            4.6862+-0.0348          might be 1.0006x faster

                                                  Conf#1                    Conf#2                                      
Octane:
   encrypt                                   0.16074+-0.00373          0.16054+-0.00255       
   decrypt                                   2.84634+-0.01231    ?     2.90101+-0.05048       ? might be 1.0192x slower
   deltablue                        x2       0.13985+-0.00333    ?     0.14099+-0.00498       ?
   earley                                    0.28637+-0.00466    ?     0.29061+-0.00613       ? might be 1.0148x slower
   boyer                                     4.83655+-0.14904          4.82590+-0.10295       
   navier-stokes                    x2       4.95935+-0.04868    ?     5.04649+-0.09020       ? might be 1.0176x slower
   raytrace                         x2       0.91296+-0.01631          0.90195+-0.01531         might be 1.0122x faster
   richards                         x2       0.08361+-0.00153          0.08264+-0.00172         might be 1.0118x faster
   splay                            x2       0.35900+-0.00737          0.35345+-0.00570         might be 1.0157x faster
   regexp                           x2      22.74265+-0.20699         22.61226+-0.27018       
   pdfjs                            x2      39.10015+-0.67469    ?    39.20070+-0.58727       ?
   mandreel                         x2      43.56655+-0.79587         43.51428+-0.73368       
   gbemu                            x2      25.43622+-0.68800         25.12550+-0.26923         might be 1.0124x faster
   closure                                   0.57296+-0.01032          0.57119+-0.00617       
   jquery                                    7.56814+-0.15480          7.53549+-0.15188       
   box2d                            x2       9.46705+-0.10887          9.45053+-0.18078       
   zlib                             x2     386.78442+-6.43039        382.73842+-10.62118        might be 1.0106x faster
   typescript                       x2     670.32375+-9.92398        663.69694+-7.88898       

   <geometric>                               5.31266+-0.02572          5.29786+-0.02609         might be 1.0028x faster

                                                  Conf#1                    Conf#2                                      
Kraken:
   ai-astar                                   98.730+-2.492             98.202+-1.550         
   audio-beat-detection                       48.095+-0.461             47.844+-0.747         
   audio-dft                                  98.439+-1.589      ?      98.719+-1.726         ?
   audio-fft                                  35.763+-0.031      ?      35.839+-0.112         ?
   audio-oscillator                           49.159+-0.611      ?      50.012+-1.183         ? might be 1.0173x slower
   imaging-darkroom                           60.761+-0.648      ?      61.739+-1.542         ? might be 1.0161x slower
   imaging-desaturate                         48.170+-2.823             44.998+-1.174           might be 1.0705x faster
   imaging-gaussian-blur                      69.332+-2.026             67.029+-2.817           might be 1.0343x faster
   json-parse-financial                       37.904+-0.657             37.619+-0.590         
   json-stringify-tinderbox                   25.889+-0.869             25.392+-0.641           might be 1.0196x faster
   stanford-crypto-aes                        40.299+-0.574      ?      40.782+-1.057         ? might be 1.0120x slower
   stanford-crypto-ccm                        37.424+-1.511             36.843+-1.109           might be 1.0158x faster
   stanford-crypto-pbkdf2                    102.496+-1.580            101.809+-1.012         
   stanford-crypto-sha256-iterative           39.130+-0.571      ?      39.223+-0.565         ?

   <arithmetic>                               56.542+-0.345             56.146+-0.378           might be 1.0070x faster

                                                  Conf#1                    Conf#2                                      
AsmBench:
   bigfib.cpp                               439.7751+-6.6319     ?    441.5120+-7.3034        ?
   cray.c                                   370.3835+-6.3444          369.3076+-4.2756        
   dry.c                                    438.1455+-20.7315         434.1410+-25.0515       
   FloatMM.c                                727.2488+-18.5120         717.0821+-10.0868         might be 1.0142x faster
   gcc-loops.cpp                           3769.6583+-86.5835        3717.7134+-55.0558         might be 1.0140x faster
   n-body.c                                 818.7570+-10.4321         810.6736+-4.3607        
   Quicksort.c                              406.9741+-8.7269          399.8831+-8.3981          might be 1.0177x faster
   stepanov_container.cpp                  3321.5985+-45.1519    ?   3356.6512+-81.9616       ? might be 1.0106x slower
   Towers.c                                 270.9259+-1.7801     ?    271.2108+-4.7590        ?

   <geometric>                              729.3612+-6.2916          725.1048+-5.9318          might be 1.0059x faster

                                                  Conf#1                    Conf#2                                      
Geomean of preferred means:
   <scaled-result>                           31.8351+-0.1122           31.7059+-0.0901          might be 1.0041x faster
Comment 3 Filip Pizlo 2016-03-05 13:54:05 PST
Comment on attachment 273095 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=273095&action=review

> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3682
> +    case Int32Use:
> +        if (node->child2()->isInt32Constant()) {

I think that the more canonical way to structure this control flow is:

    case Int32Use: {
        if (node->child2()->isInt32Constant()) {
            ...
            return;
        }
        ...
        return;
    }

This gets rid of an "else" clause.
Comment 4 Benjamin Poulain 2016-03-06 18:13:40 PST
Created attachment 273156 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2016-03-06 19:20:58 PST
Comment on attachment 273156 [details]
Patch for landing

Clearing flags on attachment: 273156

Committed r197655: <http://trac.webkit.org/changeset/197655>
Comment 6 WebKit Commit Bot 2016-03-06 19:21:02 PST
All reviewed patches have been landed.  Closing bug.