Bug 995679 - Test for length-inlining code invalidation on ArrayBuffer neutering. r=sfink
authorJeff Walden <jwalden@mit.edu>
Thu, 24 Apr 2014 22:33:13 -0600
changeset 210061 119a19ebe6d3e927c58d8807bf56f719e3832ab2
parent 210060 9ffc95fd87d3e8adbb33b3ea168d563f1085073e
child 210062 58f5bf899265f9055f7b78dfc46538504ffbcd5f
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssfink
bugs995679
milestone35.0a1
Bug 995679 - Test for length-inlining code invalidation on ArrayBuffer neutering. r=sfink
js/src/jit-test/tests/ion/inlining/typedarray-length-inlining-neuter.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/inlining/typedarray-length-inlining-neuter.js
@@ -0,0 +1,42 @@
+var INLINE_INT8_AMOUNT = 4;
+var OUT_OF_LINE_INT8_AMOUNT = 237;
+
+// Small and inline
+
+// Neutering and replacing data.
+var ab1 = new ArrayBuffer(INLINE_INT8_AMOUNT);
+var ta1 = new Int8Array(ab1);
+function q1() { return ta1.length; }
+q1();
+q1();
+neuter(ab1, "change-data");
+assertEq(q1(), 0);
+
+// Neutering preserving data pointer.
+var ab2 = new ArrayBuffer(INLINE_INT8_AMOUNT);
+var ta2 = new Int8Array(ab2);
+function q2() { return ta2.length; }
+q2();
+q2();
+neuter(ab2, "same-data");
+assertEq(q2(), 0);
+
+// Large and out-of-line
+
+// Neutering and replacing data.
+var ab3 = new ArrayBuffer(OUT_OF_LINE_INT8_AMOUNT);
+var ta3 = new Int8Array(ab3);
+function q3() { return ta3.length; }
+q3();
+q3();
+neuter(ab3, "change-data");
+assertEq(q3(), 0);
+
+// Neutering preserving data pointer.
+var ab4 = new ArrayBuffer(OUT_OF_LINE_INT8_AMOUNT);
+var ta4 = new Int8Array(ab4);
+function q4() { return ta4.length; }
+q4();
+q4();
+neuter(ab4, "same-data");
+assertEq(q4(), 0);