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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 var array = {0: 1, 1: 2, 2: 3, length: 3}; | 583 var array = {0: 1, 1: 2, 2: 3, length: 3}; |
584 Object.observe(array, observer.callback); | 584 Object.observe(array, observer.callback); |
585 Array.prototype.splice.call(array, 1, 1, 4, 5); | 585 Array.prototype.splice.call(array, 1, 1, 4, 5); |
586 Object.deliverChangeRecords(observer.callback); | 586 Object.deliverChangeRecords(observer.callback); |
587 observer.assertCallbackRecords([ | 587 observer.assertCallbackRecords([ |
588 { object: array, name: '3', type: 'new' }, | 588 { object: array, name: '3', type: 'new' }, |
589 { object: array, name: '1', type: 'updated', oldValue: 2 }, | 589 { object: array, name: '1', type: 'updated', oldValue: 2 }, |
590 { object: array, name: '2', type: 'updated', oldValue: 3 }, | 590 { object: array, name: '2', type: 'updated', oldValue: 3 }, |
591 { object: array, name: 'length', type: 'updated', oldValue: 3 }, | 591 { object: array, name: 'length', type: 'updated', oldValue: 3 }, |
592 ]); | 592 ]); |
| 593 |
| 594 // Exercise StoreIC_ArrayLength |
| 595 reset(); |
| 596 var dummy = {}; |
| 597 Object.observe(dummy, observer.callback); |
| 598 Object.unobserve(dummy, observer.callback); |
| 599 var array = [0]; |
| 600 Object.observe(array, observer.callback); |
| 601 array.splice(0, 1); |
| 602 Object.deliverChangeRecords(observer.callback); |
| 603 observer.assertCallbackRecords([ |
| 604 { object: array, name: '0', type: 'deleted', oldValue: 0 }, |
| 605 { object: array, name: 'length', type: 'updated', oldValue: 1}, |
| 606 ]); |
OLD | NEW |