Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 57882a4d20a0f8f3a64c9919c39d94c86f64df30..45d108b1ca424091d28043fca6f0e75866900d50 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 = |