Bug 870496 - Purge moved objects in the NewObjectCache on minor GC; r=billm

--HG--
extra : rebase_source : 8d4b7df4cff1df4f1fc1de88e823a3e7541a55df
This commit is contained in:
Terrence Cole 2013-05-08 12:02:48 -07:00
parent 6ed162ee8d
commit bcbc015831
3 changed files with 13 additions and 0 deletions

View File

@ -492,6 +492,7 @@ js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason)
comp->markAllInitialShapeTableEntries(&trc);
}
markStoreBuffer(&trc);
rt->newObjectCache.clearNurseryObjects(rt);
/*
* Most of the work is done here. This loop iterates over objects that have

View File

@ -338,6 +338,9 @@ class NewObjectCache
NewObjectCache() { mozilla::PodZero(this); }
void purge() { mozilla::PodZero(this); }
/* Remove any cached items keyed on moved objects. */
inline void clearNurseryObjects(JSRuntime *rt);
/*
* Get the entry index for the given lookup, return whether there was a hit
* on an existing entry.

View File

@ -29,6 +29,15 @@ NewObjectCache::staticAsserts()
JS_STATIC_ASSERT(gc::FINALIZE_OBJECT_LAST == gc::FINALIZE_OBJECT16_BACKGROUND);
}
inline void
NewObjectCache::clearNurseryObjects(JSRuntime *rt)
{
for (unsigned i = 0; i < mozilla::ArrayLength(entries); ++i) {
if (IsInsideNursery(rt, entries[i].key))
mozilla::PodZero(&entries[i]);
}
}
inline bool
NewObjectCache::lookup(Class *clasp, gc::Cell *key, gc::AllocKind kind, EntryIndex *pentry)
{