js/src/tests/js1_8_1/jit/regress-451974-01.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // |reftest| skip -- bogus perf test (bug 540512)
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 451974;
     9 var summary = 'TM: loops with anon functions should not be slower with jit enabled';
    10 var actual = '';
    11 var expect = '';
    13 printBugNumber(BUGNUMBER);
    14 printStatus (summary);
    16 var chars = '0123456789abcdef';
    17 var size = 10000;
    18 var mult = 1000;
    19 var densearray = [];
    20 var lsize = size;
    22 while (lsize--) 
    23 { 
    24   densearray.push(chars); 
    25 }
    27 function loop()
    28 {
    29   var start = new Date();
    31   for (var a = 0; a < mult; a++) 
    32   {
    33     var f = (function(x){}); 
    34     for (var i = 0, len = densearray.length; i < len; i++) 
    35     { 
    36       f(densearray[i]); 
    37     }
    38   }
    40   var stop = new Date();
    41   return stop - start;
    42 }
    44 jit(false);
    45 var timenonjit = loop();
    46 jit(true);
    47 var timejit = loop();
    48 jit(false);
    50 print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
    52 expect = true;
    53 actual = timejit < timenonjit/2;
    55 reportCompare(expect, actual, summary);

mercurial