1 /* 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * JDK-8010804: Review long and integer usage conventions 26 * 27 * @test 28 * @run 29 */ 30 31 var x = []; 32 print(x.length); 33 x[4294967294] = 1; 34 print(x.length); 35 x[4294967295] = 1; 36 print(x.length); 37 print(x.slice(4294967293).length); 38 print(x.slice(4294967294).length); 39 print(x.slice(4294967295).length); 40 print(x.slice(4294967296).length); 41 42 print(x.slice(-4294967293).length); 43 print(x.slice(-4294967294).length); 44 print(x.slice(-4294967295).length); 45 print(x.slice(-4294967296).length); 46 47 print(x.slice(0, 4294967293).length); 48 print(x.slice(0, 4294967294).length); 49 print(x.slice(0, 4294967295).length); 50 print(x.slice(0, 4294967296).length); 51 52 print(x.slice(0, -4294967293).length); 53 print(x.slice(0, -4294967294).length); 54 print(x.slice(0, -4294967295).length); 55 print(x.slice(0, -4294967296).length); 56 57 print(x.slice(9223371036854775807).length); 58 print(x.slice(9223372036854775807).length); 59 print(x.slice(9223373036854775807).length); 60 print(x.slice(9223374036854775807).length); 61 62 print(x.slice(-9223371036854775807).length); 63 print(x.slice(-9223372036854775807).length); 64 print(x.slice(-9223373036854775807).length); 65 print(x.slice(-9223374036854775807).length); 66 67 print(x.slice(-9223371036854775807, 1).length); 68 print(x.slice(-9223372036854775807, 1).length); 69 print(x.slice(-9223373036854775807, 1).length); 70 print(x.slice(-9223374036854775807, 1).length); 71 72 print(x.slice(-9223371036854775807, -1).length); 73 print(x.slice(-9223372036854775807, -1).length); 74 print(x.slice(-9223373036854775807, -1).length); 75 print(x.slice(-9223374036854775807, -1).length); 76 77 print(x.slice(Infinity).length); 78 print(x.slice(Infinity, Infinity).length); 79 print(x.slice(Infinity, -Infinity).length); 80 print(x.slice(-Infinity).length); 81 print(x.slice(-Infinity, Infinity).length); 82 print(x.slice(-Infinity, -Infinity).length); 83 84 var d = new Date(); 85 d.setYear(Infinity); 86 print(d);