Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1979)

Unified Diff: test/mjsunit/array-constructor-feedback.js

Issue 1086873003: Array() in optimized code can create with wrong ElementsKind in corner cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments and test failure. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/array-feedback.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
+})();
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/array-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698