Bug 117576

Summary: The Math object should not be polymorphic
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: JavaScriptCoreAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch oliver: review+

Description Geoffrey Garen 2013-06-12 18:55:04 PDT
The Math object should not be polymorphic
Comment 1 Geoffrey Garen 2013-06-12 19:00:23 PDT
Created attachment 204552 [details]
Patch
Comment 2 Geoffrey Garen 2013-06-12 19:01:16 PDT
Benchmark report for SunSpider, V8Spider, Octane, Kraken, JSBench, JSRegress, and DSP on garen (MacPro5,1).

VMs tested:
"BASE" at /Volumes/Big/ggaren/baseline-webkit/WebKitBuild/Release/DumpRenderTree (r151529)
"PATCH" at /Volumes/Big/ggaren/ftl-webkit/WebKitBuild/Release/DumpRenderTree (r151529)

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.

                                                        BASE                     PATCH                                       
SunSpider:
   3d-cube                                         6.9991+-0.3032            6.8197+-0.3479          might be 1.0263x faster
   3d-morph                                        8.3527+-0.0712     ^      7.9616+-0.0550        ^ definitely 1.0491x faster
   3d-raytrace                                     8.8951+-0.1768            8.6686+-0.2393          might be 1.0261x faster
   access-binary-trees                             2.4808+-0.3150     ?      2.6794+-0.3819        ? might be 1.0800x slower
   access-fannkuch                                 7.3568+-0.0701     ?      7.4152+-0.0770        ?
   access-nbody                                    3.8978+-0.0526     ?      3.9243+-0.0474        ?
   access-nsieve                                   4.7610+-0.0628            4.7253+-0.0599        
   bitops-3bit-bits-in-byte                        1.7083+-0.0200     ?      1.7228+-0.0292        ?
   bitops-bits-in-byte                             6.2519+-0.0604     ?      6.2941+-0.0516        ?
   bitops-bitwise-and                              2.6169+-0.0395     ?      2.6352+-0.0414        ?
   bitops-nsieve-bits                              4.4163+-0.0165     ?      4.4756+-0.0501        ? might be 1.0134x slower
   controlflow-recursive                           2.9074+-0.1454            2.8671+-0.0896          might be 1.0141x faster
   crypto-aes                                      5.6150+-0.2921     ?      5.6730+-0.2745        ? might be 1.0103x slower
   crypto-md5                                      3.0665+-0.0907     ?      3.0793+-0.0702        ?
   crypto-sha1                                     2.8525+-0.0569            2.7591+-0.0374          might be 1.0338x faster
   date-format-tofte                              14.9790+-0.9353     ?     15.0234+-1.0384        ?
   date-format-xparb                               8.8826+-0.6562            8.7330+-0.6147          might be 1.0171x faster
   math-cordic                                     3.7240+-0.0240            3.7147+-0.0132        
   math-partial-sums                              10.0168+-0.1553            9.8626+-0.0303          might be 1.0156x faster
   math-spectral-norm                              2.7207+-0.0397            2.7201+-0.0405        
   regexp-dna                                     12.2831+-0.6124           12.2524+-0.5788        
   string-base64                                   6.0654+-0.5023            6.0057+-0.4850        
   string-fasta                                   11.0982+-0.2619           11.0202+-0.2278        
   string-tagcloud                                14.4039+-0.2209           14.3952+-0.1995        
   string-unpack-code                             30.2715+-0.5485     ?     30.6999+-0.6442        ? might be 1.0142x slower
   string-validate-input                           8.5635+-0.2414            8.5428+-0.2733        

   <arithmetic> *                                  7.5072+-0.1189            7.4873+-0.1091          might be 1.0027x faster
   <geometric>                                     5.9255+-0.0863            5.9121+-0.0717          might be 1.0023x faster
   <harmonic>                                      4.7884+-0.0716     ?      4.7952+-0.0594        ? might be 1.0014x slower

                                                        BASE                     PATCH                                       
V8Spider:
   crypto                                         78.0422+-0.4432     ?     78.1521+-0.4962        ?
   deltablue                                     103.0171+-7.1357          100.8225+-0.7147          might be 1.0218x faster
   earley-boyer                                   70.1648+-0.8430           69.5409+-0.7757        
   raytrace                                       43.3004+-5.0369     ?     43.3072+-4.8296        ?
   regexp                                         97.2794+-0.4370           97.2206+-0.3244        
   richards                                      109.0338+-0.9527          108.7302+-2.1540        
   splay                                          57.7581+-3.0958     ?     58.0636+-2.9161        ?

   <arithmetic>                                   79.7994+-1.5956           79.4053+-0.9631          might be 1.0050x faster
   <geometric> *                                  76.0318+-1.6835           75.7832+-1.2647          might be 1.0033x faster
   <harmonic>                                     71.9395+-2.0388           71.8198+-1.7505          might be 1.0017x faster

                                                        BASE                     PATCH                                       
Octane and V8v7:
   encrypt                                        0.45834+-0.00028    ?     0.45870+-0.00045       ?
   decrypt                                        8.27619+-0.00987    ?     8.28891+-0.01904       ?
   deltablue                             x2       0.58152+-0.00935          0.57798+-0.00915       
   earley                                         0.86687+-0.00458          0.86103+-0.00574       
   boyer                                         12.65223+-0.08544         12.53084+-0.10746       
   raytrace                              x2       4.27644+-0.04388          4.27362+-0.06361       
   regexp                                x2      30.07173+-0.05846    ?    30.23636+-0.18203       ?
   richards                              x2       0.29700+-0.00278    ?     0.29864+-0.00332       ?
   splay                                 x2       0.62119+-0.00519    ?     0.64181+-0.04272       ? might be 1.0332x slower
   navier-stokes                         x2      10.38257+-0.00505    ?    10.40067+-0.01470       ?
   closure                                        0.30671+-0.03901    ?     0.30839+-0.03936       ?
   jquery                                         4.46597+-0.53022    ?     4.47769+-0.51764       ?
   gbemu                                 x2     137.87103+-6.44599    ?   138.38188+-7.31860       ?
   mandreel                              x2     181.38021+-0.36514    ?   181.38151+-0.71644       ?
   pdfjs                                 x2     221.85358+-0.81649        220.88466+-0.80310       
   box2d                                 x2      33.75115+-0.29258         33.64008+-0.16609       

V8v7:
   <arithmetic>                                   7.16966+-0.01068    ?     7.18735+-0.02703       ? might be 1.0025x slower
   <geometric> *                                  2.34789+-0.00678    ?     2.35601+-0.02020       ? might be 1.0035x slower
   <harmonic>                                     0.90610+-0.00406    ?     0.91080+-0.01002       ? might be 1.0052x slower

Octane including V8v7:
   <arithmetic>                                  48.81535+-0.53607         48.78308+-0.55469         might be 1.0007x faster
   <geometric> *                                  7.39751+-0.05609    ?     7.41337+-0.08361       ? might be 1.0021x slower
   <harmonic>                                     1.21854+-0.02729    ?     1.22522+-0.03327       ? might be 1.0055x slower

                                                        BASE                     PATCH                                       
Kraken:
   ai-astar                                       500.636+-0.830      ?     501.509+-0.752         ?
   audio-beat-detection                           247.558+-2.759      ^     237.977+-0.764         ^ definitely 1.0403x faster
   audio-dft                                      297.394+-0.584            296.687+-0.409         
   audio-fft                                      141.293+-0.206      ^     138.251+-0.400         ^ definitely 1.0220x faster
   audio-oscillator                               239.815+-0.872      ^     236.472+-0.557         ^ definitely 1.0141x faster
   imaging-darkroom                               277.984+-0.421      !     279.554+-0.721         ! definitely 1.0056x slower
   imaging-desaturate                             150.844+-0.197            150.632+-0.078         
   imaging-gaussian-blur                          418.371+-0.290      ?     418.949+-1.844         ?
   json-parse-financial                            76.993+-0.182      ^      76.312+-0.182         ^ definitely 1.0089x faster
   json-stringify-tinderbox                        96.368+-0.279      ?      96.919+-0.304         ?
   stanford-crypto-aes                            103.979+-0.711            103.969+-0.409         
   stanford-crypto-ccm                             99.441+-7.253      ?     102.757+-7.329         ? might be 1.0333x slower
   stanford-crypto-pbkdf2                         265.350+-0.994      ^     262.072+-1.283         ^ definitely 1.0125x faster
   stanford-crypto-sha256-iterative               117.640+-0.625      ?     118.064+-0.515         ?

   <arithmetic> *                                 216.691+-0.527            215.723+-0.506           might be 1.0045x faster
   <geometric>                                    184.305+-0.910            183.654+-0.881           might be 1.0035x faster
   <harmonic>                                     157.884+-1.198            157.676+-1.150           might be 1.0013x faster

                                                        BASE                     PATCH                                       
JSBench:
   amazon                                          9.6667+-0.3128     ?      9.8333+-0.2473        ? might be 1.0172x slower
   facebook                                       45.0000+-1.0837           45.0000+-0.9768        
   google                                         76.7500+-1.2452           76.5000+-0.8779        
   twitter                                        20.4167+-1.4704     ?     21.3333+-1.4921        ? might be 1.0449x slower
   yahoo                                           7.0000+-0.2709            6.9167+-0.3272          might be 1.0120x faster

   <arithmetic> *                                 31.7667+-0.6633     ?     31.9167+-0.2680        ? might be 1.0047x slower
   <geometric>                                    21.6376+-0.5386     ?     21.8232+-0.2623        ? might be 1.0086x slower
   <harmonic>                                     15.0907+-0.3953     ?     15.1695+-0.3289        ? might be 1.0052x slower

                                                        BASE                     PATCH                                       
JSRegress:
   adapt-to-double-divide                         21.3873+-0.0410     ?     21.4557+-0.0455        ?
   aliased-arguments-getbyval                      0.9938+-0.0374            0.9462+-0.0299          might be 1.0503x faster
   allocate-big-object                             3.8024+-1.2864     ?      3.8289+-1.3248        ?
   arity-mismatch-inlining                         0.8124+-0.0196     ?      0.8332+-0.0280        ? might be 1.0256x slower
   array-access-polymorphic-structure              8.0899+-1.7841     ?      8.0994+-1.7983        ?
   array-nonarray-polymorhpic-access             188.0348+-3.7579          186.3077+-3.6770        
   array-with-double-add                           5.6256+-0.0562            5.6063+-0.0351        
   array-with-double-increment                     3.9105+-0.0262     ?      4.0048+-0.0825        ? might be 1.0241x slower
   array-with-double-mul-add                       7.2449+-0.0515     ?      7.2563+-0.0282        ?
   array-with-double-sum                           7.6467+-0.1391     ^      7.4265+-0.0142        ^ definitely 1.0296x faster
   array-with-int32-add-sub                        9.9902+-0.0597     ?     10.0450+-0.0231        ?
   array-with-int32-or-double-sum                  7.5450+-0.0318            7.5403+-0.0323        
   big-int-mul                                     4.6112+-0.0428     ?      4.6114+-0.0509        ?
   boolean-test                                    4.1355+-0.0308     ?      4.1437+-0.0474        ?
   branch-fold                                    15.6613+-0.0680           15.4183+-0.2578          might be 1.0158x faster
   cast-int-to-double                             13.4604+-0.0396     ?     13.5197+-0.0494        ?
   cell-argument                                  13.6243+-0.0231     ?     13.6604+-0.0218        ?
   cfg-simplify                                    3.5991+-0.0391            3.5623+-0.0085          might be 1.0103x faster
   cmpeq-obj-to-obj-other                         13.8341+-0.3669           13.4664+-0.2580          might be 1.0273x faster
   constant-test                                   8.1694+-0.0374            8.1547+-0.0518        
   direct-arguments-getbyval                       0.7406+-0.0119     !      0.7769+-0.0235        ! definitely 1.0490x slower
   double-pollution-getbyval                      10.2322+-0.0448           10.2249+-0.0379        
   double-pollution-putbyoffset                    6.2791+-0.5816            6.2599+-0.6063        
   empty-string-plus-int                          13.2319+-0.5126           13.1191+-0.6010        
   external-arguments-getbyval                     2.3097+-0.2045            2.1503+-0.1822          might be 1.0741x faster
   external-arguments-putbyval                     3.6681+-0.3275            3.5223+-0.3084          might be 1.0414x faster
   Float32Array-matrix-mult                       13.7786+-0.5272     ?     14.2005+-0.8213        ? might be 1.0306x slower
   fold-double-to-int                             20.2194+-0.0262     !     24.7994+-0.7005        ! definitely 1.2265x slower
   function-dot-apply                              2.8550+-0.0130     !      2.9300+-0.0230        ! definitely 1.0263x slower
   function-test                                   4.5477+-0.0731     ?      4.5989+-0.0829        ? might be 1.0113x slower
   get-by-id-chain-from-try-block                  6.4857+-0.1247     ?      6.6065+-0.0934        ? might be 1.0186x slower
   HashMap-put-get-iterate-keys                   80.4716+-1.2814     ^     73.8619+-1.1423        ^ definitely 1.0895x faster
   HashMap-put-get-iterate                        83.9164+-0.5552     ^     78.5512+-0.8288        ^ definitely 1.0683x faster
   HashMap-string-put-get-iterate                 73.8752+-0.6889           71.7851+-1.4092          might be 1.0291x faster
   imul-double-only                                0.2782+-0.0095     ?      0.2815+-0.0092        ? might be 1.0121x slower
   imul-int-only                                   0.2810+-0.0083     ?      0.2870+-0.0082        ? might be 1.0216x slower
   imul-mixed                                      0.2878+-0.0058     ?      0.2889+-0.0071        ?
   indexed-properties-in-objects                   3.9407+-0.0295            3.9268+-0.0067        
   inline-arguments-access                         1.3727+-0.0323     ?      1.4049+-0.0340        ? might be 1.0235x slower
   inline-arguments-local-escape                  24.2666+-0.2398           23.9844+-0.3015          might be 1.0118x faster
   inline-get-scoped-var                           6.4433+-0.0546     ?      6.4577+-0.0732        ?
   inlined-put-by-id-transition                   14.2969+-0.2204           14.1698+-0.2214        
   int-or-other-abs-then-get-by-val                8.4292+-0.0529            8.3988+-0.0313        
   int-or-other-abs-zero-then-get-by-val          34.8242+-0.0701     ?     34.9314+-0.1521        ?
   int-or-other-add-then-get-by-val                9.6831+-0.0226     ?      9.8327+-0.1506        ? might be 1.0155x slower
   int-or-other-add                               10.0285+-0.0501           10.0021+-0.0597        
   int-or-other-div-then-get-by-val                5.9379+-0.0461            5.9217+-0.0388        
   int-or-other-max-then-get-by-val                6.8973+-0.0545            6.8946+-0.0420        
   int-or-other-min-then-get-by-val                6.8865+-0.0143     ?      6.8977+-0.0323        ?
   int-or-other-mod-then-get-by-val                5.7429+-0.0283            5.7337+-0.0391        
   int-or-other-mul-then-get-by-val                6.1238+-0.0347            6.1128+-0.0500        
   int-or-other-neg-then-get-by-val                7.4912+-0.0322     ?      7.5318+-0.0675        ?
   int-or-other-neg-zero-then-get-by-val          34.8872+-0.1834     ?     35.3324+-0.6152        ? might be 1.0128x slower
   int-or-other-sub-then-get-by-val                9.6979+-0.0451            9.6894+-0.0409        
   int-or-other-sub                                7.7451+-0.0310     ?      7.7612+-0.0405        ?
   int-overflow-local                             11.2064+-0.0528           11.1561+-0.0164        
   Int16Array-bubble-sort                         94.2755+-1.6931           93.7767+-1.2190        
   Int16Array-load-int-mul                         1.8600+-0.0186     ?      1.9090+-0.0350        ? might be 1.0264x slower
   Int8Array-load                                  6.5061+-0.0610            6.4567+-0.0269        
   integer-divide                                 14.5612+-0.0289     ?     14.5791+-0.0300        ?
   integer-modulo                                  1.8699+-0.0229     ?      1.9019+-0.0252        ? might be 1.0171x slower
   make-indexed-storage                            4.2468+-0.6140            4.2362+-0.6114        
   method-on-number                               24.2399+-0.3364           23.8131+-0.1479          might be 1.0179x faster
   negative-zero-divide                            0.3235+-0.0101            0.3222+-0.0127        
   negative-zero-modulo                            0.3160+-0.0120     ?      0.3307+-0.0255        ? might be 1.0463x slower
   negative-zero-negate                            0.2992+-0.0117            0.2956+-0.0063          might be 1.0124x faster
   nested-function-parsing-random                368.9416+-11.6692    ?    373.4030+-11.0124       ? might be 1.0121x slower
   nested-function-parsing                        54.9313+-3.1723           54.8957+-3.2386        
   new-array-buffer-dead                           3.6772+-0.0848     ?      3.7164+-0.1052        ? might be 1.0107x slower
   new-array-buffer-push                          13.8055+-2.3158           12.4037+-2.3424          might be 1.1130x faster
   new-array-dead                                 26.9615+-0.0825     ?     26.9633+-0.0566        ?
   new-array-push                                 11.5011+-1.8352     ?     11.5137+-1.7983        ?
   number-test                                     4.0621+-0.0324     ?      4.0925+-0.0299        ?
   object-closure-call                             8.2380+-0.1754     !     10.9695+-1.9251        ! definitely 1.3316x slower
   object-test                                     4.4688+-0.0296            4.4193+-0.0423          might be 1.0112x faster
   poly-stricteq                                  87.9036+-0.5866     ^     86.4678+-0.4603        ^ definitely 1.0166x faster
   polymorphic-structure                          20.0117+-0.1527           19.9555+-0.1834        
   polyvariant-monomorphic-get-by-id              11.8686+-0.0291     ?     11.8974+-0.0697        ?
   rare-osr-exit-on-local                         19.0707+-0.0828           19.0498+-0.0805        
   register-pressure-from-osr                     29.8273+-0.0792     ?     29.8721+-0.0779        ?
   simple-activation-demo                         32.8762+-0.2876     ?     33.0950+-0.2822        ?
   slow-array-profile-convergence                  4.2171+-0.2445            4.1717+-0.2136          might be 1.0109x faster
   slow-convergence                                3.4445+-0.0616     ?      3.4617+-0.0567        ?
   sparse-conditional                              1.2267+-0.0281            1.2253+-0.0265        
   splice-to-remove                               48.9070+-0.7501     ^     47.4499+-0.1390        ^ definitely 1.0307x faster
   string-concat-object                            4.7962+-1.3424     ?      4.8372+-1.3586        ?
   string-concat-pair-object                       4.7803+-1.3515            4.7740+-1.3813        
   string-concat-pair-simple                      18.9302+-0.6459     ?     19.1429+-0.7021        ? might be 1.0112x slower
   string-concat-simple                           19.0452+-0.5305           19.0322+-0.4916        
   string-cons-repeat                             14.2651+-0.8958     ?     14.2810+-0.8786        ?
   string-cons-tower                              14.6724+-0.8409           14.6491+-0.8555        
   string-equality                               111.5154+-2.1951     ^     99.6235+-0.6686        ^ definitely 1.1194x faster
   string-hash                                     2.4866+-0.0333     ^      2.4425+-0.0078        ^ definitely 1.0181x faster
   string-repeat-arith                            46.0893+-0.2429     !     47.0634+-0.5247        ! definitely 1.0211x slower
   string-sub                                     89.7635+-1.2982     ?     91.4326+-2.1428        ? might be 1.0186x slower
   string-test                                     4.0297+-0.0381     ?      4.0514+-0.0327        ?
   structure-hoist-over-transitions                3.7215+-0.5904     ?      3.7391+-0.6209        ?
   tear-off-arguments-simple                       2.2065+-0.0567            2.1469+-0.0475          might be 1.0278x faster
   tear-off-arguments                              3.3256+-0.0453            3.2783+-0.0468          might be 1.0144x faster
   temporal-structure                             20.0640+-0.0975     ?     20.1285+-0.0757        ?
   to-int32-boolean                               20.7739+-0.0509     ?     20.7879+-0.0407        ?
   undefined-test                                  4.1944+-0.0185     ?      4.2030+-0.0106        ?

   <arithmetic>                                   21.2807+-0.2452           21.1032+-0.2487          might be 1.0084x faster
   <geometric> *                                   7.9629+-0.1182     ?      7.9673+-0.1157        ? might be 1.0006x slower
   <harmonic>                                      2.6583+-0.0323     ?      2.6747+-0.0251        ? might be 1.0062x slower

                                                        BASE                     PATCH                                       
DSP:
   filtrr-posterize-tint                          51.0953+-1.6954     ^     41.7866+-1.2746        ^ definitely 1.2228x faster
   filtrr-tint-contrast-sat-bright                79.2356+-1.3352     ^     68.4036+-0.3833        ^ definitely 1.1584x faster
   filtrr-tint-sat-adj-contr-mult                 96.3122+-4.9107     ^     81.1607+-4.4092        ^ definitely 1.1867x faster
   filtrr-blur-overlay-sat-contr                 221.3623+-4.0859     ^    208.3153+-4.5467        ^ definitely 1.0626x faster
   filtrr-sat-blur-mult-sharpen-contr            273.1110+-5.3634     ^    246.6976+-4.4370        ^ definitely 1.1071x faster
   filtrr-sepia-bias                              39.7671+-1.2545     ^     32.7256+-3.1302        ^ definitely 1.2152x faster
   route9-vp8                            x5     1107.6637+-5.3893     ?   1108.0560+-8.6864        ?
   starfield                             x5     1157.5269+-4.7271         1154.0246+-4.1049        
   bellard-jslinux                       x5     3035.9167+-16.3195    ?   3084.5833+-32.8582       ? might be 1.0160x slower
   zynaps-quake3                         x5     1302.2194+-15.6498    ?   1306.2599+-20.9950       ?
   zynaps-mandelbrot                     x5     1117.2992+-4.4787         1115.0208+-4.1578        
   ammojs-asm-js                         x5      243.3205+-13.3205         238.4339+-13.4732         might be 1.0205x faster
   ammojs-regular-js                     x5      234.7532+-9.9576          231.1267+-12.0002         might be 1.0157x faster

   <arithmetic>                                 1018.3995+-2.8506     ?   1021.1370+-5.5250        ? might be 1.0027x slower
   <geometric> *                                 620.7194+-7.4518          605.7849+-8.0869          might be 1.0247x faster
   <harmonic>                                    299.8736+-8.2546     ^    269.4401+-10.5573       ^ definitely 1.1130x faster

                                                        BASE                     PATCH                                       
All benchmarks:
   <arithmetic>                                  222.3552+-0.6179     ?    222.7046+-1.0179        ? might be 1.0016x slower
   <geometric>                                    22.9315+-0.2308           22.8301+-0.1910          might be 1.0044x faster
   <harmonic>                                      3.3584+-0.0437     ?      3.3758+-0.0441        ? might be 1.0052x slower

                                                        BASE                     PATCH                                       
Geomean of preferred means:
   <scaled-result>                                39.2496+-0.3696           39.0978+-0.2523          might be 1.0039x faster
Comment 3 Darin Adler 2013-06-12 19:57:23 PDT
Comment on attachment 204552 [details]
Patch

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

> Source/JavaScriptCore/runtime/JSObject.cpp:2203
> +    JSFunction* function =
> +        JSFunction::create(exec, globalObject, functionLength, name, nativeFunction, intrinsic);

Seems unhelpful to split this into two lines.
Comment 4 Geoffrey Garen 2013-06-13 08:29:56 PDT
Committed r151548: <http://trac.webkit.org/changeset/151548>