michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 203278; michael@0: var summary = 'Don\'t crash in recursive js_MarkGCThing'; michael@0: var actual = 'FAIL'; michael@0: var expect = 'PASS'; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: // Prepare array to test DeutschSchorrWaite implementation michael@0: // and its reverse pointer scanning performance michael@0: michael@0: var a = new Array(1000 * 1000); michael@0: michael@0: var i = a.length; michael@0: while (i-- != 0) { michael@0: switch (i % 11) { michael@0: case 0: michael@0: a[i] = { }; michael@0: break; michael@0: case 1: michael@0: a[i] = { a: true, b: false, c: 0 }; michael@0: break; michael@0: case 2: michael@0: a[i] = { 0: true, 1: {}, 2: false }; michael@0: break; michael@0: case 3: michael@0: a[i] = { a: 1.2, b: "", c: [] }; michael@0: break; michael@0: case 4: michael@0: a[i] = [ false ]; michael@0: break; michael@0: case 6: michael@0: a[i] = []; michael@0: break; michael@0: case 7: michael@0: a[i] = false; michael@0: break; michael@0: case 8: michael@0: a[i] = "x"; michael@0: break; michael@0: case 9: michael@0: a[i] = new String("x"); michael@0: break; michael@0: case 10: michael@0: a[i] = 1.1; michael@0: break; michael@0: case 10: michael@0: a[i] = new Boolean(); michael@0: break; michael@0: } michael@0: } michael@0: michael@0: printStatus("DSF is prepared"); michael@0: michael@0: // Prepare linked list that causes recursion during GC with michael@0: // depth O(list size) michael@0: // Note: pass "-S 500000" option to the shell to limit stack quota michael@0: // available for recursion michael@0: michael@0: for (i = 0; i != 50*1000; ++i) { michael@0: a = [a, a, {}]; michael@0: a = [a, {}, a]; michael@0: michael@0: } michael@0: michael@0: printStatus("Linked list is prepared"); michael@0: michael@0: gc(); michael@0: michael@0: actual = 'PASS'; michael@0: michael@0: reportCompare(expect, actual, summary); michael@0: