Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index d3d2d8fdeaa72ecd0f12655e9615f9325f76111f..eedd9ee193201a33a34992225d64615f8f11ea82 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -3773,12 +3773,14 @@ MaybeObject* JSObject::GetHiddenPropertiesDictionary(bool create_if_absent) { |
// code zero) it will always occupy the first entry if present. |
DescriptorArray* descriptors = this->map()->instance_descriptors(); |
if ((descriptors->number_of_descriptors() > 0) && |
- (descriptors->GetKey(0) == GetHeap()->hidden_symbol()) && |
- descriptors->IsProperty(0)) { |
- ASSERT(descriptors->GetType(0) == FIELD); |
- Object* hidden_store = |
- this->FastPropertyAt(descriptors->GetFieldIndex(0)); |
- return StringDictionary::cast(hidden_store); |
+ (descriptors->GetKey(0) == GetHeap()->hidden_symbol())) { |
+ if (descriptors->GetType(0) == FIELD) { |
+ Object* hidden_store = |
+ this->FastPropertyAt(descriptors->GetFieldIndex(0)); |
+ return StringDictionary::cast(hidden_store); |
+ } else { |
+ ASSERT(descriptors->GetType(0) == MAP_TRANSITION); |
+ } |
} |
} else { |
PropertyAttributes attributes; |
@@ -3819,11 +3821,13 @@ MaybeObject* JSObject::SetHiddenPropertiesDictionary( |
// code zero) it will always occupy the first entry if present. |
DescriptorArray* descriptors = this->map()->instance_descriptors(); |
if ((descriptors->number_of_descriptors() > 0) && |
- (descriptors->GetKey(0) == GetHeap()->hidden_symbol()) && |
- descriptors->IsProperty(0)) { |
- ASSERT(descriptors->GetType(0) == FIELD); |
- this->FastPropertyAtPut(descriptors->GetFieldIndex(0), dictionary); |
- return this; |
+ (descriptors->GetKey(0) == GetHeap()->hidden_symbol())) { |
+ if (descriptors->GetType(0) == FIELD) { |
+ this->FastPropertyAtPut(descriptors->GetFieldIndex(0), dictionary); |
+ return this; |
+ } else { |
+ ASSERT(descriptors->GetType(0) == MAP_TRANSITION); |
+ } |
} |
} |
MaybeObject* store_result = |
@@ -5832,14 +5836,14 @@ MaybeObject* DescriptorArray::RemoveTransitions() { |
// not be allocated. |
// Compute the size of the map transition entries to be removed. |
- int num_removed = 0; |
+ int new_number_of_descriptors = 0; |
for (int i = 0; i < number_of_descriptors(); i++) { |
- if (!IsProperty(i)) num_removed++; |
+ if (IsProperty(i)) new_number_of_descriptors++; |
} |
// Allocate the new descriptor array. |
DescriptorArray* new_descriptors; |
- { MaybeObject* maybe_result = Allocate(number_of_descriptors() - num_removed); |
+ { MaybeObject* maybe_result = Allocate(new_number_of_descriptors); |
if (!maybe_result->To<DescriptorArray>(&new_descriptors)) { |
return maybe_result; |
} |