js/src/jit-test/tests/basic/testReallyDeepNestedExit.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.

michael@0 1 function reallyDeepNestedExit(schedule)
michael@0 2 {
michael@0 3 var c = 0, j = 0;
michael@0 4 for (var i = 0; i < 5; i++) {
michael@0 5 for (j = 0; j < 4; j++) {
michael@0 6 c += (schedule[i*4 + j] == 1) ? 1 : 2;
michael@0 7 }
michael@0 8 }
michael@0 9 return c;
michael@0 10 }
michael@0 11 function testReallyDeepNestedExit()
michael@0 12 {
michael@0 13 var c = 0;
michael@0 14 var schedule1 = new Array(5*4);
michael@0 15 var schedule2 = new Array(5*4);
michael@0 16 for (var i = 0; i < 5*4; i++) {
michael@0 17 schedule1[i] = 0;
michael@0 18 schedule2[i] = 0;
michael@0 19 }
michael@0 20 /**
michael@0 21 * First innermost compile: true branch runs through.
michael@0 22 * Second '': false branch compiles new loop edge.
michael@0 23 * First outer compile: expect true branch.
michael@0 24 * Second '': hit false branch.
michael@0 25 */
michael@0 26 schedule1[0*4 + 3] = 1;
michael@0 27 var schedules = [schedule1,
michael@0 28 schedule2,
michael@0 29 schedule1,
michael@0 30 schedule2,
michael@0 31 schedule2];
michael@0 32
michael@0 33 for (var i = 0; i < 5; i++) {
michael@0 34 c += reallyDeepNestedExit(schedules[i]);
michael@0 35 }
michael@0 36 return c;
michael@0 37 }
michael@0 38 assertEq(testReallyDeepNestedExit(), 198);

mercurial