]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/llint-put-to-scope-global-cache-watchpoint-invalidate.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / llint-put-to-scope-global-cache-watchpoint-invalidate.js
diff --git a/tests/stress/llint-put-to-scope-global-cache-watchpoint-invalidate.js b/tests/stress/llint-put-to-scope-global-cache-watchpoint-invalidate.js
new file mode 100644 (file)
index 0000000..35fe10a
--- /dev/null
@@ -0,0 +1,22 @@
+function foo(v) {
+    global = v;
+}
+
+function bar() {
+    return global;
+}
+
+noInline(foo);
+noInline(bar);
+
+var value = 42;
+foo(value);
+var n = 100000;
+var m = 100;
+for (var i = 0; i < n; ++i) {
+    if (i == n - m)
+        foo(value = 53);
+    var result = bar();
+    if (result != value)
+        throw "Error: on iteration " + i + " got: " + result;
+}