OLD | NEW |
1 <p> | 1 <p> |
2 This page tests for a crash due to insufficient marking of ExecStates. If | 2 This page tests for a crash due to insufficient marking of ExecStates. If |
3 the test passes, you'll see a series of PASS messages below. | 3 the test passes, you'll see a series of PASS messages below. |
4 </p> | 4 </p> |
5 | 5 |
6 <pre id="console"> | 6 <pre id="console"> |
7 PASS: You didn't crash. | 7 PASS: You didn't crash. |
8 </pre> | 8 </pre> |
9 | 9 |
10 <a id="a"></a> | 10 <a id="a"></a> |
11 | 11 <script src="../../resources/gc.js"></script> |
12 <script> | 12 <script> |
13 function log(s) | 13 function log(s) |
14 { | 14 { |
15 document.getElementById("console").appendChild(document.createTextNode(s + "
\n")); | 15 document.getElementById("console").appendChild(document.createTextNode(s + "
\n")); |
16 } | 16 } |
17 | 17 |
18 function shouldBe(a, aDescription, b) | 18 function shouldBe(a, aDescription, b) |
19 { | 19 { |
20 if (a == b) { | 20 if (a == b) { |
21 log("PASS: " + aDescription + " should be " + b + " and is."); | 21 log("PASS: " + aDescription + " should be " + b + " and is."); |
22 } else { | 22 } else { |
23 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a
+ "."); | 23 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a
+ "."); |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 function FailureObject() | 27 function FailureObject() |
28 { | 28 { |
29 } | 29 } |
30 | 30 |
31 FailureObject.prototype.toString = function() | 31 FailureObject.prototype.toString = function() |
32 { | 32 { |
33 return "FAIL"; // A marker to indicate that an object was collected and then
overwritten by a FailureObject. | 33 return "FAIL"; // A marker to indicate that an object was collected and then
overwritten by a FailureObject. |
34 } | 34 } |
35 | 35 |
36 function gc() | |
37 { | |
38 if (window.GCController) | |
39 GCController.collect(); | |
40 else | |
41 for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objec
ts to force a GC. | |
42 new FailureObject; | |
43 } | |
44 | |
45 function gc1() | 36 function gc1() |
46 { | 37 { |
47 var script = document.createElement("script"); | 38 var script = document.createElement("script"); |
48 script.appendChild(document.createTextNode("gc()")); | 39 script.appendChild(document.createTextNode("gc()")); |
49 document.body.appendChild(script); | 40 document.body.appendChild(script); |
50 } | 41 } |
51 | 42 |
52 function gc2() | 43 function gc2() |
53 { | 44 { |
54 var a = document.getElementById("a"); | 45 var a = document.getElementById("a"); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 80 |
90 // Now verify that our activation data wasn't collected, by using it in an i
nteresting way. | 81 // Now verify that our activation data wasn't collected, by using it in an i
nteresting way. |
91 return v1 + v2 + v3 + v4 + v5; | 82 return v1 + v2 + v3 + v4 + v5; |
92 } | 83 } |
93 | 84 |
94 if (window.testRunner) | 85 if (window.testRunner) |
95 testRunner.dumpAsText(); | 86 testRunner.dumpAsText(); |
96 | 87 |
97 shouldBe(f(), "f()", "12345"); | 88 shouldBe(f(), "f()", "12345"); |
98 </script> | 89 </script> |
OLD | NEW |