]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/simple-polyvariant-call-inlining-example.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / simple-polyvariant-call-inlining-example.js
diff --git a/tests/stress/simple-polyvariant-call-inlining-example.js b/tests/stress/simple-polyvariant-call-inlining-example.js
new file mode 100644 (file)
index 0000000..633b276
--- /dev/null
@@ -0,0 +1,32 @@
+function foo(baz) {
+    return bar(baz);
+}
+
+function fuzz(baz) {
+    return bar(baz);
+}
+
+function bar(baz) {
+    return baz();
+}
+
+function baz1() {
+    return 42;
+}
+
+function baz2() {
+    return 24;
+}
+
+noInline(foo);
+noInline(fuzz);
+
+for (var i = 0; i < 100000; ++i) {
+    var result = foo(baz1);
+    if (result != 42)
+        throw "Error: bad result: " + result;
+    var result = fuzz(baz2);
+    if (result != 24)
+        throw "Error: bad result: " + result;
+}
+