Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index fe0683e047b5bc1da46b8c3506da8c333247ca42..91ceb2fa990a15166aca2e4d95ae008d03a40ff8 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -487,11 +487,20 @@ MaybeObject* JSObject::SetNormalizedProperty(String* name, |
| set_properties(StringDictionary::cast(dict)); |
| return value; |
| } |
| - // Preserve enumeration index. |
| + |
| + PropertyDetails original_details = property_dictionary()->DetailsAt(entry); |
| + int enumeration_index; |
| + // Preserve the enumeration index unless the property was deleted. |
| + if (original_details.IsDeleted()) { |
| + enumeration_index = property_dictionary()->NextEnumerationIndex(); |
| + property_dictionary()->SetNextEnumerationIndex(enumeration_index + 1); |
| + } else { |
| + enumeration_index = original_details.dictionary_index(); |
| + ASSERT(enumeration_index != 0); |
|
Michael Starzinger
2012/09/13 08:51:18
We could assert for enumeration_index > 0 here. Ju
|
| + } |
| + |
| details = PropertyDetails( |
| - details.attributes(), |
| - details.type(), |
| - property_dictionary()->DetailsAt(entry).dictionary_index()); |
| + details.attributes(), details.type(), enumeration_index); |
| if (IsGlobalObject()) { |
| JSGlobalPropertyCell* cell = |