Chromium Code Reviews| Index: src/v8natives.js |
| diff --git a/src/v8natives.js b/src/v8natives.js |
| index 4c56fd16efb66a224a94cad9357bd246e3d9b073..7082e2d949e43c0fe37cf71142c7d258de34ed64 100644 |
| --- a/src/v8natives.js |
| +++ b/src/v8natives.js |
| @@ -925,34 +925,36 @@ function DefineArrayProperty(obj, p, desc, should_throw) { |
| } |
| // Step 4 - Special handling for array index. |
| - var index = ToUint32(p); |
| - var emit_splice = false; |
| - if (ToString(index) == p && index != 4294967295) { |
| - var length = obj.length; |
| - if (index >= length && %IsObserved(obj)) { |
| - emit_splice = true; |
| - BeginPerformSplice(obj); |
| - } |
| + if (typeof p !== "symbol") { |
|
Dmitry Lomov (no reviews)
2014/08/11 17:58:51
!IS_SYMBOL(p) is how we typically do it
|
| + var index = ToUint32(p); |
| + var emit_splice = false; |
| + if (ToString(index) == p && index != 4294967295) { |
| + var length = obj.length; |
| + if (index >= length && %IsObserved(obj)) { |
| + emit_splice = true; |
| + BeginPerformSplice(obj); |
| + } |
| - var length_desc = GetOwnPropertyJS(obj, "length"); |
| - if ((index >= length && !length_desc.isWritable()) || |
| - !DefineObjectProperty(obj, p, desc, true)) { |
| - if (emit_splice) |
| + var length_desc = GetOwnPropertyJS(obj, "length"); |
| + if ((index >= length && !length_desc.isWritable()) || |
| + !DefineObjectProperty(obj, p, desc, true)) { |
| + if (emit_splice) |
| + EndPerformSplice(obj); |
| + if (should_throw) { |
| + throw MakeTypeError("define_disallowed", [p]); |
| + } else { |
| + return false; |
| + } |
| + } |
| + if (index >= length) { |
| + obj.length = index + 1; |
| + } |
| + if (emit_splice) { |
| EndPerformSplice(obj); |
| - if (should_throw) { |
| - throw MakeTypeError("define_disallowed", [p]); |
| - } else { |
| - return false; |
| + EnqueueSpliceRecord(obj, length, [], index + 1 - length); |
| } |
| + return true; |
| } |
| - if (index >= length) { |
| - obj.length = index + 1; |
| - } |
| - if (emit_splice) { |
| - EndPerformSplice(obj); |
| - EnqueueSpliceRecord(obj, length, [], index + 1 - length); |
| - } |
| - return true; |
| } |
| // Step 5 - Fallback to default implementation. |