table_.Register(kVisitPropertyCell, &VisitPropertyCell);
+ table_.Register(kVisitWeakCell, &VisitWeakCell);
+
table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject,
kVisitDataObjectGeneric>();
// when they might be keeping a Context alive, or when the heap is about
// to be serialized.
if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() &&
- (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC ||
- target->ic_state() == POLYMORPHIC ||
- (heap->flush_monomorphic_ics() && !target->is_weak_stub()) ||
- heap->isolate()->serializer_enabled() ||
- target->ic_age() != heap->global_ic_age() ||
- target->is_invalidated_weak_stub())) {
+ !target->is_call_stub() && (heap->isolate()->serializer_enabled() ||
+ target->ic_age() != heap->global_ic_age())) {
ICUtility::Clear(heap->isolate(), rinfo->pc(),
rinfo->host()->constant_pool());
target = Code::GetCodeFromTargetAddress(rinfo->target_address());
Map* map, HeapObject* object) {
Heap* heap = map->GetHeap();
- Object** slot =
- HeapObject::RawField(object, PropertyCell::kDependentCodeOffset);
- if (FLAG_collect_maps) {
- // Mark property cell dependent codes array but do not push it onto marking
- // stack, this will make references from it weak. We will clean dead
- // codes when we iterate over property cells in ClearNonLiveReferences.
- HeapObject* obj = HeapObject::cast(*slot);
- heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
- StaticVisitor::MarkObjectWithoutPush(heap, obj);
- } else {
- StaticVisitor::VisitPointer(heap, slot);
- }
-
StaticVisitor::VisitPointers(
heap,
HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset),
template <typename StaticVisitor>
+void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map,
+ HeapObject* object) {
+ Heap* heap = map->GetHeap();
+ WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object);
+ Object* undefined = heap->undefined_value();
+ // Enqueue weak cell in linked list of encountered weak collections.
+ // We can ignore weak cells with cleared values because they will always
+ // contain smi zero.
+ if (weak_cell->next() == undefined && !weak_cell->cleared()) {
+ weak_cell->set_next(heap->encountered_weak_cells());
+ heap->set_encountered_weak_cells(weak_cell);
+ }
+}
+
+
+template <typename StaticVisitor>
void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite(
Map* map, HeapObject* object) {
Heap* heap = map->GetHeap();
- Object** slot =
- HeapObject::RawField(object, AllocationSite::kDependentCodeOffset);
- if (FLAG_collect_maps) {
- // Mark allocation site dependent codes array but do not push it onto
- // marking stack, this will make references from it weak. We will clean
- // dead codes when we iterate over allocation sites in
- // ClearNonLiveReferences.
- HeapObject* obj = HeapObject::cast(*slot);
- heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
- StaticVisitor::MarkObjectWithoutPush(heap, obj);
- } else {
- StaticVisitor::VisitPointer(heap, slot);
- }
-
StaticVisitor::VisitPointers(
heap,
HeapObject::RawField(object, AllocationSite::kPointerFieldsBeginOffset),
shared->ResetForNewContext(heap->global_ic_age());
}
if (FLAG_cleanup_code_caches_at_gc) {
- shared->ClearTypeFeedbackInfo();
+ shared->ClearTypeFeedbackInfoAtGCTime();
}
if (FLAG_cache_optimized_code && FLAG_flush_optimized_code_cache &&
!shared->optimized_code_map()->IsSmi()) {
bool is_weak_object =
(array->get_weak_object_state() ==
ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE &&
- Code::IsWeakObjectInOptimizedCode(object)) ||
- (array->get_weak_object_state() ==
- ConstantPoolArray::WEAK_OBJECTS_IN_IC &&
- Code::IsWeakObjectInIC(object));
+ Code::IsWeakObjectInOptimizedCode(object));
if (!is_weak_object) {
StaticVisitor::MarkObject(heap, object);
}
template <typename StaticVisitor>
void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap,
Map* map) {
- // Make sure that the back pointer stored either in the map itself or
- // inside its transitions array is marked. Skip recording the back
- // pointer slot since map space is not compacted.
- StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer()));
-
- // Treat pointers in the transitions array as weak and also mark that
- // array to prevent visiting it later. Skip recording the transition
- // array slot, since it will be implicitly recorded when the pointer
- // fields of this map are visited.
- if (map->HasTransitionArray()) {
- TransitionArray* transitions = map->transitions();
- MarkTransitionArray(heap, transitions);
+ Object* raw_transitions = map->raw_transitions();
+ if (TransitionArray::IsSimpleTransition(raw_transitions)) {
+ StaticVisitor::VisitPointer(
+ heap, HeapObject::RawField(map, Map::kTransitionsOffset));
+ }
+ if (TransitionArray::IsFullTransitionArray(raw_transitions)) {
+ MarkTransitionArray(heap, TransitionArray::cast(raw_transitions));
}
// Since descriptor arrays are potentially shared, ensure that only the
descriptors->GetDescriptorEndSlot(end));
}
- // Mark prototype dependent codes array but do not push it onto marking
- // stack, this will make references from it weak. We will clean dead
- // codes when we iterate over maps in ClearNonLiveTransitions.
- Object** slot = HeapObject::RawField(map, Map::kDependentCodeOffset);
- HeapObject* obj = HeapObject::cast(*slot);
- heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
- StaticVisitor::MarkObjectWithoutPush(heap, obj);
-
// Mark the pointer fields of the Map. Since the transitions array has
// been marked already, it is fine that one of these fields contains a
// pointer to it.
Heap* heap, TransitionArray* transitions) {
if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return;
- // Simple transitions do not have keys nor prototype transitions.
- if (transitions->IsSimpleTransition()) return;
-
if (transitions->HasPrototypeTransitions()) {
// Mark prototype transitions array but do not push it onto marking
// stack, this will make references from it weak. We will clean dead
- // prototype transitions in ClearNonLiveTransitions.
+ // prototype transitions in ClearNonLiveReferences.
Object** slot = transitions->GetPrototypeTransitionsSlot();
HeapObject* obj = HeapObject::cast(*slot);
heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
StaticVisitor::MarkObjectWithoutPush(heap, obj);
}
- for (int i = 0; i < transitions->number_of_transitions(); ++i) {
+ int num_transitions = TransitionArray::NumberOfTransitions(transitions);
+ for (int i = 0; i < num_transitions; ++i) {
StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i));
}
}
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
RelocInfo::ModeMask(RelocInfo::CELL) |
RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
+ RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
+ RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) |
RelocInfo::ModeMask(RelocInfo::JS_RETURN) |
RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
RelocInfo::ModeMask(RelocInfo::CELL) |
RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
+ RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
+ RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) |
RelocInfo::ModeMask(RelocInfo::JS_RETURN) |
RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);