1 /* |
1 /* |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
8 * |
8 * |
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
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 |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
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 |
12 * version 2 for more details (a copy is included in the LICENSE file that |
13 * accompanied this code). |
13 * accompanied this code). |
14 * |
14 * |
15 * You should have received a copy of the GNU General Public License version |
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, |
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. |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
18 * |
18 * |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /** |
24 /** |
25 * JDK-8010710 - slot/scope problem with temporary expressions |
25 * JDK-8010710 - slot/scope problem with temporary expressions |
26 * as array index in self modifying assigns |
26 * as array index in self modifying assigns |
27 * |
27 * |
28 * @test |
28 * @test |
29 * @run |
29 * @run |
30 */ |
30 */ |
31 function zero() { |
31 function zero() { |
32 return 0; |
32 return 0; |
33 } |
33 } |
34 |
34 |
36 var a = [1, 2, 3, 4, 5]; |
36 var a = [1, 2, 3, 4, 5]; |
37 var b = [a, a]; |
37 var b = [a, a]; |
38 print(b[zero() + 1][2 + a[0]] += 10); |
38 print(b[zero() + 1][2 + a[0]] += 10); |
39 |
39 |
40 //repro for NASHORN-258 that never made it |
40 //repro for NASHORN-258 that never made it |
41 function AddRoundKey() { |
41 function AddRoundKey() { |
42 var r=0; |
42 var r=0; |
43 state[r][1] &= 17; |
43 state[r][1] &= 17; |
44 } |
44 } |
45 |
45 |
46 var srcFiles = []; |
46 var srcFiles = []; |
47 for(i=0;i<100;i++) { |
47 for(i=0;i<100;i++) { |
48 srcFiles.push('dummy'); |
48 srcFiles.push('dummy'); |
50 var added = ''; |
50 var added = ''; |
51 |
51 |
52 //this broke the javafx build system. verify it works |
52 //this broke the javafx build system. verify it works |
53 function bouncingBall() { |
53 function bouncingBall() { |
54 for (j=0; j<100; j++) { |
54 for (j=0; j<100; j++) { |
55 added += srcFiles[j]; |
55 added += srcFiles[j]; |
56 } |
56 } |
57 } |
57 } |
58 bouncingBall(); |
58 bouncingBall(); |
59 print(added); |
59 print(added); |
60 |
60 |
61 //this is how they should have done it for speed, that works always, verify this too |
61 //this is how they should have done it for speed, that works always, verify this too |
62 function bouncingBall2() { |
62 function bouncingBall2() { |
63 for (var k=0; k<100; k++) { |
63 for (var k=0; k<100; k++) { |
64 added += srcFiles[k]; |
64 added += srcFiles[k]; |
65 } |
65 } |
66 } |
66 } |
67 bouncingBall2(); |
67 bouncingBall2(); |
68 print(added); |
68 print(added); |