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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 a = bar(100); 209 a = bar(100);
210 assertTrue(isHoley(a)); 210 assertTrue(isHoley(a));
211 a = bar(0); 211 a = bar(0);
212 assertOptimized(bar); 212 assertOptimized(bar);
213 // Crankshafted functions don't use mementos, so feedback still 213 // Crankshafted functions don't use mementos, so feedback still
214 // indicates a packed array is desired. (unless --nocrankshaft is in use). 214 // indicates a packed array is desired. (unless --nocrankshaft is in use).
215 if (4 != %GetOptimizationStatus(bar)) { 215 if (4 != %GetOptimizationStatus(bar)) {
216 assertFalse(isHoley(a)); 216 assertFalse(isHoley(a));
217 } 217 }
218 })(); 218 })();
219
220 // Test: Make sure that crankshaft continues with feedback for large arrays.
221 (function() {
222 function bar(len) { return new Array(len); }
223 var size = 100001;
224 // Perform a gc, because we are allocating a very large array and if a gc
225 // happens during the allocation we could lose our memento.
226 gc();
227 bar(size)[0] = 'string';
228 var res = bar(size);
229 assertKind(elements_kind.fast, bar(size));
230 %OptimizeFunctionOnNextCall(bar);
231 assertKind(elements_kind.fast, bar(size));
232 // But there is a limit, based on the size of the old generation, currently
233 // 22937600, but double it to prevent the test being too brittle.
234 var large_size = 22937600 * 2;
235 assertKind(elements_kind.dictionary, bar(large_size));
236 })();
OLDNEW
« 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