Chromium Code Reviews| Index: src/heap/objects-visiting-inl.h |
| diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h |
| index d6a189a98d20f75a1008dcae492d6f2921411984..6a26338414e024334930e6146c10a032b32f58b2 100644 |
| --- a/src/heap/objects-visiting-inl.h |
| +++ b/src/heap/objects-visiting-inl.h |
| @@ -9,6 +9,7 @@ |
| #include "src/heap/objects-visiting.h" |
| #include "src/ic/ic-state.h" |
| #include "src/macro-assembler.h" |
| +#include "src/objects-body-descriptors-inl.h" |
| namespace v8 { |
| namespace internal { |
| @@ -94,14 +95,14 @@ void StaticNewSpaceVisitor<StaticVisitor>::Initialize() { |
| template <typename StaticVisitor> |
| int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| Map* map, HeapObject* object) { |
| - Heap* heap = map->GetHeap(); |
| + typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, int> |
| + JSArrayBufferBodyVisitor; |
| - JSArrayBuffer::JSArrayBufferIterateBody< |
| - StaticNewSpaceVisitor<StaticVisitor> >(heap, object); |
| if (!JSArrayBuffer::cast(object)->is_external()) { |
| + Heap* heap = map->GetHeap(); |
| heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); |
| } |
| - return JSArrayBuffer::kSizeWithInternalFields; |
| + return JSArrayBufferBodyVisitor::Visit(map, object); |
| } |
| @@ -439,7 +440,9 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCode(Map* map, |
| MarkInlinedFunctionsCode(heap, code); |
| } |
| } |
| - code->CodeIterateBody<StaticVisitor>(heap); |
| + typedef FlexibleBodyVisitor<StaticVisitor, Code::BodyDescriptor, void> |
|
Michael Starzinger
2015/11/13 10:58:54
nit: Let's move the typedef to the top of the func
Igor Sheludko
2015/11/13 11:23:51
Done.
|
| + CodeBodyVisitor; |
| + CodeBodyVisitor::Visit(map, object); |
| } |
| @@ -525,12 +528,9 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, |
| template <typename StaticVisitor> |
| void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, |
| HeapObject* object) { |
| - int last_property_offset = |
| - JSRegExp::kSize + kPointerSize * map->GetInObjectProperties(); |
| - StaticVisitor::VisitPointers( |
| - map->GetHeap(), object, |
| - HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |
| - HeapObject::RawField(object, last_property_offset)); |
| + typedef FlexibleBodyVisitor<StaticVisitor, JSRegExp::BodyDescriptor, void> |
| + JSRegExpBodyVisitor; |
| + JSRegExpBodyVisitor::Visit(map, object); |
| } |
| @@ -539,7 +539,11 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| Map* map, HeapObject* object) { |
| Heap* heap = map->GetHeap(); |
| - JSArrayBuffer::JSArrayBufferIterateBody<StaticVisitor>(heap, object); |
| + typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, |
| + void> JSArrayBufferBodyVisitor; |
| + |
| + JSArrayBufferBodyVisitor::Visit(map, object); |
| + |
| if (!JSArrayBuffer::cast(object)->is_external() && |
| !heap->InNewSpace(object)) { |
| heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); |
| @@ -550,20 +554,18 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| template <typename StaticVisitor> |
| void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( |
| Map* map, HeapObject* object) { |
| - StaticVisitor::VisitPointers( |
| - map->GetHeap(), object, |
| - HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |
| - HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); |
| + typedef FlexibleBodyVisitor<StaticVisitor, JSTypedArray::BodyDescriptor, void> |
| + JSTypedArrayBodyVisitor; |
| + JSTypedArrayBodyVisitor::Visit(map, object); |
| } |
| template <typename StaticVisitor> |
| void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView(Map* map, |
| HeapObject* object) { |
| - StaticVisitor::VisitPointers( |
| - map->GetHeap(), object, |
| - HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |
| - HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); |
| + typedef FlexibleBodyVisitor<StaticVisitor, JSDataView::BodyDescriptor, void> |
| + JSDataViewBodyVisitor; |
| + JSDataViewBodyVisitor::Visit(map, object); |
| } |
| @@ -822,66 +824,6 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode( |
| } |
| -void Code::CodeIterateBody(ObjectVisitor* v) { |
| - int mode_mask = RelocInfo::kCodeTargetMask | |
| - 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::RUNTIME_ENTRY) | |
| - RelocInfo::kDebugBreakSlotMask; |
| - |
| - // There are two places where we iterate code bodies: here and the |
| - // templated CodeIterateBody (below). They should be kept in sync. |
| - IteratePointer(v, kRelocationInfoOffset); |
| - IteratePointer(v, kHandlerTableOffset); |
| - IteratePointer(v, kDeoptimizationDataOffset); |
| - IteratePointer(v, kTypeFeedbackInfoOffset); |
| - IterateNextCodeLink(v, kNextCodeLinkOffset); |
| - |
| - RelocIterator it(this, mode_mask); |
| - Isolate* isolate = this->GetIsolate(); |
| - for (; !it.done(); it.next()) { |
| - it.rinfo()->Visit(isolate, v); |
| - } |
| -} |
| - |
| - |
| -template <typename StaticVisitor> |
| -void Code::CodeIterateBody(Heap* heap) { |
| - int mode_mask = RelocInfo::kCodeTargetMask | |
| - 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::RUNTIME_ENTRY) | |
| - RelocInfo::kDebugBreakSlotMask; |
| - |
| - // There are two places where we iterate code bodies: here and the non- |
| - // templated CodeIterateBody (above). They should be kept in sync. |
| - StaticVisitor::VisitPointer( |
| - heap, this, |
| - reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
| - StaticVisitor::VisitPointer( |
| - heap, this, |
| - reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
| - StaticVisitor::VisitPointer( |
| - heap, this, |
| - reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
| - StaticVisitor::VisitPointer( |
| - heap, this, |
| - reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); |
| - StaticVisitor::VisitNextCodeLink( |
| - heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); |
| - |
| - |
| - RelocIterator it(this, mode_mask); |
| - for (; !it.done(); it.next()) { |
| - it.rinfo()->template Visit<StaticVisitor>(heap); |
| - } |
| -} |
| } // namespace internal |
| } // namespace v8 |