| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 9726f1af12a6b4651a94551548d22607fbe7c5e5..231ddbb6f6fee32c5722331f8479b1788ee4a34b 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -5801,7 +5801,7 @@ MaybeObject* DescriptorArray::Allocate(int number_of_descriptors,
|
| if (!maybe_array->To(&result)) return maybe_array;
|
| }
|
|
|
| - result->set(kLastAddedIndex, Smi::FromInt(-1));
|
| + result->set(kLastAddedIndex, Smi::FromInt(kNoneAdded));
|
| result->set(kTransitionsIndex, Smi::FromInt(0));
|
| return result;
|
| }
|
| @@ -5928,7 +5928,8 @@ MaybeObject* DescriptorArray::CopyAdd(Descriptor* descriptor) {
|
|
|
| FixedArray::WhitenessWitness witness(new_descriptors);
|
|
|
| - descriptor->SetEnumerationIndex(NextEnumerationIndex());
|
| + ASSERT(new_size == NextEnumerationIndex());
|
| + descriptor->SetEnumerationIndex(new_size);
|
|
|
| // Copy the descriptors, inserting or replacing a descriptor.
|
| int insertion_index = -1;
|
| @@ -6035,18 +6036,20 @@ void DescriptorArray::SortUnchecked(const WhitenessWitness& witness) {
|
| }
|
| }
|
|
|
| - int last_enum_index = -1;
|
| - int last_added = -1;
|
| + ASSERT(LastAdded() == kNoneAdded);
|
| for (int i = 0; i < len; ++i) {
|
| int current_enum = GetDetails(i).index();
|
| - if (current_enum > last_enum_index) {
|
| - last_added = i;
|
| - last_enum_index = current_enum;
|
| + ASSERT(current_enum <= len);
|
| +
|
| + if (current_enum == len) {
|
| + ASSERT(LastAdded() == kNoneAdded);
|
| + SetLastAdded(i);
|
| +#ifndef DEBUG
|
| + return;
|
| +#endif
|
| }
|
| }
|
| - SetLastAdded(last_added);
|
| -
|
| - ASSERT(LastAdded() != -1);
|
| + ASSERT(LastAdded() != kNoneAdded);
|
| }
|
|
|
|
|
|
|