]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/infer-constant-global-property.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / infer-constant-global-property.js
1 function foo(p) {
2 if (p)
3 Math = {sin: function() { return 42; }, PI: 43, abs: Math.abs};
4 }
5
6 noInline(foo);
7
8 (function() {
9 var n = 100000;
10 var m = 100;
11 var result = 0;
12 for (var i = 0; i < n; ++i) {
13 foo(i == n - m);
14 result += Math.sin(Math.PI);
15 }
16 if (Math.abs(result - m * 42) > 1e-8)
17 throw "Error: bad result: " + result;
18 })();