Bug 79446 - RegExp lastIndex should behave as a regular property
Summary: RegExp lastIndex should behave as a regular property
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-23 22:47 PST by Gavin Barraclough
Modified: 2012-02-27 10:29 PST (History)
2 users (show)

See Also:


Attachments
Fix (20.26 KB, patch)
2012-02-23 22:49 PST, Gavin Barraclough
sam: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2012-02-23 22:47:04 PST
lastIndex should be a regular data descriptor, with the attributes configurable:false, enumerable:false, writable:true.
As such, it should be possible to reconfigure writable as false.  If the lastIndex property is reconfigured to be read-only, we should respect this correctly.
Comment 1 Gavin Barraclough 2012-02-23 22:49:10 PST
Created attachment 128654 [details]
Fix
Comment 2 Gavin Barraclough 2012-02-23 23:04:04 PST
No performance impact.

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.

                                               Conf#1                    Conf#2                                      
SunSpider:
   3d-cube                                 6.8111+-0.1780     ?      6.8113+-0.1999        ?
   3d-morph                               10.9236+-0.0529     !     11.1283+-0.1014        ! definitely 1.0187x slower
   3d-raytrace                             9.2228+-0.1226     ?      9.3640+-0.2049        ? might be 1.0153x slower
   access-binary-trees                     2.2318+-0.1129            2.1965+-0.1116          might be 1.0161x faster
   access-fannkuch                         8.3716+-0.0767            8.3513+-0.0736        
   access-nbody                            4.3366+-0.0204     ?      4.3618+-0.0387        ?
   access-nsieve                           3.6919+-0.0474     ?      3.7106+-0.0561        ?
   bitops-3bit-bits-in-byte                1.3252+-0.0089            1.3228+-0.0031        
   bitops-bits-in-byte                     5.3760+-0.0134            5.3730+-0.0176        
   bitops-bitwise-and                      3.6484+-0.0307     ?      3.6556+-0.0325        ?
   bitops-nsieve-bits                      6.2557+-0.0094     ?      6.2591+-0.0091        ?
   controlflow-recursive                   3.2197+-0.0311     ?      3.2210+-0.0300        ?
   crypto-aes                              9.2954+-0.1891     ?      9.4747+-0.2483        ? might be 1.0193x slower
   crypto-md5                              3.0143+-0.0496            3.0132+-0.0452        
   crypto-sha1                             2.6138+-0.0327            2.6026+-0.0228        
   date-format-tofte                      15.0003+-0.1857           14.8812+-0.1958        
   date-format-xparb                      14.8199+-0.1110           14.7790+-0.1327        
   math-cordic                             8.7902+-0.0852            8.7166+-0.0725        
   math-partial-sums                      12.0955+-0.0253     !     12.1571+-0.0206        ! definitely 1.0051x slower
   math-spectral-norm                      2.9147+-0.0107     ?      2.9253+-0.0165        ?
   regexp-dna                             12.7093+-0.2167           12.6207+-0.1546        
   string-base64                           5.7476+-0.1213     ?      5.8222+-0.1810        ? might be 1.0130x slower
   string-fasta                            8.6426+-0.1011            8.6022+-0.0977        
   string-tagcloud                        15.7174+-0.3493           15.5674+-0.1795        
   string-unpack-code                     26.3507+-0.1263     ?     26.5122+-0.1653        ?
   string-validate-input                   7.7892+-0.1489            7.7774+-0.1693        

   <arithmetic> *                          8.1121+-0.0653     ?      8.1233+-0.0530        ? might be 1.0014x slower
   <geometric>                             6.4456+-0.0580     ?      6.4518+-0.0486        ? might be 1.0010x slower
   <harmonic>                              5.0023+-0.0530            5.0004+-0.0463          might be 1.0004x faster

                                               Conf#1                    Conf#2                                      
V8:
   crypto                                 86.1056+-0.3238           85.9216+-0.3517        
   deltablue                             204.5970+-0.6370     !    208.5022+-1.5991        ! definitely 1.0191x slower
   earley-boyer                          140.3861+-1.2696          140.0453+-0.6685        
   raytrace                               71.1920+-0.3033     ^     70.5504+-0.1053        ^ definitely 1.0091x faster
   regexp                                134.7421+-0.2149     ?    134.8495+-0.3901        ?
   richards                              158.9397+-0.5501     ?    159.2791+-1.0537        ?
   splay                                  88.8850+-0.2850     ?     88.9852+-0.3304        ?

   <arithmetic>                          126.4068+-0.2742     !    126.8762+-0.1884        ! definitely 1.0037x slower
   <geometric> *                         118.8578+-0.2468     ?    119.0157+-0.1436        ? might be 1.0013x slower
   <harmonic>                            111.7551+-0.2397          111.6720+-0.1504          might be 1.0007x faster

                                               Conf#1                    Conf#2                                      
V8Real:
   encrypt                                0.50364+-0.00021    ?     0.50392+-0.00016       ?
   decrypt                                8.52085+-0.01046    ?     8.68461+-0.24005       ? might be 1.0192x slower
   deltablue                              1.22677+-0.00788    ?     1.23632+-0.00571       ?
   earley                                 3.82961+-0.02641    ?     3.83128+-0.03211       ?
   boyer                                 25.01824+-0.43295    ?    25.04744+-0.42514       ?
   raytrace                              10.66808+-0.06927         10.57299+-0.04685       
   regexp                                51.34842+-0.44470    ?    51.81961+-0.62095       ?
   richards                               0.46305+-0.00418    ?     0.47031+-0.00349       ? might be 1.0157x slower
   splay                                  1.54283+-0.10934          1.52444+-0.09144         might be 1.0121x faster

   <arithmetic>                          11.45794+-0.02470    ?    11.52121+-0.04017       ? might be 1.0055x slower
   <geometric> *                          3.87340+-0.03062    ?     3.88772+-0.02739       ? might be 1.0037x slower
   <harmonic>                             1.46404+-0.01089    ?     1.47269+-0.00906       ? might be 1.0059x slower

                                               Conf#1                    Conf#2                                      
Kraken:
   ai-astar                               561.978+-0.388      ?     564.414+-3.686         ?
   audio-beat-detection                   225.838+-0.405      ?     227.688+-2.133         ?
   audio-dft                              417.950+-2.085      ?     420.808+-6.806         ?
   audio-fft                              142.826+-0.111            142.766+-0.084         
   audio-oscillator                       369.000+-1.358            368.056+-1.292         
   imaging-darkroom                       333.088+-6.779            333.081+-6.506         
   imaging-desaturate                     254.928+-0.034      ?     255.050+-0.095         ?
   imaging-gaussian-blur                  547.193+-29.543           532.517+-1.466           might be 1.0276x faster
   json-parse-financial                    75.779+-0.078      !      76.925+-0.140         ! definitely 1.0151x slower
   json-stringify-tinderbox                92.926+-0.425             92.674+-0.341         
   stanford-crypto-aes                    134.219+-0.712      !     136.188+-0.763         ! definitely 1.0147x slower
   stanford-crypto-ccm                    128.816+-0.671            127.662+-0.620         
   stanford-crypto-pbkdf2                 237.529+-1.067      ^     232.872+-0.174         ^ definitely 1.0200x faster
   stanford-crypto-sha256-iterative       107.185+-1.276      ^     105.396+-0.167         ^ definitely 1.0170x faster

   <arithmetic> *                         259.233+-2.306            258.293+-0.684           might be 1.0036x faster
   <geometric>                            213.215+-0.938            212.808+-0.408           might be 1.0019x faster
   <harmonic>                             175.457+-0.375            175.401+-0.273           might be 1.0003x faster

                                               Conf#1                    Conf#2                                      
JSRegress:
   adapt-to-double-divide                 72.0196+-0.0603           71.9932+-0.0443        
   fold-double-to-int                     44.1317+-0.3762           44.0780+-0.7954        
   method-on-number                      248.3783+-11.0232         239.9454+-1.9886          might be 1.0351x faster

   <arithmetic>                          121.5099+-3.6319          118.6722+-0.6631          might be 1.0239x faster
   <geometric> *                          92.3725+-1.2706           91.3052+-0.5632          might be 1.0117x faster
   <harmonic>                             73.9122+-0.3915           73.6139+-0.7382          might be 1.0041x faster

                                               Conf#1                    Conf#2                                      
All benchmarks:
   <arithmetic>                           88.0114+-0.5996           87.7143+-0.1782          might be 1.0034x faster
   <geometric>                            22.1336+-0.1235     ?     22.1362+-0.0956        ? might be 1.0001x slower
   <harmonic>                              5.1176+-0.0352     ?      5.1328+-0.0314        ? might be 1.0030x slower

                                               Conf#1                    Conf#2                                      
Geomean of preferred means:
   <scaled-result>                        38.9287+-0.1882           38.8614+-0.1157          might be 1.0017x faster
Comment 3 WebKit Review Bot 2012-02-23 23:52:10 PST
Comment on attachment 128654 [details]
Fix

Attachment 128654 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11603719

New failing tests:
fast/regex/lastIndex.html
Comment 4 Sam Weinig 2012-02-24 09:13:01 PST
Comment on attachment 128654 [details]
Fix

Once again, gross. r=me
Comment 5 Gavin Barraclough 2012-02-27 10:29:21 PST
Fixed in r109008.