summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/entryOverflowBailout.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/ion/entryOverflowBailout.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/ion/entryOverflowBailout.js')
-rw-r--r--js/src/jit-test/tests/ion/entryOverflowBailout.js220
1 files changed, 220 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/entryOverflowBailout.js b/js/src/jit-test/tests/ion/entryOverflowBailout.js
new file mode 100644
index 000000000..ee628ac91
--- /dev/null
+++ b/js/src/jit-test/tests/ion/entryOverflowBailout.js
@@ -0,0 +1,220 @@
+var o;
+var f1;
+var counter = 0;
+
+function f2(a) {
+ bailout();
+ return f2.arguments;
+};
+
+var restartCode = "counter = 0; " + f2.toSource();
+
+// We need to reevaluate this function everytime, otherwise it is flagged as
+// having an argument object and it would not be re-entered.
+
+// This test case is checking that f.arguments reflects the overflow or the
+// underflow of arguments after a bailout. Due to the way bailouts are
+// recovered we need to check for the intial frame and for any other JS frame
+// below.
+//
+// To produce a JSFrame, we need to avoid the 'Hot' counters of f1 to be the
+// same as f2, because IonMonkey will try to inline f2 in f1, and not
+// compiling/calling f2 separately. This explain why we ignore the 5 first call
+// of f1 by returning immediately.
+//
+// Bailouts are caused by calling an object function, which is expected to be a
+// function by IonMonkey. So bailout() cause a bailout in the currently
+// compiled function.
+//
+// To avoid any preventive effect to re-enter f2, we re-evaluate it before every
+// test.
+
+// Check bailouts of the initial frame.
+
+eval(restartCode);
+while (counter++ < 50) {
+ o = f2();
+ assertEq(o.length, 0);
+}
+
+eval(restartCode);
+while (counter++ < 50) {
+ o = f2(21);
+ assertEq(o.length, 1);
+ assertEq(o[0], 21);
+}
+
+eval(restartCode);
+while (counter++ < 50) {
+ o = f2(21,42);
+ assertEq(o.length, 2);
+ assertEq(o[0], 21);
+ assertEq(o[1], 42);
+}
+
+// 100 arguments.
+eval(restartCode);
+while (counter++ < 50) {
+ o = f2(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9);
+ assertEq(o.length, 100);
+ for (var i in o)
+ assertEq(o[i], i % 10);
+}
+
+// 200 arguments.
+eval(restartCode);
+while (counter++ < 50) {
+ o = f2(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9);
+ assertEq(o.length, 200);
+ for (var i in o)
+ assertEq(o[i], i % 10);
+}
+
+// 300 arguments.
+eval(restartCode);
+while (counter++ < 50) {
+ o = f2(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9);
+ assertEq(o.length, 300);
+ for (var i in o)
+ assertEq(o[i], i % 10);
+}
+
+// Check bailouts of one frame which is not the initial frame.
+
+eval(restartCode);
+f1 = function() {
+ if (counter < 5) return 0;
+ return f2();
+};
+while (counter++ < 50) {
+ o = f1();
+ if (counter < 5) continue;
+ assertEq(o.length, 0);
+}
+
+eval(restartCode);
+f1 = function() {
+ if (counter < 5) return 0;
+ return f2(21);
+};
+while (counter++ < 50) {
+ o = f1();
+ if (counter < 5) continue;
+ assertEq(o.length, 1);
+ assertEq(o[0], 21);
+}
+
+eval(restartCode);
+f1 = function() {
+ if (counter < 5) return 0;
+ return f2(21,42);
+};
+while (counter++ < 50) {
+ o = f1();
+ if (counter < 5) continue;
+ assertEq(o.length, 2);
+ assertEq(o[0], 21);
+ assertEq(o[1], 42);
+}
+
+// 100 arguments.
+eval(restartCode);
+f1 = function() {
+ if (counter < 5) return 0;
+ return f2(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9);
+};
+while (counter++ < 50) {
+ o = f1();
+ if (counter < 5) continue;
+ assertEq(o.length, 100);
+ for (var i in o)
+ assertEq(o[i], i % 10);
+}
+
+// 200 arguments.
+eval(restartCode);
+f1 = function() {
+ if (counter < 5) return 0;
+ return f2(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9);
+};
+while (counter++ < 50) {
+ o = f1();
+ if (counter < 5) continue;
+ assertEq(o.length, 200);
+ for (var i in o)
+ assertEq(o[i], i % 10);
+}
+
+// 300 arguments.
+eval(restartCode);
+f1 = function() {
+ if (counter < 5) return 0;
+ return f2(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
+ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9);
+};
+while (counter++ < 500) {
+ o = f1();
+ if (counter < 5) continue;
+ assertEq(o.length, 300);
+ for (var i in o)
+ assertEq(o[i], i % 10);
+}