]> git.saurik.com Git - apple/javascriptcore.git/blame_incremental - tests/stress/is-undefined-exit-on-masquerader.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / is-undefined-exit-on-masquerader.js
... / ...
CommitLineData
1var doMasquerading = false;
2
3function bar(o) {
4 if (doMasquerading)
5 return makeMasquerader();
6 return o;
7}
8
9noInline(bar);
10
11function foo(o) {
12 o = bar(o);
13 return typeof o === "undefined";
14}
15
16noInline(foo);
17
18function test(o, expected) {
19 var result = foo(o);
20 if (result != expected)
21 throw new Error("bad result: " + result);
22}
23
24for (var i = 0; i < 10000; ++i) {
25 test(void 0, true);
26 test(null, false);
27 test(42, false);
28 test({}, false);
29 test("undefined", false);
30}
31
32doMasquerading = true;
33test({}, true);