]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/tier-up-in-loop-with-cfg-simplification.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / tier-up-in-loop-with-cfg-simplification.js
diff --git a/tests/stress/tier-up-in-loop-with-cfg-simplification.js b/tests/stress/tier-up-in-loop-with-cfg-simplification.js
new file mode 100644 (file)
index 0000000..874904b
--- /dev/null
@@ -0,0 +1,24 @@
+var False = false;
+
+function foo(p, array) {
+    var result = 0;
+    var i = 0;
+    if (array.length) {
+        if (p) {
+        } else {
+            return;
+        }
+        do {
+            result += array[i++];
+        } while (False);
+    }
+    return result;
+}
+
+noInline(foo);
+
+for (var i = 0; i < 1000000; ++i) {
+    var result = foo(true, [42]);
+    if (result != 42)
+        throw "Error: bad result: " + result;
+}