Robustify the clearing of the cache of map-related ICs on the map.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10438 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
erik.corry@gmail.com 2012-01-19 13:22:16 +00:00
parent 48a24b9224
commit 504ef4f243
3 changed files with 17 additions and 3 deletions

View File

@ -49,6 +49,13 @@ void MarkCompactCollector::SetFlags(int flags) {
} }
void MarkCompactCollector::ClearCacheOnMap(Map* map) {
if (FLAG_cleanup_code_caches_at_gc) {
map->ClearCodeCache(heap());
}
}
void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
ASSERT(Marking::MarkBitFrom(obj) == mark_bit); ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
if (!mark_bit.Get()) { if (!mark_bit.Get()) {
@ -64,6 +71,9 @@ void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) {
ASSERT(Marking::MarkBitFrom(obj) == mark_bit); ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
mark_bit.Set(); mark_bit.Set();
MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size());
if (obj->IsMap()) {
ClearCacheOnMap(Map::cast(obj));
}
} }

View File

@ -1623,9 +1623,7 @@ void MarkCompactCollector::ProcessNewlyMarkedObject(HeapObject* object) {
ASSERT(HEAP->Contains(object)); ASSERT(HEAP->Contains(object));
if (object->IsMap()) { if (object->IsMap()) {
Map* map = Map::cast(object); Map* map = Map::cast(object);
if (FLAG_cleanup_code_caches_at_gc) { ClearCacheOnMap(map);
map->ClearCodeCache(heap());
}
// When map collection is enabled we have to mark through map's transitions // When map collection is enabled we have to mark through map's transitions
// in a special way to make transition links weak. // in a special way to make transition links weak.

View File

@ -624,10 +624,16 @@ class MarkCompactCollector {
void AfterMarking(); void AfterMarking();
// Marks the object black and pushes it on the marking stack.
// This is for non-incremental marking.
INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit)); INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit));
// Marks the object black. This is for non-incremental marking.
INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit)); INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit));
// Clears the cache of ICs related to this map.
INLINE(void ClearCacheOnMap(Map* map));
void ProcessNewlyMarkedObject(HeapObject* obj); void ProcessNewlyMarkedObject(HeapObject* obj);
// Creates back pointers for all map transitions, stores them in // Creates back pointers for all map transitions, stores them in