| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 literal[0] = value; | 121 literal[0] = value; |
| 122 return literal; | 122 return literal; |
| 123 } | 123 } |
| 124 | 124 |
| 125 function get_standard_literal() { | 125 function get_standard_literal() { |
| 126 var literal = [1, 2, 3]; | 126 var literal = [1, 2, 3]; |
| 127 return literal; | 127 return literal; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Case: [1,2,3] as allocation site | 130 // Case: [1,2,3] as allocation site |
| 131 get_standard_literal(); // Skip premonomorphic state. | |
| 132 obj = fastliteralcase(get_standard_literal(), 1); | 131 obj = fastliteralcase(get_standard_literal(), 1); |
| 133 assertKind(elements_kind.fast_smi_only, obj); | 132 assertKind(elements_kind.fast_smi_only, obj); |
| 134 obj = fastliteralcase(get_standard_literal(), 1.5); | 133 obj = fastliteralcase(get_standard_literal(), 1.5); |
| 135 assertKind(elements_kind.fast_double, obj); | 134 assertKind(elements_kind.fast_double, obj); |
| 136 obj = fastliteralcase(get_standard_literal(), 2); | 135 obj = fastliteralcase(get_standard_literal(), 2); |
| 137 assertKind(elements_kind.fast_double, obj); | 136 assertKind(elements_kind.fast_double, obj); |
| 138 | 137 |
| 139 // The test below is in a loop because arrays that live | 138 // The test below is in a loop because arrays that live |
| 140 // at global scope without the chance of being recreated | 139 // at global scope without the chance of being recreated |
| 141 // don't have allocation site information attached. | 140 // don't have allocation site information attached. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 163 get_standard_literal(); | 162 get_standard_literal(); |
| 164 obj = get_standard_literal(); | 163 obj = get_standard_literal(); |
| 165 assertKind(elements_kind.fast, obj); | 164 assertKind(elements_kind.fast, obj); |
| 166 | 165 |
| 167 function fastliteralcase_smifast(value) { | 166 function fastliteralcase_smifast(value) { |
| 168 var literal = [1, 2, 3, 4]; | 167 var literal = [1, 2, 3, 4]; |
| 169 literal[0] = value; | 168 literal[0] = value; |
| 170 return literal; | 169 return literal; |
| 171 } | 170 } |
| 172 | 171 |
| 173 fastliteralcase_smifast(1); // Skip premonomorphic state. | |
| 174 obj = fastliteralcase_smifast(1); | 172 obj = fastliteralcase_smifast(1); |
| 175 assertKind(elements_kind.fast_smi_only, obj); | 173 assertKind(elements_kind.fast_smi_only, obj); |
| 176 obj = fastliteralcase_smifast("carter"); | 174 obj = fastliteralcase_smifast("carter"); |
| 177 assertKind(elements_kind.fast, obj); | 175 assertKind(elements_kind.fast, obj); |
| 178 obj = fastliteralcase_smifast(2); | 176 obj = fastliteralcase_smifast(2); |
| 179 assertKind(elements_kind.fast, obj); | 177 assertKind(elements_kind.fast, obj); |
| 180 | 178 |
| 181 // Case: make sure transitions from packed to holey are tracked | 179 // Case: make sure transitions from packed to holey are tracked |
| 182 function fastliteralcase_smiholey(index, value) { | 180 function fastliteralcase_smiholey(index, value) { |
| 183 var literal = [1, 2, 3, 4]; | 181 var literal = [1, 2, 3, 4]; |
| 184 literal[index] = value; | 182 literal[index] = value; |
| 185 return literal; | 183 return literal; |
| 186 } | 184 } |
| 187 | 185 |
| 188 fastliteralcase_smiholey(5, 1); // Skip premonomorphic state. | |
| 189 obj = fastliteralcase_smiholey(5, 1); | 186 obj = fastliteralcase_smiholey(5, 1); |
| 190 assertKind(elements_kind.fast_smi_only, obj); | 187 assertKind(elements_kind.fast_smi_only, obj); |
| 191 assertHoley(obj); | 188 assertHoley(obj); |
| 192 obj = fastliteralcase_smiholey(0, 1); | 189 obj = fastliteralcase_smiholey(0, 1); |
| 193 assertKind(elements_kind.fast_smi_only, obj); | 190 assertKind(elements_kind.fast_smi_only, obj); |
| 194 assertHoley(obj); | 191 assertHoley(obj); |
| 195 | 192 |
| 196 function newarraycase_smidouble(value) { | 193 function newarraycase_smidouble(value) { |
| 197 var a = new Array(); | 194 var a = new Array(); |
| 198 a[0] = value; | 195 a[0] = value; |
| 199 return a; | 196 return a; |
| 200 } | 197 } |
| 201 | 198 |
| 202 // Case: new Array() as allocation site, smi->double | 199 // Case: new Array() as allocation site, smi->double |
| 203 newarraycase_smidouble(1); // Skip premonomorphic state. | |
| 204 obj = newarraycase_smidouble(1); | 200 obj = newarraycase_smidouble(1); |
| 205 assertKind(elements_kind.fast_smi_only, obj); | 201 assertKind(elements_kind.fast_smi_only, obj); |
| 206 obj = newarraycase_smidouble(1.5); | 202 obj = newarraycase_smidouble(1.5); |
| 207 assertKind(elements_kind.fast_double, obj); | 203 assertKind(elements_kind.fast_double, obj); |
| 208 obj = newarraycase_smidouble(2); | 204 obj = newarraycase_smidouble(2); |
| 209 assertKind(elements_kind.fast_double, obj); | 205 assertKind(elements_kind.fast_double, obj); |
| 210 | 206 |
| 211 function newarraycase_smiobj(value) { | 207 function newarraycase_smiobj(value) { |
| 212 var a = new Array(); | 208 var a = new Array(); |
| 213 a[0] = value; | 209 a[0] = value; |
| 214 return a; | 210 return a; |
| 215 } | 211 } |
| 216 | 212 |
| 217 // Case: new Array() as allocation site, smi->fast | 213 // Case: new Array() as allocation site, smi->fast |
| 218 newarraycase_smiobj(1); // Skip premonomorphic state. | |
| 219 obj = newarraycase_smiobj(1); | 214 obj = newarraycase_smiobj(1); |
| 220 assertKind(elements_kind.fast_smi_only, obj); | 215 assertKind(elements_kind.fast_smi_only, obj); |
| 221 obj = newarraycase_smiobj("gloria"); | 216 obj = newarraycase_smiobj("gloria"); |
| 222 assertKind(elements_kind.fast, obj); | 217 assertKind(elements_kind.fast, obj); |
| 223 obj = newarraycase_smiobj(2); | 218 obj = newarraycase_smiobj(2); |
| 224 assertKind(elements_kind.fast, obj); | 219 assertKind(elements_kind.fast, obj); |
| 225 | 220 |
| 226 function newarraycase_length_smidouble(value) { | 221 function newarraycase_length_smidouble(value) { |
| 227 var a = new Array(3); | 222 var a = new Array(3); |
| 228 a[0] = value; | 223 a[0] = value; |
| 229 return a; | 224 return a; |
| 230 } | 225 } |
| 231 | 226 |
| 232 // Case: new Array(length) as allocation site | 227 // Case: new Array(length) as allocation site |
| 233 newarraycase_length_smidouble(1); // Skip premonomorphic state. | |
| 234 obj = newarraycase_length_smidouble(1); | 228 obj = newarraycase_length_smidouble(1); |
| 235 assertKind(elements_kind.fast_smi_only, obj); | 229 assertKind(elements_kind.fast_smi_only, obj); |
| 236 obj = newarraycase_length_smidouble(1.5); | 230 obj = newarraycase_length_smidouble(1.5); |
| 237 assertKind(elements_kind.fast_double, obj); | 231 assertKind(elements_kind.fast_double, obj); |
| 238 obj = newarraycase_length_smidouble(2); | 232 obj = newarraycase_length_smidouble(2); |
| 239 assertKind(elements_kind.fast_double, obj); | 233 assertKind(elements_kind.fast_double, obj); |
| 240 | 234 |
| 241 // Try to continue the transition to fast object. This won't work for | 235 // Try to continue the transition to fast object. This won't work for |
| 242 // constructed arrays because constructor dispatch is done on the | 236 // constructed arrays because constructor dispatch is done on the |
| 243 // elements kind, and a DOUBLE array constructor won't create an allocation | 237 // elements kind, and a DOUBLE array constructor won't create an allocation |
| 244 // memento. | 238 // memento. |
| 245 obj = newarraycase_length_smidouble("coates"); | 239 obj = newarraycase_length_smidouble("coates"); |
| 246 assertKind(elements_kind.fast, obj); | 240 assertKind(elements_kind.fast, obj); |
| 247 obj = newarraycase_length_smidouble(2); | 241 obj = newarraycase_length_smidouble(2); |
| 248 assertKind(elements_kind.fast_double, obj); | 242 assertKind(elements_kind.fast_double, obj); |
| 249 | 243 |
| 250 function newarraycase_length_smiobj(value) { | 244 function newarraycase_length_smiobj(value) { |
| 251 var a = new Array(3); | 245 var a = new Array(3); |
| 252 a[0] = value; | 246 a[0] = value; |
| 253 return a; | 247 return a; |
| 254 } | 248 } |
| 255 | 249 |
| 256 // Case: new Array(<length>) as allocation site, smi->fast | 250 // Case: new Array(<length>) as allocation site, smi->fast |
| 257 newarraycase_length_smiobj(1); // Skip premonomorphic state. | |
| 258 obj = newarraycase_length_smiobj(1); | 251 obj = newarraycase_length_smiobj(1); |
| 259 assertKind(elements_kind.fast_smi_only, obj); | 252 assertKind(elements_kind.fast_smi_only, obj); |
| 260 obj = newarraycase_length_smiobj("gloria"); | 253 obj = newarraycase_length_smiobj("gloria"); |
| 261 assertKind(elements_kind.fast, obj); | 254 assertKind(elements_kind.fast, obj); |
| 262 obj = newarraycase_length_smiobj(2); | 255 obj = newarraycase_length_smiobj(2); |
| 263 assertKind(elements_kind.fast, obj); | 256 assertKind(elements_kind.fast, obj); |
| 264 | 257 |
| 265 function newarraycase_list_smidouble(value) { | 258 function newarraycase_list_smidouble(value) { |
| 266 var a = new Array(1, 2, 3); | 259 var a = new Array(1, 2, 3); |
| 267 a[0] = value; | 260 a[0] = value; |
| 268 return a; | 261 return a; |
| 269 } | 262 } |
| 270 | 263 |
| 271 newarraycase_list_smidouble(1); // Skip premonomorphic state. | |
| 272 obj = newarraycase_list_smidouble(1); | 264 obj = newarraycase_list_smidouble(1); |
| 273 assertKind(elements_kind.fast_smi_only, obj); | 265 assertKind(elements_kind.fast_smi_only, obj); |
| 274 obj = newarraycase_list_smidouble(1.5); | 266 obj = newarraycase_list_smidouble(1.5); |
| 275 assertKind(elements_kind.fast_double, obj); | 267 assertKind(elements_kind.fast_double, obj); |
| 276 obj = newarraycase_list_smidouble(2); | 268 obj = newarraycase_list_smidouble(2); |
| 277 assertKind(elements_kind.fast_double, obj); | 269 assertKind(elements_kind.fast_double, obj); |
| 278 | 270 |
| 279 function newarraycase_list_smiobj(value) { | 271 function newarraycase_list_smiobj(value) { |
| 280 var a = new Array(4, 5, 6); | 272 var a = new Array(4, 5, 6); |
| 281 a[0] = value; | 273 a[0] = value; |
| 282 return a; | 274 return a; |
| 283 } | 275 } |
| 284 | 276 |
| 285 newarraycase_list_smiobj(1); // Skip premonomorphic state. | |
| 286 obj = newarraycase_list_smiobj(1); | 277 obj = newarraycase_list_smiobj(1); |
| 287 assertKind(elements_kind.fast_smi_only, obj); | 278 assertKind(elements_kind.fast_smi_only, obj); |
| 288 obj = newarraycase_list_smiobj("coates"); | 279 obj = newarraycase_list_smiobj("coates"); |
| 289 assertKind(elements_kind.fast, obj); | 280 assertKind(elements_kind.fast, obj); |
| 290 obj = newarraycase_list_smiobj(2); | 281 obj = newarraycase_list_smiobj(2); |
| 291 assertKind(elements_kind.fast, obj); | 282 assertKind(elements_kind.fast, obj); |
| 292 | 283 |
| 293 // Case: array constructor calls with out of date feedback. | 284 // Case: array constructor calls with out of date feedback. |
| 294 // The boilerplate should incorporate all feedback, but the input array | 285 // The boilerplate should incorporate all feedback, but the input array |
| 295 // should be minimally transitioned based on immediate need. | 286 // should be minimally transitioned based on immediate need. |
| 296 (function() { | 287 (function() { |
| 297 function foo(i) { | 288 function foo(i) { |
| 298 // We have two cases, one for literals one for constructed arrays. | 289 // We have two cases, one for literals one for constructed arrays. |
| 299 var a = (i == 0) | 290 var a = (i == 0) |
| 300 ? [1, 2, 3] | 291 ? [1, 2, 3] |
| 301 : new Array(1, 2, 3); | 292 : new Array(1, 2, 3); |
| 302 return a; | 293 return a; |
| 303 } | 294 } |
| 304 | 295 |
| 305 foo(0); foo(1); // Skip premonomorphic state. | |
| 306 for (i = 0; i < 2; i++) { | 296 for (i = 0; i < 2; i++) { |
| 307 a = foo(i); | 297 a = foo(i); |
| 308 b = foo(i); | 298 b = foo(i); |
| 309 b[5] = 1; // boilerplate goes holey | 299 b[5] = 1; // boilerplate goes holey |
| 310 assertHoley(foo(i)); | 300 assertHoley(foo(i)); |
| 311 a[0] = 3.5; // boilerplate goes holey double | 301 a[0] = 3.5; // boilerplate goes holey double |
| 312 assertKind(elements_kind.fast_double, a); | 302 assertKind(elements_kind.fast_double, a); |
| 313 assertNotHoley(a); | 303 assertNotHoley(a); |
| 314 c = foo(i); | 304 c = foo(i); |
| 315 assertKind(elements_kind.fast_double, c); | 305 assertKind(elements_kind.fast_double, c); |
| 316 assertHoley(c); | 306 assertHoley(c); |
| 317 } | 307 } |
| 318 })(); | 308 })(); |
| 319 | 309 |
| 320 function newarraycase_onearg(len, value) { | 310 function newarraycase_onearg(len, value) { |
| 321 var a = new Array(len); | 311 var a = new Array(len); |
| 322 a[0] = value; | 312 a[0] = value; |
| 323 return a; | 313 return a; |
| 324 } | 314 } |
| 325 | 315 |
| 326 newarraycase_onearg(5, 3.5); // Skip premonomorphic state. | |
| 327 obj = newarraycase_onearg(5, 3.5); | 316 obj = newarraycase_onearg(5, 3.5); |
| 328 assertKind(elements_kind.fast_double, obj); | 317 assertKind(elements_kind.fast_double, obj); |
| 329 obj = newarraycase_onearg(10, 5); | 318 obj = newarraycase_onearg(10, 5); |
| 330 assertKind(elements_kind.fast_double, obj); | 319 assertKind(elements_kind.fast_double, obj); |
| 331 obj = newarraycase_onearg(0, 5); | 320 obj = newarraycase_onearg(0, 5); |
| 332 assertKind(elements_kind.fast_double, obj); | 321 assertKind(elements_kind.fast_double, obj); |
| 333 // Now pass a length that forces the dictionary path. | 322 // Now pass a length that forces the dictionary path. |
| 334 obj = newarraycase_onearg(100000, 5); | 323 obj = newarraycase_onearg(100000, 5); |
| 335 assertKind(elements_kind.dictionary, obj); | 324 assertKind(elements_kind.dictionary, obj); |
| 336 assertTrue(obj.length == 100000); | 325 assertTrue(obj.length == 100000); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 381 |
| 393 // Case: make sure nested arrays benefit from allocation site feedback as | 382 // Case: make sure nested arrays benefit from allocation site feedback as |
| 394 // well. | 383 // well. |
| 395 (function() { | 384 (function() { |
| 396 // Make sure we handle nested arrays | 385 // Make sure we handle nested arrays |
| 397 function get_nested_literal() { | 386 function get_nested_literal() { |
| 398 var literal = [[1,2,3,4], [2], [3]]; | 387 var literal = [[1,2,3,4], [2], [3]]; |
| 399 return literal; | 388 return literal; |
| 400 } | 389 } |
| 401 | 390 |
| 402 get_nested_literal(); // Skip premonomorphic state. | |
| 403 obj = get_nested_literal(); | 391 obj = get_nested_literal(); |
| 404 assertKind(elements_kind.fast, obj); | 392 assertKind(elements_kind.fast, obj); |
| 405 obj[0][0] = 3.5; | 393 obj[0][0] = 3.5; |
| 406 obj[2][0] = "hello"; | 394 obj[2][0] = "hello"; |
| 407 obj = get_nested_literal(); | 395 obj = get_nested_literal(); |
| 408 assertKind(elements_kind.fast_double, obj[0]); | 396 assertKind(elements_kind.fast_double, obj[0]); |
| 409 assertKind(elements_kind.fast_smi_only, obj[1]); | 397 assertKind(elements_kind.fast_smi_only, obj[1]); |
| 410 assertKind(elements_kind.fast, obj[2]); | 398 assertKind(elements_kind.fast, obj[2]); |
| 411 | 399 |
| 412 // A more complex nested literal case. | 400 // A more complex nested literal case. |
| 413 function get_deep_nested_literal() { | 401 function get_deep_nested_literal() { |
| 414 var literal = [[1], [[2], "hello"], 3, [4]]; | 402 var literal = [[1], [[2], "hello"], 3, [4]]; |
| 415 return literal; | 403 return literal; |
| 416 } | 404 } |
| 417 | 405 |
| 418 get_deep_nested_literal(); // Skip premonomorphic state. | |
| 419 obj = get_deep_nested_literal(); | 406 obj = get_deep_nested_literal(); |
| 420 assertKind(elements_kind.fast_smi_only, obj[1][0]); | 407 assertKind(elements_kind.fast_smi_only, obj[1][0]); |
| 421 obj[0][0] = 3.5; | 408 obj[0][0] = 3.5; |
| 422 obj[1][0][0] = "goodbye"; | 409 obj[1][0][0] = "goodbye"; |
| 423 assertKind(elements_kind.fast_double, obj[0]); | 410 assertKind(elements_kind.fast_double, obj[0]); |
| 424 assertKind(elements_kind.fast, obj[1][0]); | 411 assertKind(elements_kind.fast, obj[1][0]); |
| 425 | 412 |
| 426 obj = get_deep_nested_literal(); | 413 obj = get_deep_nested_literal(); |
| 427 assertKind(elements_kind.fast_double, obj[0]); | 414 assertKind(elements_kind.fast_double, obj[0]); |
| 428 assertKind(elements_kind.fast, obj[1][0]); | 415 assertKind(elements_kind.fast, obj[1][0]); |
| 429 })(); | 416 })(); |
| 430 | 417 |
| 431 | 418 |
| 432 // Make sure object literals with array fields benefit from the type feedback | 419 // Make sure object literals with array fields benefit from the type feedback |
| 433 // that allocation mementos provide. | 420 // that allocation mementos provide. |
| 434 (function() { | 421 (function() { |
| 435 // A literal in an object | 422 // A literal in an object |
| 436 function get_object_literal() { | 423 function get_object_literal() { |
| 437 var literal = { | 424 var literal = { |
| 438 array: [1,2,3], | 425 array: [1,2,3], |
| 439 data: 3.5 | 426 data: 3.5 |
| 440 }; | 427 }; |
| 441 return literal; | 428 return literal; |
| 442 } | 429 } |
| 443 | 430 |
| 444 get_object_literal(); // Skip premonomorphic state. | |
| 445 obj = get_object_literal(); | 431 obj = get_object_literal(); |
| 446 assertKind(elements_kind.fast_smi_only, obj.array); | 432 assertKind(elements_kind.fast_smi_only, obj.array); |
| 447 obj.array[1] = 3.5; | 433 obj.array[1] = 3.5; |
| 448 assertKind(elements_kind.fast_double, obj.array); | 434 assertKind(elements_kind.fast_double, obj.array); |
| 449 obj = get_object_literal(); | 435 obj = get_object_literal(); |
| 450 assertKind(elements_kind.fast_double, obj.array); | 436 assertKind(elements_kind.fast_double, obj.array); |
| 451 | 437 |
| 452 function get_nested_object_literal() { | 438 function get_nested_object_literal() { |
| 453 var literal = { | 439 var literal = { |
| 454 array: [[1],[2],[3]], | 440 array: [[1],[2],[3]], |
| 455 data: 3.5 | 441 data: 3.5 |
| 456 }; | 442 }; |
| 457 return literal; | 443 return literal; |
| 458 } | 444 } |
| 459 | 445 |
| 460 get_nested_object_literal(); // Skip premonomorphic state. | |
| 461 obj = get_nested_object_literal(); | 446 obj = get_nested_object_literal(); |
| 462 assertKind(elements_kind.fast, obj.array); | 447 assertKind(elements_kind.fast, obj.array); |
| 463 assertKind(elements_kind.fast_smi_only, obj.array[1]); | 448 assertKind(elements_kind.fast_smi_only, obj.array[1]); |
| 464 obj.array[1][0] = 3.5; | 449 obj.array[1][0] = 3.5; |
| 465 assertKind(elements_kind.fast_double, obj.array[1]); | 450 assertKind(elements_kind.fast_double, obj.array[1]); |
| 466 obj = get_nested_object_literal(); | 451 obj = get_nested_object_literal(); |
| 467 assertKind(elements_kind.fast_double, obj.array[1]); | 452 assertKind(elements_kind.fast_double, obj.array[1]); |
| 468 | 453 |
| 469 %OptimizeFunctionOnNextCall(get_nested_object_literal); | 454 %OptimizeFunctionOnNextCall(get_nested_object_literal); |
| 470 get_nested_object_literal(); | 455 get_nested_object_literal(); |
| 471 obj = get_nested_object_literal(); | 456 obj = get_nested_object_literal(); |
| 472 assertKind(elements_kind.fast_double, obj.array[1]); | 457 assertKind(elements_kind.fast_double, obj.array[1]); |
| 473 | 458 |
| 474 // Make sure we handle nested arrays | 459 // Make sure we handle nested arrays |
| 475 function get_nested_literal() { | 460 function get_nested_literal() { |
| 476 var literal = [[1,2,3,4], [2], [3]]; | 461 var literal = [[1,2,3,4], [2], [3]]; |
| 477 return literal; | 462 return literal; |
| 478 } | 463 } |
| 479 | 464 |
| 480 get_nested_literal(); // Skip premonomorphic state. | |
| 481 obj = get_nested_literal(); | 465 obj = get_nested_literal(); |
| 482 assertKind(elements_kind.fast, obj); | 466 assertKind(elements_kind.fast, obj); |
| 483 obj[0][0] = 3.5; | 467 obj[0][0] = 3.5; |
| 484 obj[2][0] = "hello"; | 468 obj[2][0] = "hello"; |
| 485 obj = get_nested_literal(); | 469 obj = get_nested_literal(); |
| 486 assertKind(elements_kind.fast_double, obj[0]); | 470 assertKind(elements_kind.fast_double, obj[0]); |
| 487 assertKind(elements_kind.fast_smi_only, obj[1]); | 471 assertKind(elements_kind.fast_smi_only, obj[1]); |
| 488 assertKind(elements_kind.fast, obj[2]); | 472 assertKind(elements_kind.fast, obj[2]); |
| 489 | 473 |
| 490 // A more complex nested literal case. | 474 // A more complex nested literal case. |
| 491 function get_deep_nested_literal() { | 475 function get_deep_nested_literal() { |
| 492 var literal = [[1], [[2], "hello"], 3, [4]]; | 476 var literal = [[1], [[2], "hello"], 3, [4]]; |
| 493 return literal; | 477 return literal; |
| 494 } | 478 } |
| 495 | 479 |
| 496 get_deep_nested_literal(); // Skip premonomorphic state. | |
| 497 obj = get_deep_nested_literal(); | 480 obj = get_deep_nested_literal(); |
| 498 assertKind(elements_kind.fast_smi_only, obj[1][0]); | 481 assertKind(elements_kind.fast_smi_only, obj[1][0]); |
| 499 obj[0][0] = 3.5; | 482 obj[0][0] = 3.5; |
| 500 obj[1][0][0] = "goodbye"; | 483 obj[1][0][0] = "goodbye"; |
| 501 assertKind(elements_kind.fast_double, obj[0]); | 484 assertKind(elements_kind.fast_double, obj[0]); |
| 502 assertKind(elements_kind.fast, obj[1][0]); | 485 assertKind(elements_kind.fast, obj[1][0]); |
| 503 | 486 |
| 504 obj = get_deep_nested_literal(); | 487 obj = get_deep_nested_literal(); |
| 505 assertKind(elements_kind.fast_double, obj[0]); | 488 assertKind(elements_kind.fast_double, obj[0]); |
| 506 assertKind(elements_kind.fast, obj[1][0]); | 489 assertKind(elements_kind.fast, obj[1][0]); |
| 507 })(); | 490 })(); |
| 508 } | 491 } |
| OLD | NEW |