OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 assertTrue(next_expected == 96); | 459 assertTrue(next_expected == 96); |
460 } | 460 } |
461 | 461 |
462 test_for_in(); | 462 test_for_in(); |
463 test_for_in(); | 463 test_for_in(); |
464 test_for_in(); | 464 test_for_in(); |
465 %OptimizeFunctionOnNextCall(test_for_in); | 465 %OptimizeFunctionOnNextCall(test_for_in); |
466 test_for_in(); | 466 test_for_in(); |
467 test_for_in(); | 467 test_for_in(); |
468 test_for_in(); | 468 test_for_in(); |
| 469 |
| 470 // Test elements getters. |
| 471 assertEquals(expected_array_value(10), large_array3[10]); |
| 472 assertEquals(expected_array_value(-NaN), large_array3[2]); |
| 473 large_array3.__defineGetter__("2", function(){ |
| 474 return expected_array_value(10); |
| 475 }); |
| 476 |
| 477 function test_getter() { |
| 478 assertEquals(expected_array_value(10), large_array3[10]); |
| 479 assertEquals(expected_array_value(10), large_array3[2]); |
| 480 } |
| 481 |
| 482 test_getter(); |
| 483 test_getter(); |
| 484 test_getter(); |
| 485 %OptimizeFunctionOnNextCall(test_getter); |
| 486 test_getter(); |
| 487 test_getter(); |
| 488 test_getter(); |
| 489 |
| 490 // Test element setters. |
| 491 large_array4 = new Array(large_array_size); |
| 492 force_to_fast_double_array(large_array4); |
| 493 |
| 494 var setter_called = false; |
| 495 |
| 496 assertEquals(expected_array_value(10), large_array4[10]); |
| 497 assertEquals(expected_array_value(2), large_array4[2]); |
| 498 large_array4.__defineSetter__("10", function(value){ |
| 499 setter_called = true; |
| 500 }); |
| 501 |
| 502 function test_setter() { |
| 503 setter_called = false; |
| 504 large_array4[10] = 119; |
| 505 assertTrue(setter_called); |
| 506 assertEquals(undefined, large_array4[10]); |
| 507 assertEquals(expected_array_value(2), large_array4[2]); |
| 508 } |
| 509 |
| 510 test_setter(); |
| 511 test_setter(); |
| 512 test_setter(); |
| 513 %OptimizeFunctionOnNextCall(test_setter); |
| 514 test_setter(); |
| 515 test_setter(); |
| 516 test_setter(); |
OLD | NEW |