| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 if (!IS_UNDEFINED(result)) return result; | 392 if (!IS_UNDEFINED(result)) return result; |
| 393 | 393 |
| 394 return Join(this, length, separator, ConvertToString); | 394 return Join(this, length, separator, ConvertToString); |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 function ObservedArrayPop(n) { | 398 function ObservedArrayPop(n) { |
| 399 n--; | 399 n--; |
| 400 var value = this[n]; | 400 var value = this[n]; |
| 401 | 401 |
| 402 EnqueueSpliceRecord(this, n, [value], 1, 0); | 402 EnqueueSpliceRecord(this, n, [value], 0); |
| 403 | 403 |
| 404 try { | 404 try { |
| 405 BeginPerformSplice(this); | 405 BeginPerformSplice(this); |
| 406 delete this[n]; | 406 delete this[n]; |
| 407 this.length = n; | 407 this.length = n; |
| 408 } finally { | 408 } finally { |
| 409 EndPerformSplice(this); | 409 EndPerformSplice(this); |
| 410 } | 410 } |
| 411 | 411 |
| 412 return value; | 412 return value; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 434 delete this[n]; | 434 delete this[n]; |
| 435 this.length = n; | 435 this.length = n; |
| 436 return value; | 436 return value; |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 function ObservedArrayPush() { | 440 function ObservedArrayPush() { |
| 441 var n = TO_UINT32(this.length); | 441 var n = TO_UINT32(this.length); |
| 442 var m = %_ArgumentsLength(); | 442 var m = %_ArgumentsLength(); |
| 443 | 443 |
| 444 EnqueueSpliceRecord(this, n, [], 0, m); | 444 EnqueueSpliceRecord(this, n, [], m); |
| 445 | 445 |
| 446 try { | 446 try { |
| 447 BeginPerformSplice(this); | 447 BeginPerformSplice(this); |
| 448 for (var i = 0; i < m; i++) { | 448 for (var i = 0; i < m; i++) { |
| 449 this[i+n] = %_Arguments(i); | 449 this[i+n] = %_Arguments(i); |
| 450 } | 450 } |
| 451 this.length = n + m; | 451 this.length = n + m; |
| 452 } finally { | 452 } finally { |
| 453 EndPerformSplice(this); | 453 EndPerformSplice(this); |
| 454 } | 454 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 574 } |
| 575 } | 575 } |
| 576 } | 576 } |
| 577 return this; | 577 return this; |
| 578 } | 578 } |
| 579 | 579 |
| 580 | 580 |
| 581 function ObservedArrayShift(len) { | 581 function ObservedArrayShift(len) { |
| 582 var first = this[0]; | 582 var first = this[0]; |
| 583 | 583 |
| 584 EnqueueSpliceRecord(this, 0, [first], 1, 0); | 584 EnqueueSpliceRecord(this, 0, [first], 0); |
| 585 | 585 |
| 586 try { | 586 try { |
| 587 BeginPerformSplice(this); | 587 BeginPerformSplice(this); |
| 588 SimpleMove(this, 0, 1, len, 0); | 588 SimpleMove(this, 0, 1, len, 0); |
| 589 this.length = len - 1; | 589 this.length = len - 1; |
| 590 } finally { | 590 } finally { |
| 591 EndPerformSplice(this); | 591 EndPerformSplice(this); |
| 592 } | 592 } |
| 593 | 593 |
| 594 return first; | 594 return first; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 620 | 620 |
| 621 this.length = len - 1; | 621 this.length = len - 1; |
| 622 | 622 |
| 623 return first; | 623 return first; |
| 624 } | 624 } |
| 625 | 625 |
| 626 function ObservedArrayUnshift() { | 626 function ObservedArrayUnshift() { |
| 627 var len = TO_UINT32(this.length); | 627 var len = TO_UINT32(this.length); |
| 628 var num_arguments = %_ArgumentsLength(); | 628 var num_arguments = %_ArgumentsLength(); |
| 629 | 629 |
| 630 EnqueueSpliceRecord(this, 0, [], 0, num_arguments); | 630 EnqueueSpliceRecord(this, 0, [], num_arguments); |
| 631 | 631 |
| 632 try { | 632 try { |
| 633 BeginPerformSplice(this); | 633 BeginPerformSplice(this); |
| 634 SimpleMove(this, 0, 0, len, num_arguments); | 634 SimpleMove(this, 0, 0, len, num_arguments); |
| 635 for (var i = 0; i < num_arguments; i++) { | 635 for (var i = 0; i < num_arguments; i++) { |
| 636 this[i] = %_Arguments(i); | 636 this[i] = %_Arguments(i); |
| 637 } | 637 } |
| 638 this.length = len + num_arguments; | 638 this.length = len + num_arguments; |
| 639 } finally { | 639 } finally { |
| 640 EndPerformSplice(this); | 640 EndPerformSplice(this); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 this[i++] = %_Arguments(arguments_index++); | 772 this[i++] = %_Arguments(arguments_index++); |
| 773 } | 773 } |
| 774 this.length = len - del_count + num_elements_to_add; | 774 this.length = len - del_count + num_elements_to_add; |
| 775 | 775 |
| 776 } finally { | 776 } finally { |
| 777 EndPerformSplice(this); | 777 EndPerformSplice(this); |
| 778 if (deleted_elements.length || num_elements_to_add) { | 778 if (deleted_elements.length || num_elements_to_add) { |
| 779 EnqueueSpliceRecord(this, | 779 EnqueueSpliceRecord(this, |
| 780 start_i, | 780 start_i, |
| 781 deleted_elements.slice(), | 781 deleted_elements.slice(), |
| 782 deleted_elements.length, | |
| 783 num_elements_to_add); | 782 num_elements_to_add); |
| 784 } | 783 } |
| 785 } | 784 } |
| 786 | 785 |
| 787 // Return the deleted elements. | 786 // Return the deleted elements. |
| 788 return deleted_elements; | 787 return deleted_elements; |
| 789 } | 788 } |
| 790 | 789 |
| 791 | 790 |
| 792 function ArraySplice(start, delete_count) { | 791 function ArraySplice(start, delete_count) { |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 )); | 1656 )); |
| 1658 | 1657 |
| 1659 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( | 1658 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( |
| 1660 "join", getFunction("join", ArrayJoin), | 1659 "join", getFunction("join", ArrayJoin), |
| 1661 "pop", getFunction("pop", ArrayPop), | 1660 "pop", getFunction("pop", ArrayPop), |
| 1662 "push", getFunction("push", ArrayPush) | 1661 "push", getFunction("push", ArrayPush) |
| 1663 )); | 1662 )); |
| 1664 } | 1663 } |
| 1665 | 1664 |
| 1666 SetUpArray(); | 1665 SetUpArray(); |
| OLD | NEW |