js/src/tests/js1_8_1/jit/regress-451974-02.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 = '';
    14 //-----------------------------------------------------------------------------
    15 test();
    16 //-----------------------------------------------------------------------------
    18 function test()
    19 {
    20   enterFunc ('test');
    21   printBugNumber(BUGNUMBER);
    22   printStatus (summary);
    24   var chars = '0123456789abcdef';
    25   var size = 10000;
    26   var mult = 1000;
    27   var densearray = [];
    28   var lsize = size;
    30   while (lsize--) 
    31   { 
    32     densearray.push(chars); 
    33   }
    35   function loop()
    36   {
    37     var start = new Date();
    39     for (var a = 0; a < mult; a++) 
    40     {
    41       var f = (function(x){}); 
    42       for (var i = 0, len = densearray.length; i < len; i++) 
    43       { 
    44         f(densearray[i]); 
    45       }
    46     }
    48     var stop = new Date();
    49     return stop - start;
    50   }
    52   jit(false);
    53   var timenonjit = loop();
    54   jit(true);
    55   var timejit = loop();
    56   jit(false);
    58   print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
    60   expect = true;
    61   actual = timejit < timenonjit/2;
    63   reportCompare(expect, actual, summary);
    65   exitFunc ('test');
    66 }

mercurial