Debian Codegraph @

rhino/testsrc/tests/e4x/GC/regress-324278.js

raw symbols SCIP
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 gTestfile = 'regress-324278.js';
7
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 324278;
10 var summary = 'GC without recursion';
11 var actual;
12 var expect;
13
14 printBugNumber(BUGNUMBER);
15 START(summary);
16
17 var N = 1000 * 1000;
18
19 print("N = " + N);
20
21 function prepare_list(N)
22 {
23 var cursor = null;
24 for (var i = 0; i != N; ++i) {
25 var ns = new Namespace("protocol:address");
26 ns.property = cursor;
27 var xml = <xml/>;
28 xml.addNamespace(ns);
29 cursor = {xml: xml};
30 }
31 return cursor;
32 }
33
34 print("preparing...");
35
36 var list = prepare_list(N);
37
38 print("prepared for "+N);
39 gc();
40
41 var count = 0;
42 while (list && list.xml.inScopeNamespaces().length > 0 && list.xml.inScopeNamespaces()[1]) {
43 list = list.xml.inScopeNamespaces()[1].property;
44 ++count;
45 }
46
47 expect = N;
48 actual = count;
49
50 TEST(1, expect, actual);
51
52 gc();
53
54 END();