Commit a2876b81 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[heap] Simplify visitation of weak next code link field.

R=ulan@chromium.org

Change-Id: I141daeffde426a75293ffa0565c867d73a81cbfc
Reviewed-on: https://chromium-review.googlesource.com/738776Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48968}
parent 668b1e68
...@@ -43,6 +43,15 @@ int MarkingVisitor<fixed_array_mode, retaining_path_mode, ...@@ -43,6 +43,15 @@ int MarkingVisitor<fixed_array_mode, retaining_path_mode,
return size; return size;
} }
template <FixedArrayVisitationMode fixed_array_mode,
TraceRetainingPathMode retaining_path_mode, typename MarkingState>
int MarkingVisitor<fixed_array_mode, retaining_path_mode, MarkingState>::
VisitCodeDataContainer(Map* map, CodeDataContainer* object) {
int size = CodeDataContainer::BodyDescriptorWeak::SizeOf(map, object);
CodeDataContainer::BodyDescriptorWeak::IterateBody(object, size, this);
return size;
}
template <FixedArrayVisitationMode fixed_array_mode, template <FixedArrayVisitationMode fixed_array_mode,
TraceRetainingPathMode retaining_path_mode, typename MarkingState> TraceRetainingPathMode retaining_path_mode, typename MarkingState>
int MarkingVisitor<fixed_array_mode, retaining_path_mode, int MarkingVisitor<fixed_array_mode, retaining_path_mode,
......
...@@ -1187,9 +1187,6 @@ class MarkCompactCollector::CustomRootBodyMarkingVisitor final ...@@ -1187,9 +1187,6 @@ class MarkCompactCollector::CustomRootBodyMarkingVisitor final
// VisitEmbedderPointer is defined by ObjectVisitor to call VisitPointers. // VisitEmbedderPointer is defined by ObjectVisitor to call VisitPointers.
// Skip the weak next code link for code objects.
void VisitNextCodeLink(CodeDataContainer* host, Object** p) override {}
private: private:
void MarkObject(HeapObject* host, Object* object) { void MarkObject(HeapObject* host, Object* object) {
if (!object->IsHeapObject()) return; if (!object->IsHeapObject()) return;
......
...@@ -1034,6 +1034,7 @@ class MarkingVisitor final ...@@ -1034,6 +1034,7 @@ class MarkingVisitor final
V8_INLINE int VisitAllocationSite(Map* map, AllocationSite* object); V8_INLINE int VisitAllocationSite(Map* map, AllocationSite* object);
V8_INLINE int VisitBytecodeArray(Map* map, BytecodeArray* object); V8_INLINE int VisitBytecodeArray(Map* map, BytecodeArray* object);
V8_INLINE int VisitCodeDataContainer(Map* map, CodeDataContainer* object);
V8_INLINE int VisitFixedArray(Map* map, FixedArray* object); V8_INLINE int VisitFixedArray(Map* map, FixedArray* object);
V8_INLINE int VisitJSApiObject(Map* map, JSObject* object); V8_INLINE int VisitJSApiObject(Map* map, JSObject* object);
V8_INLINE int VisitJSFunction(Map* map, JSFunction* object); V8_INLINE int VisitJSFunction(Map* map, JSFunction* object);
...@@ -1049,8 +1050,6 @@ class MarkingVisitor final ...@@ -1049,8 +1050,6 @@ class MarkingVisitor final
Object** end) final; Object** end) final;
V8_INLINE void VisitEmbeddedPointer(Code* host, RelocInfo* rinfo) final; V8_INLINE void VisitEmbeddedPointer(Code* host, RelocInfo* rinfo) final;
V8_INLINE void VisitCodeTarget(Code* host, RelocInfo* rinfo) final; V8_INLINE void VisitCodeTarget(Code* host, RelocInfo* rinfo) final;
// Skip weak next code link.
V8_INLINE void VisitNextCodeLink(CodeDataContainer* host, Object** p) final {}
private: private:
// Granularity in which FixedArrays are scanned if |fixed_array_mode| // Granularity in which FixedArrays are scanned if |fixed_array_mode|
......
...@@ -395,25 +395,6 @@ class Code::BodyDescriptor final : public BodyDescriptorBase { ...@@ -395,25 +395,6 @@ class Code::BodyDescriptor final : public BodyDescriptorBase {
} }
}; };
class CodeDataContainer::BodyDescriptor final : public BodyDescriptorBase {
public:
static bool IsValidSlot(HeapObject* obj, int offset) { return true; }
template <typename ObjectVisitor>
static inline void IterateBody(HeapObject* obj, ObjectVisitor* v) {
v->VisitNextCodeLink(CodeDataContainer::cast(obj),
HeapObject::RawField(obj, kNextCodeLinkOffset));
}
template <typename ObjectVisitor>
static inline void IterateBody(HeapObject* obj, int object_size,
ObjectVisitor* v) {
IterateBody(obj, v);
}
static inline int SizeOf(Map* map, HeapObject* obj) { return kSize; }
};
class SeqOneByteString::BodyDescriptor final : public BodyDescriptorBase { class SeqOneByteString::BodyDescriptor final : public BodyDescriptorBase {
public: public:
static bool IsValidSlot(HeapObject* obj, int offset) { return false; } static bool IsValidSlot(HeapObject* obj, int offset) { return false; }
......
...@@ -532,7 +532,19 @@ class CodeDataContainer : public HeapObject { ...@@ -532,7 +532,19 @@ class CodeDataContainer : public HeapObject {
static const int kUnalignedSize = kKindSpecificFlagsOffset + kIntSize; static const int kUnalignedSize = kKindSpecificFlagsOffset + kIntSize;
static const int kSize = OBJECT_POINTER_ALIGN(kUnalignedSize); static const int kSize = OBJECT_POINTER_ALIGN(kUnalignedSize);
class BodyDescriptor; // During mark compact we need to take special care for weak fields.
static const int kPointerFieldsStrongEndOffset = kNextCodeLinkOffset;
static const int kPointerFieldsWeakEndOffset = kKindSpecificFlagsOffset;
// Ignores weakness.
typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
kPointerFieldsWeakEndOffset, kSize>
BodyDescriptor;
// Respects weakness.
typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
kPointerFieldsStrongEndOffset, kSize>
BodyDescriptorWeak;
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CodeDataContainer); DISALLOW_IMPLICIT_CONSTRUCTORS(CodeDataContainer);
......
...@@ -20,9 +20,5 @@ const char* const VisitorSynchronization::kTagNames ...@@ -20,9 +20,5 @@ const char* const VisitorSynchronization::kTagNames
[VisitorSynchronization::kNumberOfSyncTags] = {ROOT_ID_LIST(DECLARE_TAG)}; [VisitorSynchronization::kNumberOfSyncTags] = {ROOT_ID_LIST(DECLARE_TAG)};
#undef DECLARE_TAG #undef DECLARE_TAG
void ObjectVisitor::VisitNextCodeLink(CodeDataContainer* host, Object** p) {
VisitPointers(host, p, p + 1);
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -92,11 +92,8 @@ class ObjectVisitor BASE_EMBEDDED { ...@@ -92,11 +92,8 @@ class ObjectVisitor BASE_EMBEDDED {
VisitPointers(host, p, p + 1); VisitPointers(host, p, p + 1);
} }
// Visit the weak next code link for code objects.
virtual void VisitNextCodeLink(CodeDataContainer* host, Object** p);
// To allow lazy clearing of inline caches the visitor has // To allow lazy clearing of inline caches the visitor has
// a rich interface for iterating over Code objects.. // a rich interface for iterating over Code objects ...
// Visits a code target in the instruction stream. // Visits a code target in the instruction stream.
virtual void VisitCodeTarget(Code* host, RelocInfo* rinfo); virtual void VisitCodeTarget(Code* host, RelocInfo* rinfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment