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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 obj[0][0] = 3.5; | 407 obj[0][0] = 3.5; |
408 obj[1][0][0] = "goodbye"; | 408 obj[1][0][0] = "goodbye"; |
409 assertKind(elements_kind.fast_double, obj[0]); | 409 assertKind(elements_kind.fast_double, obj[0]); |
410 assertKind(elements_kind.fast, obj[1][0]); | 410 assertKind(elements_kind.fast, obj[1][0]); |
411 | 411 |
412 obj = get_deep_nested_literal(); | 412 obj = get_deep_nested_literal(); |
413 assertKind(elements_kind.fast_double, obj[0]); | 413 assertKind(elements_kind.fast_double, obj[0]); |
414 assertKind(elements_kind.fast, obj[1][0]); | 414 assertKind(elements_kind.fast, obj[1][0]); |
415 })(); | 415 })(); |
416 | 416 |
| 417 // Perform a gc because without it the test below can experience an |
| 418 // allocation failure at an inconvenient point. Allocation mementos get |
| 419 // cleared on gc, and they can't deliver elements kind feedback when that |
| 420 // happens. |
| 421 gc(); |
417 | 422 |
418 // Make sure object literals with array fields benefit from the type feedback | 423 // Make sure object literals with array fields benefit from the type feedback |
419 // that allocation mementos provide. | 424 // that allocation mementos provide. |
420 (function() { | 425 (function() { |
421 // A literal in an object | 426 // A literal in an object |
422 function get_object_literal() { | 427 function get_object_literal() { |
423 var literal = { | 428 var literal = { |
424 array: [1,2,3], | 429 array: [1,2,3], |
425 data: 3.5 | 430 data: 3.5 |
426 }; | 431 }; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 obj[0][0] = 3.5; | 486 obj[0][0] = 3.5; |
482 obj[1][0][0] = "goodbye"; | 487 obj[1][0][0] = "goodbye"; |
483 assertKind(elements_kind.fast_double, obj[0]); | 488 assertKind(elements_kind.fast_double, obj[0]); |
484 assertKind(elements_kind.fast, obj[1][0]); | 489 assertKind(elements_kind.fast, obj[1][0]); |
485 | 490 |
486 obj = get_deep_nested_literal(); | 491 obj = get_deep_nested_literal(); |
487 assertKind(elements_kind.fast_double, obj[0]); | 492 assertKind(elements_kind.fast_double, obj[0]); |
488 assertKind(elements_kind.fast, obj[1][0]); | 493 assertKind(elements_kind.fast, obj[1][0]); |
489 })(); | 494 })(); |
490 } | 495 } |
OLD | NEW |