js/src/jit-test/tests/ion/bug705351.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 a = 1.1;
michael@0 2 function f1() {
michael@0 3 return a + 0.2;
michael@0 4 }
michael@0 5 function test1() {
michael@0 6 for (var i=0; i<100; i++) {
michael@0 7 assertEq(f1(), 1.3);
michael@0 8 }
michael@0 9 a = 20;
michael@0 10 assertEq(f1(), 20.2);
michael@0 11 }
michael@0 12 test1();
michael@0 13
michael@0 14 function f2(arr) {
michael@0 15 return arr[2] + 0.2;
michael@0 16 }
michael@0 17 function test2() {
michael@0 18 var a = [1.1, 2.2, 3.3, 4.4];
michael@0 19 for (var i=0; i<100; i++) {
michael@0 20 assertEq(f2(a), 3.5);
michael@0 21 }
michael@0 22 a[2] = 123;
michael@0 23 assertEq(f2(a), 123.2);
michael@0 24 }
michael@0 25 test2();
michael@0 26
michael@0 27 function f3(arr, idx) {
michael@0 28 return arr[idx] + 0.2;
michael@0 29 }
michael@0 30 function test3() {
michael@0 31 var a = [1.1, 2.2, 3.3, 4.4];
michael@0 32 for (var i=0; i<100; i++) {
michael@0 33 assertEq(f3(a, 2), 3.5);
michael@0 34 }
michael@0 35 a[2] = 123;
michael@0 36 assertEq(f3(a, 2), 123.2);
michael@0 37 }
michael@0 38 test3();

mercurial