Clear EnumIndices as well on CNLT.

BUG=

Review URL: https://chromiumcodereview.appspot.com/10944011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12542 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2012-09-19 08:08:02 +00:00
parent bf48856a7d
commit 1b9c319da2
3 changed files with 24 additions and 7 deletions

View File

@ -735,7 +735,7 @@ Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object,
}
DescriptorArray* desc = object->map()->instance_descriptors();
Handle<FixedArray> keys(FixedArray::cast(desc->GetEnumCache()), isolate);
Handle<FixedArray> keys(desc->GetEnumCache(), isolate);
// In case the number of properties required in the enum are actually
// present, we can reuse the enum cache. Otherwise, this means that the

View File

@ -6106,7 +6106,7 @@ void DescriptorArray::SetEnumCache(FixedArray* bridge_storage,
ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength);
ASSERT(new_index_cache->IsSmi() || new_index_cache->IsFixedArray());
if (HasEnumCache()) {
ASSERT(new_cache->length() > FixedArray::cast(GetEnumCache())->length());
ASSERT(new_cache->length() > GetEnumCache()->length());
FixedArray::cast(get(kEnumCacheIndex))->
set(kEnumCacheBridgeCacheIndex, new_cache);
FixedArray::cast(get(kEnumCacheIndex))->
@ -7521,12 +7521,15 @@ void Map::ClearNonLiveTransitions(Heap* heap) {
if (live_enum == 0) {
descriptors->ClearEnumCache();
} else {
FixedArray* enum_cache =
FixedArray::cast(descriptors->GetEnumCache());
FixedArray* enum_cache = descriptors->GetEnumCache();
to_trim = enum_cache->length() - live_enum;
if (to_trim > 0) {
RightTrimFixedArray<FROM_GC>(
heap, FixedArray::cast(descriptors->GetEnumCache()), to_trim);
heap, descriptors->GetEnumCache(), to_trim);
if (descriptors->HasEnumIndicesCache()) {
RightTrimFixedArray<FROM_GC>(
heap, descriptors->GetEnumIndicesCache(), to_trim);
}
}
}
}

View File

@ -2507,10 +2507,24 @@ class DescriptorArray: public FixedArray {
set(kEnumCacheIndex, array->get(kEnumCacheIndex));
}
Object* GetEnumCache() {
FixedArray* GetEnumCache() {
ASSERT(HasEnumCache());
FixedArray* bridge = FixedArray::cast(get(kEnumCacheIndex));
return bridge->get(kEnumCacheBridgeCacheIndex);
return FixedArray::cast(bridge->get(kEnumCacheBridgeCacheIndex));
}
bool HasEnumIndicesCache() {
if (IsEmpty()) return false;
Object* object = get(kEnumCacheIndex);
if (object->IsSmi()) return false;
FixedArray* bridge = FixedArray::cast(object);
return bridge->get(kEnumCacheBridgeIndicesCacheIndex)->IsSmi();
}
FixedArray* GetEnumIndicesCache() {
ASSERT(HasEnumIndicesCache());
FixedArray* bridge = FixedArray::cast(get(kEnumCacheIndex));
return FixedArray::cast(bridge->get(kEnumCacheBridgeIndicesCacheIndex));
}
Object** GetEnumCacheSlot() {