Chromium Code Reviews| Index: src/array.js |
| diff --git a/src/array.js b/src/array.js |
| index 54f0b486e29a722a86a649d21666122b455e2d88..50cc7dd8598edf941e888c7aa7339f44af772c70 100644 |
| --- a/src/array.js |
| +++ b/src/array.js |
| @@ -416,6 +416,27 @@ function ArrayPop() { |
| } |
| +function ObservedArrayPush() { |
| + var n = TO_UINT32(this.length); |
| + var m = %_ArgumentsLength(); |
| + |
| + EnqueueSpliceRecord(this, n, [], 0, m); |
| + |
| + try { |
| + BeginPerformSplice(this); |
| + |
| + for (var i = 0; i < m; i++) { |
| + this[i+n] = %_Arguments(i); |
| + } |
| + this.length = n + m; |
| + |
|
adamk
2013/05/16 00:45:30
Nit: no need for this blank line
rafaelw
2013/05/16 01:10:48
Done.
|
| + } finally { |
| + EndPerformSplice(this); |
| + } |
| + |
| + return this.length; |
| +} |
| + |
| // Appends the arguments to the end of the array and returns the new |
| // length of the array. See ECMA-262, section 15.4.4.7. |
| function ArrayPush() { |
| @@ -424,6 +445,9 @@ function ArrayPush() { |
| ["Array.prototype.push"]); |
| } |
| + if (%IsObserved(this)) |
| + return ObservedArrayPush.apply(this, arguments); |
| + |
| var n = TO_UINT32(this.length); |
| var m = %_ArgumentsLength(); |
| for (var i = 0; i < m; i++) { |