js/src/tests/js1_5/GC/regress-203278-2.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:0f1bfb9c1528
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 203278;
8 var summary = 'Don\'t crash in recursive js_MarkGCThing';
9 var actual = 'FAIL';
10 var expect = 'PASS';
11
12 printBugNumber(BUGNUMBER);
13 printStatus (summary);
14
15 // Prepare array to test DeutschSchorrWaite implementation
16 // and its reverse pointer scanning performance
17
18 var a = new Array(1000 * 1000);
19
20 var i = a.length;
21 while (i-- != 0) {
22 switch (i % 11) {
23 case 0:
24 a[i] = { };
25 break;
26 case 1:
27 a[i] = { a: true, b: false, c: 0 };
28 break;
29 case 2:
30 a[i] = { 0: true, 1: {}, 2: false };
31 break;
32 case 3:
33 a[i] = { a: 1.2, b: "", c: [] };
34 break;
35 case 4:
36 a[i] = [ false ];
37 break;
38 case 6:
39 a[i] = [];
40 break;
41 case 7:
42 a[i] = false;
43 break;
44 case 8:
45 a[i] = "x";
46 break;
47 case 9:
48 a[i] = new String("x");
49 break;
50 case 10:
51 a[i] = 1.1;
52 break;
53 case 10:
54 a[i] = new Boolean();
55 break;
56 }
57 }
58
59 printStatus("DSF is prepared");
60
61 // Prepare linked list that causes recursion during GC with
62 // depth O(list size)
63 // Note: pass "-S 500000" option to the shell to limit stack quota
64 // available for recursion
65
66 for (i = 0; i != 50*1000; ++i) {
67 a = [a, a, {}];
68 a = [a, {}, a];
69
70 }
71
72 printStatus("Linked list is prepared");
73
74 gc();
75
76 actual = 'PASS';
77
78 reportCompare(expect, actual, summary);
79

mercurial