]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/invalidation-point.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / invalidation-point.js
1 function foo(o, p) {
2 possiblyDoBadThings(p);
3 return o.f();
4 }
5 noInline(foo);
6
7 function Thingy() { }
8 Thingy.prototype.f = function() { return 42; }
9
10 function possiblyDoBadThings(p) {
11 if (p)
12 Thingy.prototype.f = function() { return 24; }
13 }
14 noInline(possiblyDoBadThings);
15
16 for (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
22 var result = foo(new Thingy(), true);
23 if (result != 24)
24 throw "Error: bad result: " + result;