]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/to-this-polymorphic.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / to-this-polymorphic.js
CommitLineData
81345200
A
1function foo() {
2 return this.f;
3}
4
5noInline(foo);
6
7String.prototype.f = 43;
8String.prototype.g = foo;
9Number.prototype.f = 78;
10Number.prototype.g = foo;
11
12for (var i = 0; i < 100000; ++i) {
13 var o = {f:foo};
14 var result = o.f();
15 if (result != foo)
16 throw "Error: bad object result: " + result;
17 o = "hello";
18 result = o.g();
19 if (result != 43)
20 throw "Error: bad string result: " + result;
21 o = 42;
22 result = o.g();
23 if (result != 78)
24 throw "Error: bad number result: " + result;
25}