If we are trimming the whole array, just return the empty fixed array.
Review URL: https://chromiumcodereview.appspot.com/10911054 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12427 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
3eed540a0e
commit
996c84fb51
@ -799,7 +799,7 @@ Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object,
|
||||
Handle<FixedArray> storage =
|
||||
isolate->factory()->NewFixedArray(next_enumeration);
|
||||
|
||||
dictionary->CopyEnumKeysTo(*storage);
|
||||
storage = Handle<FixedArray>(dictionary->CopyEnumKeysTo(*storage));
|
||||
ASSERT(storage->length() == object->NumberOfLocalProperties(DONT_ENUM));
|
||||
return storage;
|
||||
}
|
||||
|
@ -12474,7 +12474,7 @@ void Dictionary<Shape, Key>::CopyKeysTo(
|
||||
}
|
||||
|
||||
|
||||
void StringDictionary::CopyEnumKeysTo(FixedArray* storage) {
|
||||
FixedArray* StringDictionary::CopyEnumKeysTo(FixedArray* storage) {
|
||||
int length = storage->length();
|
||||
ASSERT(length >= NumberOfEnumElements());
|
||||
Heap* heap = GetHeap();
|
||||
@ -12501,6 +12501,7 @@ void StringDictionary::CopyEnumKeysTo(FixedArray* storage) {
|
||||
// together by shifting them to the left (maintaining the enumeration order),
|
||||
// and trimming of the right side of the array.
|
||||
if (properties < length) {
|
||||
if (properties == 0) return heap->empty_fixed_array();
|
||||
properties = 0;
|
||||
for (int i = 0; i < length; ++i) {
|
||||
Object* value = storage->get(i);
|
||||
@ -12511,6 +12512,7 @@ void StringDictionary::CopyEnumKeysTo(FixedArray* storage) {
|
||||
}
|
||||
RightTrimFixedArray<FROM_MUTATOR>(heap, storage, length - properties);
|
||||
}
|
||||
return storage;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3128,7 +3128,7 @@ class StringDictionary: public Dictionary<StringDictionaryShape, String*> {
|
||||
}
|
||||
|
||||
// Copies enumerable keys to preallocated fixed array.
|
||||
void CopyEnumKeysTo(FixedArray* storage);
|
||||
FixedArray* CopyEnumKeysTo(FixedArray* storage);
|
||||
static void DoGenerateNewEnumerationIndices(
|
||||
Handle<StringDictionary> dictionary);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user