]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/strict-to-this-int.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / strict-to-this-int.js
1 function foo(a, b) {
2 var result = a + b;
3 if (result)
4 return (a + b) + result + this;
5 else
6 return this.f;
7 }
8
9 noInline(foo);
10
11 var x;
12 Number.prototype.valueOf = function() { return x; };
13
14 function test(this_, a, b, x_) {
15 x = x_;
16 var result = foo.call(this_, a, b);
17 if (result != (a + b) * 2 + x_)
18 throw "Error: bad result: " + result;
19 }
20
21 for (var i = 0; i < 100000; ++i)
22 test(5, 1, 2, 100);
23
24 test(5, 2000000000, 2000000000, 1);
25 test(5, 1073741774, 1073741774, 1000);