OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 expected_array_value(7)); | 271 expected_array_value(7)); |
272 | 272 |
273 delete large_array[5]; | 273 delete large_array[5]; |
274 delete large_array[6]; | 274 delete large_array[6]; |
275 test_various_loads6(large_array, | 275 test_various_loads6(large_array, |
276 undefined, | 276 undefined, |
277 undefined, | 277 undefined, |
278 expected_array_value(7)); | 278 expected_array_value(7)); |
279 | 279 |
280 %DeoptimizeFunction(test_various_loads6); | 280 %DeoptimizeFunction(test_various_loads6); |
281 %ClearFunctionTypeFeedback(test_various_stores); | 281 gc(); |
282 %ClearFunctionTypeFeedback(test_various_loads7); | |
283 | 282 |
284 // Test stores for non-NaN. | 283 // Test stores for non-NaN. |
285 var large_array = new allocator(large_array_size); | 284 var large_array = new allocator(large_array_size); |
286 force_to_fast_double_array(large_array); | 285 force_to_fast_double_array(large_array); |
287 %OptimizeFunctionOnNextCall(test_various_stores); | 286 %OptimizeFunctionOnNextCall(test_various_stores); |
288 test_various_stores(large_array, | 287 test_various_stores(large_array, |
289 expected_array_value(5), | 288 expected_array_value(5), |
290 expected_array_value(6), | 289 expected_array_value(6), |
291 expected_array_value(7)); | 290 expected_array_value(7)); |
292 | 291 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 assertEquals(large_array_size+10002, large_array.length); | 369 assertEquals(large_array_size+10002, large_array.length); |
371 | 370 |
372 // Test dictionary -> double elements -> fast elements. | 371 // Test dictionary -> double elements -> fast elements. |
373 var large_array2 = new Array(large_array_size); | 372 var large_array2 = new Array(large_array_size); |
374 force_to_fast_double_array(large_array2); | 373 force_to_fast_double_array(large_array2); |
375 delete large_array2[5]; | 374 delete large_array2[5]; |
376 | 375 |
377 // Convert back to fast elements and make sure the contents of the array are | 376 // Convert back to fast elements and make sure the contents of the array are |
378 // unchanged. | 377 // unchanged. |
379 large_array2[25] = new Object(); | 378 large_array2[25] = new Object(); |
380 assertTrue(%HasFastObjectElements(large_array2)); | 379 assertTrue(%HasFastElements(large_array2)); |
381 for (var i= 0; i < approx_dict_to_elements_threshold; i += 500 ) { | 380 for (var i= 0; i < approx_dict_to_elements_threshold; i += 500 ) { |
382 if (i != 25 && i != 5) { | 381 if (i != 25 && i != 5) { |
383 assertEquals(expected_array_value(i), large_array2[i]); | 382 assertEquals(expected_array_value(i), large_array2[i]); |
384 } | 383 } |
385 } | 384 } |
386 assertEquals(undefined, large_array2[5]); | 385 assertEquals(undefined, large_array2[5]); |
387 assertEquals(undefined, large_array2[large_array_size-1]); | 386 assertEquals(undefined, large_array2[large_array_size-1]); |
388 assertEquals(undefined, large_array2[-1]); | 387 assertEquals(undefined, large_array2[-1]); |
389 assertEquals(large_array_size, large_array2.length); | 388 assertEquals(large_array_size, large_array2.length); |
390 | 389 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 assertEquals(expected_array_value(2), large_array4[2]); | 537 assertEquals(expected_array_value(2), large_array4[2]); |
539 } | 538 } |
540 | 539 |
541 test_setter(); | 540 test_setter(); |
542 test_setter(); | 541 test_setter(); |
543 test_setter(); | 542 test_setter(); |
544 %OptimizeFunctionOnNextCall(test_setter); | 543 %OptimizeFunctionOnNextCall(test_setter); |
545 test_setter(); | 544 test_setter(); |
546 test_setter(); | 545 test_setter(); |
547 test_setter(); | 546 test_setter(); |
OLD | NEW |