]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/inlined-function-this-liveness.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / inlined-function-this-liveness.js
CommitLineData
81345200
A
1function bar(a, b) {
2 this.f = a.f;
3 this.g = b.f + 1;
4 return this;
5}
6
7function foo(a, b) {
8 var o = {f:bar};
9 return o.f(a, b);
10}
11
12noInline(foo);
13
14for (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
22var result = foo({f:1}, {f:2.5});
23if (result.f != 1)
24 throw "Error: bad result.f: " + result.f;
25if (result.g != 3.5)
26 throw "Error: bad result.f: " + result.g;