js/src/jit-test/tests/basic/testSlowArrayPopNestedTrees.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 // Same thing but nested trees, each reconstructing one or more stack frames
michael@0 2 // (so, several functions with loops, such that the loops end up being
michael@0 3 // nested though they are not lexically nested)
michael@0 4
michael@0 5 function testSlowArrayPopNestedTrees() {
michael@0 6 var a = [];
michael@0 7 for (var i = 0; i < 9; i++)
michael@0 8 a[i] = [0];
michael@0 9 a[8].__defineGetter__("0", function () { return 3.14159 });
michael@0 10
michael@0 11 function child(a, i, j, k) {
michael@0 12 var last = 2.71828;
michael@0 13 for (var l = 0; l < 9; l++)
michael@0 14 if (i == 8 && j == 8 && k == 8)
michael@0 15 last = a[l].pop(); // reenters interpreter in getter
michael@0 16 return last;
michael@0 17 }
michael@0 18 function parent(a, i, j) {
michael@0 19 var last;
michael@0 20 for (var k = 0; k < 9; k++)
michael@0 21 last = child(a, i, j, k);
michael@0 22 return last;
michael@0 23 }
michael@0 24 function gramps(a, i) {
michael@0 25 var last;
michael@0 26 for (var j = 0; j < 9; j++)
michael@0 27 last = parent(a, i, j);
michael@0 28 return last;
michael@0 29 }
michael@0 30
michael@0 31 var last;
michael@0 32 for (var i = 0; i < 9; i++)
michael@0 33 last = gramps(a, i);
michael@0 34 return last;
michael@0 35 }
michael@0 36 assertEq(testSlowArrayPopNestedTrees(), 3.14159);

mercurial