]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/no-abc-skippy-loop.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / no-abc-skippy-loop.js
diff --git a/tests/stress/no-abc-skippy-loop.js b/tests/stress/no-abc-skippy-loop.js
new file mode 100644 (file)
index 0000000..67d867e
--- /dev/null
@@ -0,0 +1,24 @@
+function foo(array) {
+    var result = 0;
+    for (var i = 0; i != array.length; i += 2) {
+        var element = array[i];
+        if (element === void 0)
+            break;
+        result += array[i];
+    }
+    return result;
+}
+
+noInline(foo);
+
+var array = [1, 2, 3, 4];
+for (var i = 0; i < 10000; ++i) {
+    var result = foo(array);
+    if (result != 4)
+        throw "Error: bad result in loop: " + result;
+}
+
+var array = [1, 2, 3];
+var result = foo(array);
+if (result != 4)
+    throw "Error: bad result at end: " + result;