Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index fe0683e047b5bc1da46b8c3506da8c333247ca42..a7d6faa5e6ca06a8c0e53662dd58bfa1a22a27f1 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); |
+ } |
+ |
details = PropertyDetails( |
- details.attributes(), |
- details.type(), |
- property_dictionary()->DetailsAt(entry).dictionary_index()); |
+ details.attributes(), details.type(), enumeration_index); |
if (IsGlobalObject()) { |
JSGlobalPropertyCell* cell = |