Index: test/mjsunit/array-constructor-feedback.js |
diff --git a/test/mjsunit/array-constructor-feedback.js b/test/mjsunit/array-constructor-feedback.js |
index e14c344278de85efc71f6b8d6f45be245038b00a..4c3a28f17ad16f2e62e9e625fff46487c0fb6f62 100644 |
--- a/test/mjsunit/array-constructor-feedback.js |
+++ b/test/mjsunit/array-constructor-feedback.js |
@@ -216,3 +216,21 @@ function assertKind(expected, obj, name_opt) { |
assertFalse(isHoley(a)); |
} |
})(); |
+ |
+// Test: Make sure that crankshaft continues with feedback for large arrays. |
+(function() { |
+ function bar(len) { return new Array(len); } |
+ var size = 100001; |
+ // Perform a gc, because we are allocating a very large array and if a gc |
+ // happens during the allocation we could lose our memento. |
+ gc(); |
+ bar(size)[0] = 'string'; |
+ var res = bar(size); |
+ assertKind(elements_kind.fast, bar(size)); |
+ %OptimizeFunctionOnNextCall(bar); |
+ assertKind(elements_kind.fast, bar(size)); |
+ // But there is a limit, based on the size of the old generation, currently |
+ // 22937600, but double it to prevent the test being too brittle. |
+ var large_size = 22937600 * 2; |
+ assertKind(elements_kind.dictionary, bar(large_size)); |
+})(); |