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