Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-341956-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-341956-02.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 341956;
9 var summary = 'GC Hazards in jsarray.c - pop';
10 var actual = '';
11 var expect = 'GETTER RESULT';
12
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
16
17 function test()
18 {
19 enterFunc ('test');
20 printBugNumber(BUGNUMBER);
21 printStatus (summary);
22
23 var N = 0xFFFFFFFF;
24 var a = [];
25 a[N - 1] = 0;
26
27 var expected = "GETTER RESULT";
28
29 a.__defineGetter__(N - 1, function() {
30 delete a[N - 1];
31 var tmp = [];
32 tmp[N - 2] = 1;
33
34 if (typeof gc == 'function')
35 gc();
36 for (var i = 0; i != 50000; ++i) {
37 var tmp = 1 / 3;
38 tmp /= 10;
39 }
40 for (var i = 0; i != 1000; ++i) {
41 // Make string with 11 characters that would take
42 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
43 // malloc will ovewrite just freed atoms.
44 var tmp2 = Array(12).join(' ');
45 }
46 return expected;
47 });
48
49 actual = a.pop();
50
51 reportCompare(expect, actual, summary);
52
53 print('Done');
54
55 exitFunc ('test');
56 }