Debian Codegraph @

rhino/testsrc/tests/js1_5/GC/regress-341877-02.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 var gTestfile = 'regress-341877-02.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 341877;
9 var summary = 'GC hazard with for-in loop';
10 var actual = 'No Crash';
11 var expect = 'No Crash';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 var obj = { };
17
18 var prop = "xsomePropety".substr(1);
19
20 obj.first = "first"
21
22 obj[prop] = 1;
23
24 for (var elem in obj) {
25 var tmp = elem.toString();
26 delete obj[prop];
27 // ensure that prop is cut from all roots
28 prop = "xsomePropety".substr(2);
29 obj[prop] = 2;
30 delete obj[prop];
31 prop = null;
32 if (typeof gc == 'function')
33 gc();
34 for (var i = 0; i != 50000; ++i) {
35 var tmp = 1 / 3;
36 tmp /= 10;
37 }
38 for (var i = 0; i != 1000; ++i) {
39 // Make string with 11 characters that would take
40 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
41 // malloc will ovewrite just freed atoms.
42 var tmp2 = Array(12).join(' ');
43 }
44 }
45
46 reportCompare(expect, actual, summary);