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-8010710 - slot/scope problem with temporary expressions 26 * as array index in self modifying assigns 27 * 28 * @test 29 * @run 30 */ 31 function zero() { 32 return 0; 33 } 34 35 //try complex self modifying assignment and force slots to temporary value index operators 36 var a = [1, 2, 3, 4, 5]; 37 var b = [a, a]; 38 print(b[zero() + 1][2 + a[0]] += 10); 39 40 //repro for NASHORN-258 that never made it 41 function AddRoundKey() { 42 var r=0; 43 state[r][1] &= 17; 44 } 45 46 var srcFiles = []; 47 for(i=0;i<100;i++) { 48 srcFiles.push('dummy'); 49 } 50 var added = ''; 51 52 //this broke the javafx build system. verify it works 53 function bouncingBall() { 54 for (j=0; j<100; j++) { 55 added += srcFiles[j]; 56 } 57 } 58 bouncingBall(); 59 print(added); 60 61 //this is how they should have done it for speed, that works always, verify this too 62 function bouncingBall2() { 63 for (var k=0; k<100; k++) { 64 added += srcFiles[k]; 65 } 66 } 67 bouncingBall2(); 68 print(added);