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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bar(size)[10] = 'string'; |
| 225 assertKind(elements_kind.fast, bar(size)); |
| 226 %OptimizeFunctionOnNextCall(bar); |
| 227 assertKind(elements_kind.fast, bar(size)); |
| 228 // But there is a limit, based on the size of the old generation, currently |
| 229 // 22937600, but double it to prevent the test being too brittle. |
| 230 var large_size = 22937600 * 2; |
| 231 assertKind(elements_kind.dictionary, bar(large_size)); |
| 232 })(); |
OLD | NEW |