Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 6d7fbdff2b5953a40b4950c17b8848a641e13951..bf35a838e93442956e724b47b480489e703608ec 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -884,17 +884,9 @@ class StaticMarkingVisitor : public StaticVisitorBase { |
if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()) { |
IC::Clear(rinfo->pc()); |
target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
- } else { |
- if (FLAG_cleanup_code_caches_at_gc && |
- target->kind() == Code::STUB && |
- target->major_key() == CodeStub::CallFunction && |
- target->has_function_cache()) { |
- CallFunctionStub::Clear(heap, rinfo->pc()); |
- } |
} |
MarkBit code_mark = Marking::MarkBitFrom(target); |
heap->mark_compact_collector()->MarkObject(target, code_mark); |
- |
heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
} |
@@ -1015,8 +1007,17 @@ class StaticMarkingVisitor : public StaticVisitorBase { |
} |
static void VisitCode(Map* map, HeapObject* object) { |
- reinterpret_cast<Code*>(object)->CodeIterateBody<StaticMarkingVisitor>( |
- map->GetHeap()); |
+ Heap* heap = map->GetHeap(); |
+ Code* code = reinterpret_cast<Code*>(object); |
+ if (FLAG_cleanup_code_caches_at_gc) { |
+ CacheCells* cache_cells = code->cache_cells(); |
+ for (int i = 0; i < cache_cells->CellCount(); i++) { |
+ ASSERT(cache_cells->AstId(i)->IsSmi()); |
+ JSGlobalPropertyCell* cell = cache_cells->Cell(i); |
+ cell->set_value(CacheCells::RawUninitializedSentinel(heap)); |
+ } |
+ } |
+ code->CodeIterateBody<StaticMarkingVisitor>(heap); |
} |
// Code flushing support. |