1 /* 2 * Copyright (c) 2015, 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-8079269: Optimistic rewrite in object literal causes ArrayIndexOutOfBoundsException 26 * 27 * @test 28 * @run 29 */ 30 31 // m must be in scope so it's accessed with optimistic getters on scope 32 var m = 1; 33 34 (function() { 35 return { 36 p0: m, 37 p1: m = "foo", 38 p2: m 39 } 40 })(); 41 42 var n = 1; 43 44 // Test the spill object creator too 45 (function() { 46 return { 47 p0: n, 48 p1: n = "foo", 49 p2: n, 50 p3: n, 51 p4: n, 52 p5: n, 53 p6: n, 54 p7: n, 55 p8: n, 56 p9: n, 57 p10: n, 58 p11: n, 59 p12: n, 60 p13: n, 61 p14: n, 62 p15: n, 63 p16: n, 64 p17: n, 65 p18: n, 66 p19: n, 67 p20: n, 68 p21: n, 69 p22: n, 70 p23: n, 71 p24: n, 72 p25: n, 73 p26: n, 74 p27: n, 75 p28: n, 76 p29: n, 77 p30: n, 78 p31: n, 79 p32: n, 80 p33: n, 81 p34: n, 82 p35: n, 83 p36: n, 84 p37: n, 85 p38: n, 86 p39: n, 87 p40: n, 88 p41: n, 89 p42: n, 90 p43: n, 91 p44: n, 92 p45: n, 93 p46: n, 94 p47: n, 95 p48: n, 96 p49: n, 97 p50: n, 98 p51: n, 99 p52: n, 100 p53: n, 101 p54: n, 102 p55: n, 103 p56: n, 104 p57: n, 105 p58: n, 106 p59: n, 107 p60: n, 108 p61: n, 109 p62: n, 110 p63: n, 111 p64: n, 112 p65: n, 113 p66: n, 114 p67: n, 115 p68: n, 116 p69: n, 117 p70: n, 118 p71: n, 119 p72: n, 120 p73: n, 121 p74: n, 122 p75: n, 123 p76: n, 124 p77: n, 125 p78: n, 126 p79: n, 127 p80: n, 128 p81: n, 129 p82: n, 130 p83: n, 131 p84: n, 132 p85: n, 133 p86: n, 134 p87: n, 135 p88: n, 136 p89: n, 137 p90: n, 138 p91: n, 139 p92: n, 140 p93: n, 141 p94: n, 142 p95: n, 143 p96: n, 144 p97: n, 145 p98: n, 146 p99: n, 147 p100: n, 148 p101: n, 149 p102: n, 150 p103: n, 151 p104: n, 152 p105: n, 153 p106: n, 154 p107: n, 155 p108: n, 156 p109: n, 157 p110: n, 158 p111: n, 159 p112: n, 160 p113: n, 161 p114: n, 162 p115: n, 163 p116: n, 164 p117: n, 165 p118: n, 166 p119: n, 167 p120: n, 168 p121: n, 169 p122: n, 170 p123: n, 171 p124: n, 172 p125: n, 173 p126: n, 174 p127: n, 175 p128: n, 176 p129: n, 177 p130: n, 178 p131: n, 179 p132: n, 180 p133: n, 181 p134: n, 182 p135: n, 183 p136: n, 184 p137: n, 185 p138: n, 186 p139: n, 187 p140: n, 188 p141: n, 189 p142: n, 190 p143: n, 191 p144: n, 192 p145: n, 193 p146: n, 194 p147: n, 195 p148: n, 196 p149: n, 197 p150: n, 198 p151: n, 199 p152: n, 200 p153: n, 201 p154: n, 202 p155: n, 203 p156: n, 204 p157: n, 205 p158: n, 206 p159: n, 207 p160: n, 208 p161: n, 209 p162: n, 210 p163: n, 211 p164: n, 212 p165: n, 213 p166: n, 214 p167: n, 215 p168: n, 216 p169: n, 217 p170: n, 218 p171: n, 219 p172: n, 220 p173: n, 221 p174: n, 222 p175: n, 223 p176: n, 224 p177: n, 225 p178: n, 226 p179: n, 227 p180: n, 228 p181: n, 229 p182: n, 230 p183: n, 231 p184: n, 232 p185: n, 233 p186: n, 234 p187: n, 235 p188: n, 236 p189: n, 237 p190: n, 238 p191: n, 239 p192: n, 240 p193: n, 241 p194: n, 242 p195: n, 243 p196: n, 244 p197: n, 245 p198: n, 246 p199: n, 247 p200: n, 248 p201: n, 249 p202: n, 250 p203: n, 251 p204: n, 252 p205: n, 253 p206: n, 254 p207: n, 255 p208: n, 256 p209: n, 257 p210: n, 258 p211: n, 259 p212: n, 260 p213: n, 261 p214: n, 262 p215: n, 263 p216: n, 264 p217: n, 265 p218: n, 266 p219: n, 267 p220: n, 268 p221: n, 269 p222: n, 270 p223: n, 271 p224: n, 272 p225: n, 273 p226: n, 274 p227: n, 275 p228: n, 276 p229: n, 277 p230: n, 278 p231: n, 279 p232: n, 280 p233: n, 281 p234: n, 282 p235: n, 283 p236: n, 284 p237: n, 285 p238: n, 286 p239: n, 287 p240: n, 288 p241: n, 289 p242: n, 290 p243: n, 291 p244: n, 292 p245: n, 293 p246: n, 294 p247: n, 295 p248: n, 296 p249: n, 297 p250: n, 298 p251: n, 299 p252: n, 300 p253: n, 301 p254: n, 302 p255: n, 303 p256: n, 304 p257: n, 305 p258: n, 306 p259: n 307 } 308 })(); 309 310 // No output; as long as it completes without 311 // ArrayIndexOutOfBoundsException in the OSR continuation handler, it's 312 // a success.