Chromium Code Reviews| Index: src/array.js |
| diff --git a/src/array.js b/src/array.js |
| index 155d5659415c6eb5bccc84e221f477100da448ee..37053ce67e5fe8762d580f303c880acd3db513b0 100644 |
| --- a/src/array.js |
| +++ b/src/array.js |
| @@ -441,8 +441,8 @@ function ArrayPop() { |
| } |
| n--; |
| var value = this[n]; |
| - this.length = n; |
| delete this[n]; |
|
adamk
2012/11/09 12:06:30
This change is required for proper operation, and
|
| + this.length = n; |
| return value; |
| } |
| @@ -581,7 +581,7 @@ function ArrayShift() { |
| var first = this[0]; |
| - if (IS_ARRAY(this)) { |
| + if (IS_ARRAY(this) && !%IsObserved(this)) { |
| SmartMove(this, 0, 1, len, 0); |
| } else { |
| SimpleMove(this, 0, 1, len, 0); |
| @@ -602,7 +602,7 @@ function ArrayUnshift(arg1) { // length == 1 |
| var len = TO_UINT32(this.length); |
| var num_arguments = %_ArgumentsLength(); |
| - if (IS_ARRAY(this)) { |
| + if (IS_ARRAY(this) && !%IsObserved(this)) { |
| SmartMove(this, 0, 0, len, num_arguments); |
| } else { |
| SimpleMove(this, 0, 0, len, num_arguments); |
| @@ -649,6 +649,7 @@ function ArraySlice(start, end) { |
| if (end_i < start_i) return result; |
| if (IS_ARRAY(this) && |
| + !%IsObserved(this) && |
| (end_i > 1000) && |
| (%EstimateNumberOfElements(this) < end_i)) { |
| SmartSlice(this, start_i, end_i - start_i, len, result); |
| @@ -705,7 +706,9 @@ function ArraySplice(start, delete_count) { |
| var use_simple_splice = true; |
| - if (IS_ARRAY(this) && num_additional_args !== del_count) { |
| + if (IS_ARRAY(this) && |
| + !%IsObserved(this) && |
| + num_additional_args !== del_count) { |
| // If we are only deleting/moving a few things near the end of the |
| // array then the simple version is going to be faster, because it |
| // doesn't touch most of the array. |