]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/instanceof-not-cell.js
1 function foo(o
, prototype) {
2 return o
instanceof prototype;
7 function test(o
, prototype, expected
) {
8 var actual
= foo(o
, prototype);
9 if (actual
!= expected
)
10 throw new Error("bad result: " + actual
);
16 Bar
.prototype = new Foo();
18 for (var i
= 0; i
< 10000; ++i
) {
19 test(42, Object
, false);
20 test(42, Array
, false);
21 test(42, String
, false);
24 test({}, Object
, true);
25 test({}, Array
, false);
26 test({}, String
, false);
29 test([], Object
, true);
30 test([], Array
, true);
31 test([], String
, false);
34 test(new Foo(), Object
, true);
35 test(new Foo(), Array
, false);
36 test(new Foo(), String
, false);
37 test(new Foo(), Foo
, true);
38 test(new Foo(), Bar
, false);
39 test(new Bar(), Object
, true);
40 test(new Bar(), Array
, false);
41 test(new Bar(), String
, false);
42 test(new Bar(), Foo
, true);
43 test(new Bar(), Bar
, true);