summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/invalidation
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/ion/invalidation')
-rw-r--r--js/src/jit-test/tests/ion/invalidation/easy-invalidate.js5
-rw-r--r--js/src/jit-test/tests/ion/invalidation/framedescriptors.js40
-rw-r--r--js/src/jit-test/tests/ion/invalidation/outofline.js22
-rw-r--r--js/src/jit-test/tests/ion/invalidation/recursive-invalidate.js21
4 files changed, 88 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/invalidation/easy-invalidate.js b/js/src/jit-test/tests/ion/invalidation/easy-invalidate.js
new file mode 100644
index 0000000000..ccade26dc6
--- /dev/null
+++ b/js/src/jit-test/tests/ion/invalidation/easy-invalidate.js
@@ -0,0 +1,5 @@
+// When run with eager, invalidation will be forced immediately.
+
+(function(o) {
+ o.s;
+})({});
diff --git a/js/src/jit-test/tests/ion/invalidation/framedescriptors.js b/js/src/jit-test/tests/ion/invalidation/framedescriptors.js
new file mode 100644
index 0000000000..562ddf9f66
--- /dev/null
+++ b/js/src/jit-test/tests/ion/invalidation/framedescriptors.js
@@ -0,0 +1,40 @@
+var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
+function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
+function core_md5(x, len) {
+ var a = 1732584193;
+ var b = -271733879;
+ var c = -1732584194;
+ var d = 271733878;
+ for(var i = 0; i < x.length; i += 16)
+ c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
+}
+function md5_cmn(q, a, b, x, s, t) {
+ return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
+}
+function md5_ff(a, b, c, d, x, s, t) {
+ return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+}
+function safe_add(x, y) {
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+ return (msw << 16) | (lsw & 0xFFFF);
+}
+function bit_rol(num, cnt) {
+ return (num << cnt) | (num >>> (32 - cnt));
+}
+function str2binl(str) {
+ var bin = Array();
+ var mask = (1 << chrsz) - 1;
+ for(var i = 0; i < str.length * chrsz; i += chrsz)
+ bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
+ return bin;
+}
+function binl2hex(binarray) {}
+var plainText = "Rebellious subjects, enemies to peace,\n\
+Throw your mistemper'd weapons to the ground,\n\
+To know our further pleasure in this case,\n\
+To old Free-town, our common judgment-place.\n\
+Once more, on pain of death, all men depart."
+for (var i = 0; i <4; i++)
+ plainText += plainText;
+var md5Output = hex_md5(plainText);
diff --git a/js/src/jit-test/tests/ion/invalidation/outofline.js b/js/src/jit-test/tests/ion/invalidation/outofline.js
new file mode 100644
index 0000000000..17976d752b
--- /dev/null
+++ b/js/src/jit-test/tests/ion/invalidation/outofline.js
@@ -0,0 +1,22 @@
+// Breaks with --ion -n. See bug 718122.
+
+function Foo()
+{ }
+
+Foo.prototype.bar = function(){
+ print("yes hello");
+ return 5;
+}
+
+var x = new Foo();
+
+function f(x) {
+ // Enter Ion.
+ for (var i=0; i < 41; i++);
+
+ // At this point we have no type information for the GetPropertyCache below.
+ // This causes the cache to be typed as Value.
+ x.bar();
+}
+
+f(x);
diff --git a/js/src/jit-test/tests/ion/invalidation/recursive-invalidate.js b/js/src/jit-test/tests/ion/invalidation/recursive-invalidate.js
new file mode 100644
index 0000000000..509a9992c4
--- /dev/null
+++ b/js/src/jit-test/tests/ion/invalidation/recursive-invalidate.js
@@ -0,0 +1,21 @@
+var causeOSI = true;
+
+function rec(x, self) {
+ if (x === 0 || x !== x) {
+ if (causeOSI) {
+ causeOSI = false;
+ self(NaN, self)
+ causeOSI = true;
+ }
+ return;
+ }
+ self(x - 1, self);
+}
+
+// Use enough iterations to type infer the script.
+causeOSI = false;
+for (var i = 0; i < 20; ++i)
+ rec(1, rec);
+causeOSI = true;
+
+rec(2, rec)