]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/inlined-function-this-liveness.js
5d667c6e35873b61d0dd2ae4fed74a13f8d9f3e4
[apple/javascriptcore.git] / tests / stress / inlined-function-this-liveness.js
1 function bar(a, b) {
2 this.f = a.f;
3 this.g = b.f + 1;
4 return this;
5 }
6
7 function foo(a, b) {
8 var o = {f:bar};
9 return o.f(a, b);
10 }
11
12 noInline(foo);
13
14 for (var i = 0; i < 100000; ++i) {
15 var result = foo({f:1}, {f:2});
16 if (result.f != 1)
17 throw "Error: bad result.f: " + result.f;
18 if (result.g != 3)
19 throw "Error: bad result.g: " + result.g;
20 }
21
22 var result = foo({f:1}, {f:2.5});
23 if (result.f != 1)
24 throw "Error: bad result.f: " + result.f;
25 if (result.g != 3.5)
26 throw "Error: bad result.f: " + result.g;