js/src/jit-test/tests/baseline/setcall.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 var calls = 0;
michael@0 2 function g() {
michael@0 3 calls++;
michael@0 4 };
michael@0 5 function test1() {
michael@0 6 for (var i=0; i<20; i++) {
michael@0 7 if (i > 18)
michael@0 8 g() = 2;
michael@0 9 }
michael@0 10 }
michael@0 11 try {
michael@0 12 test1();
michael@0 13 assertEq(0, 1);
michael@0 14 } catch(e) {
michael@0 15 assertEq(e instanceof ReferenceError, true);
michael@0 16 }
michael@0 17
michael@0 18 assertEq(calls, 1);
michael@0 19
michael@0 20 function test2() {
michael@0 21 for (var i=0; i<20; i++) {
michael@0 22 if (i > 18)
michael@0 23 g()++;
michael@0 24 }
michael@0 25 }
michael@0 26 try {
michael@0 27 test2();
michael@0 28 assertEq(0, 1);
michael@0 29 } catch(e) {
michael@0 30 assertEq(e instanceof ReferenceError, true);
michael@0 31 }
michael@0 32 assertEq(calls, 2);
michael@0 33
michael@0 34 function test3() {
michael@0 35 var v1, v2, v3;
michael@0 36 var z = [1, 2, 3];
michael@0 37 for (var i=0; i<15; i++) {
michael@0 38 if (i > 12)
michael@0 39 [v1, v2, g(), v3] = z
michael@0 40 }
michael@0 41 }
michael@0 42 try {
michael@0 43 test3();
michael@0 44 assertEq(0, 1);
michael@0 45 } catch(e) {
michael@0 46 assertEq(e instanceof ReferenceError, true);
michael@0 47 }
michael@0 48 assertEq(calls, 3);
michael@0 49
michael@0 50 function test4() {
michael@0 51 for (var i=0; i<20; i++) {
michael@0 52 if (i > 18)
michael@0 53 g() >>= 2;
michael@0 54 }
michael@0 55 }
michael@0 56 try {
michael@0 57 test4();
michael@0 58 assertEq(0, 1);
michael@0 59 } catch(e) {
michael@0 60 assertEq(e instanceof ReferenceError, true);
michael@0 61 }
michael@0 62
michael@0 63 assertEq(calls, 4);

mercurial