js/src/jit-test/tests/basic/testNestedExitStackOuter.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Test stack reconstruction after a nested exit
michael@0 2 function testNestedExitStackInner(j, counter) {
michael@0 3 ++counter;
michael@0 4 var b = 0;
michael@0 5 for (var i = 1; i <= 9; i++) {
michael@0 6 ++b;
michael@0 7 var a;
michael@0 8 // Make sure that once everything has been traced we suddenly switch to
michael@0 9 // a different control flow the first time we run the outermost tree,
michael@0 10 // triggering a side exit.
michael@0 11 if (j < 9)
michael@0 12 a = 1;
michael@0 13 else
michael@0 14 a = 0;
michael@0 15 ++b;
michael@0 16 b += a;
michael@0 17 }
michael@0 18 return counter + b;
michael@0 19 }
michael@0 20 function testNestedExitStackOuter() {
michael@0 21 var counter = 0;
michael@0 22 for (var j = 1; j <= 9; ++j) {
michael@0 23 for (var k = 1; k <= 9; ++k) {
michael@0 24 counter = testNestedExitStackInner(j, counter);
michael@0 25 }
michael@0 26 }
michael@0 27 return counter;
michael@0 28 }
michael@0 29 //assertEq(testNestedExitStackOuter(), 81);

mercurial