[heap] Move slot recording of weak fields in native context to native context list retainer.
BUG= Review URL: https://codereview.chromium.org/1463483002 Cr-Commit-Position: refs/heads/master@{#32109}
This commit is contained in:
parent
5e9c4716d1
commit
45a52b624a
@ -304,13 +304,6 @@ void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext(
|
||||
Map* map, HeapObject* object) {
|
||||
FixedBodyVisitor<StaticVisitor, Context::MarkCompactBodyDescriptor,
|
||||
void>::Visit(map, object);
|
||||
|
||||
MarkCompactCollector* collector = map->GetHeap()->mark_compact_collector();
|
||||
for (int idx = Context::FIRST_WEAK_SLOT; idx < Context::NATIVE_CONTEXT_SLOTS;
|
||||
++idx) {
|
||||
Object** slot = Context::cast(object)->RawFieldOfElementAt(idx);
|
||||
collector->RecordSlot(object, slot, *slot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,9 +307,17 @@ struct WeakListVisitor<Context> {
|
||||
DoWeakList<JSFunction>(heap, context, retainer,
|
||||
Context::OPTIMIZED_FUNCTIONS_LIST);
|
||||
|
||||
// Code objects are always allocated in Code space, we do not have to visit
|
||||
// them during scavenges.
|
||||
if (heap->gc_state() == Heap::MARK_COMPACT) {
|
||||
// Record the slots of the weak entries in the native context.
|
||||
MarkCompactCollector* collector = heap->mark_compact_collector();
|
||||
for (int idx = Context::FIRST_WEAK_SLOT;
|
||||
idx < Context::NATIVE_CONTEXT_SLOTS; ++idx) {
|
||||
Object** slot = Context::cast(context)->RawFieldOfElementAt(idx);
|
||||
collector->RecordSlot(context, slot, *slot);
|
||||
}
|
||||
// Code objects are always allocated in Code space, we do not have to
|
||||
// visit
|
||||
// them during scavenges.
|
||||
DoWeakList<Code>(heap, context, retainer, Context::OPTIMIZED_CODE_LIST);
|
||||
DoWeakList<Code>(heap, context, retainer, Context::DEOPTIMIZED_CODE_LIST);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user