diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index c53d1dc466..579228c2dc 100644 --- a/src/heap/incremental-marking.cc +++ b/src/heap/incremental-marking.cc @@ -179,7 +179,6 @@ class IncrementalMarkingMarkingVisitor StaticMarkingVisitor::Initialize(); table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); - table_.Register(kVisitJSRegExp, &VisitJSRegExp); } static const int kProgressBarScanningChunk = 32 * 1024; diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 38c32befdb..9b62e4b6a9 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -1246,7 +1246,7 @@ class MarkCompactMarkingVisitor Heap* heap = map->GetHeap(); MarkCompactCollector* collector = heap->mark_compact_collector(); if (!collector->is_code_flushing_enabled()) { - VisitJSRegExp(map, object); + JSObjectVisitor::Visit(map, object); return; } JSRegExp* re = reinterpret_cast(object); @@ -1254,7 +1254,7 @@ class MarkCompactMarkingVisitor UpdateRegExpCodeAgeAndFlush(heap, re, true); UpdateRegExpCodeAgeAndFlush(heap, re, false); // Visit the fields of the RegExp, including the updated FixedArray. - VisitJSRegExp(map, object); + JSObjectVisitor::Visit(map, object); } }; diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h index b93d31eb74..b8c255e1f3 100644 --- a/src/heap/objects-visiting-inl.h +++ b/src/heap/objects-visiting-inl.h @@ -147,11 +147,17 @@ void StaticMarkingVisitor::Initialize() { table_.Register(kVisitNativeContext, &VisitNativeContext); - table_.Register(kVisitAllocationSite, &VisitAllocationSite); + table_.Register( + kVisitAllocationSite, + &FixedBodyVisitor::Visit); table_.Register(kVisitByteArray, &DataObjectVisitor::Visit); - table_.Register(kVisitBytecodeArray, &VisitBytecodeArray); + table_.Register( + kVisitBytecodeArray, + &FixedBodyVisitor::Visit); table_.Register(kVisitFreeSpace, &DataObjectVisitor::Visit); @@ -178,13 +184,15 @@ void StaticMarkingVisitor::Initialize() { &FlexibleBodyVisitor::Visit); - // Registration for kVisitJSRegExp is done by StaticVisitor. + table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); table_.Register( kVisitCell, &FixedBodyVisitor::Visit); - table_.Register(kVisitPropertyCell, &VisitPropertyCell); + table_.Register(kVisitPropertyCell, + &FixedBodyVisitor::Visit); table_.Register(kVisitWeakCell, &VisitWeakCell); @@ -319,19 +327,6 @@ void StaticMarkingVisitor::VisitMap(Map* map, } } - -template -void StaticMarkingVisitor::VisitPropertyCell( - Map* map, HeapObject* object) { - Heap* heap = map->GetHeap(); - - StaticVisitor::VisitPointers( - heap, object, - HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset), - HeapObject::RawField(object, PropertyCell::kPointerFieldsEndOffset)); -} - - template void StaticMarkingVisitor::VisitWeakCell(Map* map, HeapObject* object) { @@ -384,19 +379,6 @@ void StaticMarkingVisitor::VisitTransitionArray( } } - -template -void StaticMarkingVisitor::VisitAllocationSite( - Map* map, HeapObject* object) { - Heap* heap = map->GetHeap(); - - StaticVisitor::VisitPointers( - heap, object, - HeapObject::RawField(object, AllocationSite::kPointerFieldsBeginOffset), - HeapObject::RawField(object, AllocationSite::kPointerFieldsEndOffset)); -} - - template void StaticMarkingVisitor::VisitWeakCollection( Map* map, HeapObject* object) { @@ -504,23 +486,6 @@ void StaticMarkingVisitor::VisitJSFunction(Map* map, VisitJSFunctionStrongCode(map, object); } - -template -void StaticMarkingVisitor::VisitJSRegExp(Map* map, - HeapObject* object) { - JSObjectVisitor::Visit(map, object); -} - -template -void StaticMarkingVisitor::VisitBytecodeArray( - Map* map, HeapObject* object) { - StaticVisitor::VisitPointers( - map->GetHeap(), object, - HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), - HeapObject::RawField(object, BytecodeArray::kFrameSizeOffset)); -} - - template void StaticMarkingVisitor::MarkMapContents(Heap* heap, Map* map) { diff --git a/src/heap/objects-visiting.h b/src/heap/objects-visiting.h index 9c81194b93..0bfdeead41 100644 --- a/src/heap/objects-visiting.h +++ b/src/heap/objects-visiting.h @@ -354,7 +354,6 @@ class StaticMarkingVisitor : public StaticVisitorBase { table_.GetVisitor(map)(map, obj); } - INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); INLINE(static void VisitWeakCell(Map* map, HeapObject* object)); INLINE(static void VisitTransitionArray(Map* map, HeapObject* object)); INLINE(static void VisitCodeEntry(Heap* heap, HeapObject* object, @@ -374,12 +373,9 @@ class StaticMarkingVisitor : public StaticVisitorBase { INLINE(static void VisitMap(Map* map, HeapObject* object)); INLINE(static void VisitCode(Map* map, HeapObject* object)); INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); - INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); INLINE(static void VisitWeakCollection(Map* map, HeapObject* object)); INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); - INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); - INLINE(static void VisitBytecodeArray(Map* map, HeapObject* object)); // Mark pointers in a Map treating some elements of the descriptor array weak. static void MarkMapContents(Heap* heap, Map* map); diff --git a/src/objects.h b/src/objects.h index ea086931a4..fc7dcff454 100644 --- a/src/objects.h +++ b/src/objects.h @@ -4858,6 +4858,13 @@ class BytecodeArray : public FixedArrayBase { // Maximal length of a single BytecodeArray. static const int kMaxLength = kMaxSize - kHeaderSize; + static const int kPointerFieldsBeginOffset = kConstantPoolOffset; + static const int kPointerFieldsEndOffset = kFrameSizeOffset; + + typedef FixedBodyDescriptor + MarkingBodyDescriptor; + class BodyDescriptor; private: @@ -8920,6 +8927,10 @@ class AllocationSite: public Struct { static const int kPointerFieldsBeginOffset = kTransitionInfoOffset; static const int kPointerFieldsEndOffset = kWeakNextOffset; + typedef FixedBodyDescriptor + MarkingBodyDescriptor; + // For other visitors, use the fixed body descriptor below. typedef FixedBodyDescriptor BodyDescriptor; @@ -10170,9 +10181,6 @@ class PropertyCell : public HeapObject { static const int kDependentCodeOffset = kValueOffset + kPointerSize; static const int kSize = kDependentCodeOffset + kPointerSize; - static const int kPointerFieldsBeginOffset = kValueOffset; - static const int kPointerFieldsEndOffset = kSize; - typedef FixedBodyDescriptor BodyDescriptor;