js/src/jit-test/tests/jaeger/loops/hoist-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 function foo(x, n) {
     2   for (var i = 0; i < n; i++)
     3     x[i] = i;
     4   var q = 0;
     5   for (var i = 0; i < 10; i++) {
     6     for (var j = 0; j < n; j++)
     7       q += x[j];
     8   }
     9   return q;
    10 }
    12 var a = foo([], 100);
    13 assertEq(a, 49500);
    15 function basic1(x) {
    16   var q = 0;
    17   for (var i = 0; i < 4; i++)
    18     q += x[i];
    19   return q;
    20 }
    22 var b = basic1([1,2,3,4]);
    23 assertEq(b, 10);
    25 ARRAY = [1,2,3,4];
    27 function basic2() {
    28   var q = 0;
    29   for (var i = 0; i < 4; i++)
    30     q += ARRAY[i];
    31   return q;
    32 }
    34 var c = basic2();
    35 assertEq(c, 10);

mercurial