Index: test/mjsunit/allocation-site-info.js |
diff --git a/test/mjsunit/allocation-site-info.js b/test/mjsunit/allocation-site-info.js |
index b8b1076ff9f11450f18f6821c4514b63df9a5d6c..442d108928eaad02e911ca60871c03642233d81f 100644 |
--- a/test/mjsunit/allocation-site-info.js |
+++ b/test/mjsunit/allocation-site-info.js |
@@ -282,6 +282,32 @@ if (support_smi_only_arrays) { |
obj = newarraycase_list_smiobj(2); |
assertKind(elements_kind.fast, obj); |
+ // Case: array constructor calls with out of date feedback. |
+ // The boilerplate should incorporate all feedback, but the input array |
+ // should be minimally transitioned based on immediate need. |
+ (function() { |
+ function foo(i) { |
+ // We have two cases, one for literals one for constructed arrays. |
+ var a = (i == 0) |
+ ? [1, 2, 3] |
+ : new Array(1, 2, 3); |
+ return a; |
+ } |
+ |
+ for (i = 0; i < 2; i++) { |
+ a = foo(i); |
+ b = foo(i); |
+ b[5] = 1; // boilerplate goes holey |
+ assertHoley(foo(i)); |
+ a[0] = 3.5; // boilerplate goes holey double |
+ assertKind(elements_kind.fast_double, a); |
+ assertNotHoley(a); |
+ c = foo(i); |
+ assertKind(elements_kind.fast_double, c); |
+ assertHoley(c); |
+ } |
+ })(); |
+ |
function newarraycase_onearg(len, value) { |
var a = new Array(len); |
a[0] = value; |