js/src/devtools/jint/sunspider/controlflow-recursive.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 // The Computer Language Shootout
     2 // http://shootout.alioth.debian.org/
     3 // contributed by Isaac Gouy
     5 function ack(m,n){
     6    if (m==0) { return n+1; }
     7    if (n==0) { return ack(m-1,1); }
     8    return ack(m-1, ack(m,n-1) );
     9 }
    11 function fib(n) {
    12     if (n < 2){ return 1; }
    13     return fib(n-2) + fib(n-1);
    14 }
    16 function tak(x,y,z) {
    17     if (y >= x) return z;
    18     return tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y));
    19 }
    21 /* BEGIN LOOP */
    22 for ( var i = 3; i <= 5; i++ ) {
    23     ack(3,i);
    24     fib(17.0+i);
    25     tak(3*i+3,2*i+2,i+1);
    26 }
    27 /* END LOOP */

mercurial