1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_8/extensions/regress-417131.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +// |reftest| skip 1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +//----------------------------------------------------------------------------- 1.11 +var BUGNUMBER = 417131; 1.12 +var summary = 'stress test for cache'; 1.13 +var actual = ''; 1.14 +var expect = ''; 1.15 + 1.16 + 1.17 +//----------------------------------------------------------------------------- 1.18 +test(); 1.19 +//----------------------------------------------------------------------------- 1.20 + 1.21 +function test() 1.22 +{ 1.23 + enterFunc ('test'); 1.24 + printBugNumber(BUGNUMBER); 1.25 + printStatus (summary); 1.26 + 1.27 + function f(N) 1.28 + { 1.29 + for (var i = 0; i != N; ++i) { 1.30 + var obj0 = {}, obj1 = {}, obj2 = {}; 1.31 + obj1['a'+i] = 0; 1.32 + obj2['b'+i] = 0; 1.33 + obj2['b'+(i+1)] = 1; 1.34 + for (var repeat = 0;repeat != 2; ++repeat) { 1.35 + var count = 0; 1.36 + for (var j in obj1) { 1.37 + if (j !== 'a'+i) 1.38 + throw "Bad:"+j; 1.39 + for (var k in obj2) { 1.40 + if (i == Math.floor(N/3) || i == Math.floor(2*N/3)) 1.41 + gc(); 1.42 + var expected; 1.43 + switch (count) { 1.44 + case 0: expected='b'+i; break; 1.45 + case 1: expected='b'+(i+1); break; 1.46 + default: 1.47 + throw "Bad count: "+count; 1.48 + } 1.49 + if (expected != k) 1.50 + throw "Bad k, expected="+expected+", actual="+k; 1.51 + for (var l in obj0) 1.52 + ++count; 1.53 + ++count; 1.54 + } 1.55 + } 1.56 + if (count !== 2) 1.57 + throw "Bad count: "+count; 1.58 + } 1.59 + } 1.60 + } 1.61 + 1.62 + var array = [function() { f(10); }, 1.63 + function() { f(50); }, 1.64 + function() { f(200); }, 1.65 + function() { f(400); } 1.66 + ]; 1.67 + 1.68 + if (typeof scatter == "function") { 1.69 + scatter(array); 1.70 + } else { 1.71 + for (var i = 0; i != array.length; ++i) 1.72 + array[i](); 1.73 + } 1.74 + 1.75 + 1.76 + reportCompare(expect, actual, summary); 1.77 + 1.78 + exitFunc ('test'); 1.79 +}