js/src/jit-test/tests/ion/bug774006.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1
michael@0 2 // Test IonMonkey SetElementIC when ran with --ion-eager.
michael@0 3
michael@0 4 function setelem(o, i, v) {
michael@0 5 o[i] = v;
michael@0 6 }
michael@0 7
michael@0 8 var arr = new Array();
michael@0 9 var obj = {};
michael@0 10
michael@0 11 setelem(arr, "prop0", 2);
michael@0 12 setelem(arr, 0, 2); // invalidate
michael@0 13 setelem(arr, 1, 1); // recompile with setElemIC
michael@0 14
michael@0 15 setelem(arr, 0, 0); // set known element.
michael@0 16 setelem(arr, 2, 2); // push last element.
michael@0 17 setelem(arr, 4, 4); // test out-of-bounds.
michael@0 18 setelem(arr, "prop0", 0);
michael@0 19 setelem(arr, "prop1", 1);
michael@0 20
michael@0 21 setelem(obj, "prop0", 2);
michael@0 22 setelem(obj, 0, 2);
michael@0 23 setelem(obj, 1, 1);
michael@0 24
michael@0 25 setelem(obj, 0, 0);
michael@0 26 setelem(obj, 2, 2);
michael@0 27 setelem(obj, 4, 4);
michael@0 28 setelem(obj, "prop0", 0);
michael@0 29 setelem(obj, "prop1", 1);
michael@0 30
michael@0 31 assertEq(arr.prop0, 0);
michael@0 32 assertEq(arr.prop1, 1);
michael@0 33 assertEq(arr[0], 0);
michael@0 34 assertEq(arr[1], 1);
michael@0 35 assertEq(arr[2], 2);
michael@0 36 assertEq(arr[4], 4);
michael@0 37
michael@0 38 assertEq(obj.prop0, 0);
michael@0 39 assertEq(obj.prop1, 1);
michael@0 40 assertEq(obj[0], 0);
michael@0 41 assertEq(obj[1], 1);
michael@0 42 assertEq(obj[2], 2);
michael@0 43 assertEq(obj[4], 4);

mercurial