Debian Codegraph @

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

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