]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/invalidation-point.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / invalidation-point.js
CommitLineData
81345200
A
1function foo(o, p) {
2 possiblyDoBadThings(p);
3 return o.f();
4}
5noInline(foo);
6
7function Thingy() { }
8Thingy.prototype.f = function() { return 42; }
9
10function possiblyDoBadThings(p) {
11 if (p)
12 Thingy.prototype.f = function() { return 24; }
13}
14noInline(possiblyDoBadThings);
15
16for (var i = 0; i < 100000; ++i) {
17 var result = foo(new Thingy(), false);
18 if (result != 42)
19 throw "Error: bad result: " + result;
20}
21
22var result = foo(new Thingy(), true);
23if (result != 24)
24 throw "Error: bad result: " + result;