X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/tests/stress/jit-cache-poly-replace-then-cache-get-and-fold-then-invalidate.js?ds=inline diff --git a/tests/stress/jit-cache-poly-replace-then-cache-get-and-fold-then-invalidate.js b/tests/stress/jit-cache-poly-replace-then-cache-get-and-fold-then-invalidate.js new file mode 100644 index 0000000..3d488a5 --- /dev/null +++ b/tests/stress/jit-cache-poly-replace-then-cache-get-and-fold-then-invalidate.js @@ -0,0 +1,33 @@ +var o = {f:42}; + +function foo(p, o, v) { + if (p) + o.f = v; +} + +function bar() { + return o.f; +} + +noInline(foo); +noInline(bar); + +for (var i = 0; i < 10; ++i) + foo(false); + +for (var i = 0; i < 10; ++i) + foo(true, {}, 42); + +for (var i = 0; i < 10; ++i) + foo(true, o, 42); + +for (var i = 0; i < 100000; ++i) { + var result = bar(); + if (result != 42) + throw "Error: bad result: " + result; +} + +foo(true, o, 53); +var result = bar(); +if (result != 53) + throw "Error: bad result at end: " + result;