Index: src/objects-visiting-inl.h |
diff --git a/src/objects-visiting-inl.h b/src/objects-visiting-inl.h |
index ea5f1cadbbb5b2d62ca00ccc31134c3dd281b20c..856ae06b7b133bb126371b40fbc42b9eed43b176 100644 |
--- a/src/objects-visiting-inl.h |
+++ b/src/objects-visiting-inl.h |
@@ -134,9 +134,12 @@ void StaticMarkingVisitor<StaticVisitor>::Initialize() { |
Oddball::BodyDescriptor, |
void>::Visit); |
- table_.Register(kVisitMap, &VisitMap); |
+ table_.Register(kVisitMap, |
+ &FixedBodyVisitor<StaticVisitor, |
+ Map::BodyDescriptor, |
+ void>::Visit); |
- table_.Register(kVisitCode, &VisitCode); |
+ table_.Register(kVisitCode, &StaticVisitor::VisitCode); |
// Registration for kVisitSharedFunctionInfo is done by StaticVisitor. |
@@ -244,34 +247,6 @@ void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( |
template<typename StaticVisitor> |
-void StaticMarkingVisitor<StaticVisitor>::VisitMap( |
- Map* map, HeapObject* object) { |
- Heap* heap = map->GetHeap(); |
- Map* map_object = Map::cast(object); |
- |
- // Clears the cache of ICs related to this map. |
- if (FLAG_cleanup_code_caches_at_gc) { |
- map_object->ClearCodeCache(heap); |
- } |
- |
- // When map collection is enabled we have to mark through map's |
- // transitions and back pointers in a special way to make these links |
- // weak. Only maps for subclasses of JSReceiver can have transitions. |
- STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
- if (FLAG_collect_maps && |
- map_object->instance_type() >= FIRST_JS_RECEIVER_TYPE) { |
- MarkMapContents(heap, map_object); |
- } else { |
- Object** start_slot = |
- HeapObject::RawField(object, Map::kPointerFieldsBeginOffset); |
- Object** end_slot = |
- HeapObject::RawField(object, Map::kPointerFieldsEndOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, start_slot, end_slot); |
- } |
-} |
- |
- |
-template<typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitCode( |
Map* map, HeapObject* object) { |
Heap* heap = map->GetHeap(); |
@@ -288,71 +263,9 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp( |
Map* map, HeapObject* object) { |
int last_property_offset = |
JSRegExp::kSize + kPointerSize * map->inobject_properties(); |
- Object** start_slot = |
- HeapObject::RawField(object, JSRegExp::kPropertiesOffset); |
- Object** end_slot = |
- HeapObject::RawField(object, last_property_offset); |
- StaticVisitor::VisitPointers( |
- map->GetHeap(), start_slot, start_slot, end_slot); |
-} |
- |
- |
-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. |
- TransitionArray* transitions = map->unchecked_transition_array(); |
- if (transitions->IsTransitionArray()) { |
- MarkTransitionArray(heap, transitions); |
- } else { |
- // Already marked by marking map->GetBackPointer() above. |
- ASSERT(transitions->IsMap() || transitions->IsUndefined()); |
- } |
- |
- // 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. |
- Object** start_slot = |
- HeapObject::RawField(map, Map::kPointerFieldsBeginOffset); |
- Object** end_slot = |
- HeapObject::RawField(map, Map::kPointerFieldsEndOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, start_slot, end_slot); |
-} |
- |
- |
-template<typename StaticVisitor> |
-void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( |
- Heap* heap, TransitionArray* transitions) { |
- if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; |
- |
- // Skip recording the descriptors_pointer slot since the cell space |
- // is not compacted and descriptors are referenced through a cell. |
- StaticVisitor::MarkObject(heap, transitions->descriptors_pointer()); |
- |
- // 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. |
- 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) { |
- StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i)); |
- } |
+ StaticVisitor::VisitPointers(map->GetHeap(), |
+ HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |
+ HeapObject::RawField(object, last_property_offset)); |
} |