1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/GC/regress-203278-2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +//----------------------------------------------------------------------------- 1.10 +var BUGNUMBER = 203278; 1.11 +var summary = 'Don\'t crash in recursive js_MarkGCThing'; 1.12 +var actual = 'FAIL'; 1.13 +var expect = 'PASS'; 1.14 + 1.15 +printBugNumber(BUGNUMBER); 1.16 +printStatus (summary); 1.17 + 1.18 +// Prepare array to test DeutschSchorrWaite implementation 1.19 +// and its reverse pointer scanning performance 1.20 + 1.21 +var a = new Array(1000 * 1000); 1.22 + 1.23 +var i = a.length; 1.24 +while (i-- != 0) { 1.25 + switch (i % 11) { 1.26 + case 0: 1.27 + a[i] = { }; 1.28 + break; 1.29 + case 1: 1.30 + a[i] = { a: true, b: false, c: 0 }; 1.31 + break; 1.32 + case 2: 1.33 + a[i] = { 0: true, 1: {}, 2: false }; 1.34 + break; 1.35 + case 3: 1.36 + a[i] = { a: 1.2, b: "", c: [] }; 1.37 + break; 1.38 + case 4: 1.39 + a[i] = [ false ]; 1.40 + break; 1.41 + case 6: 1.42 + a[i] = []; 1.43 + break; 1.44 + case 7: 1.45 + a[i] = false; 1.46 + break; 1.47 + case 8: 1.48 + a[i] = "x"; 1.49 + break; 1.50 + case 9: 1.51 + a[i] = new String("x"); 1.52 + break; 1.53 + case 10: 1.54 + a[i] = 1.1; 1.55 + break; 1.56 + case 10: 1.57 + a[i] = new Boolean(); 1.58 + break; 1.59 + } 1.60 +} 1.61 + 1.62 +printStatus("DSF is prepared"); 1.63 + 1.64 +// Prepare linked list that causes recursion during GC with 1.65 +// depth O(list size) 1.66 +// Note: pass "-S 500000" option to the shell to limit stack quota 1.67 +// available for recursion 1.68 + 1.69 +for (i = 0; i != 50*1000; ++i) { 1.70 + a = [a, a, {}]; 1.71 + a = [a, {}, a]; 1.72 + 1.73 +} 1.74 + 1.75 +printStatus("Linked list is prepared"); 1.76 + 1.77 +gc(); 1.78 + 1.79 +actual = 'PASS'; 1.80 + 1.81 +reportCompare(expect, actual, summary); 1.82 +