Commit 067afa54 authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Reland: Reuse object evacuation information for slot recording in Scavenger.

This reverts commit d6de4af5.

Bug: chromium:852420
Change-Id: Ife02a0e47ddb4a136c552965d9e01c6a0ef18e02
Reviewed-on: https://chromium-review.googlesource.com/1194363Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55470}
parent 4b0f5711
This diff is collapsed.
...@@ -53,15 +53,13 @@ class IterateAndScavengePromotedObjectsVisitor final : public ObjectVisitor { ...@@ -53,15 +53,13 @@ class IterateAndScavengePromotedObjectsVisitor final : public ObjectVisitor {
scavenger_->PageMemoryFence(reinterpret_cast<MaybeObject*>(target)); scavenger_->PageMemoryFence(reinterpret_cast<MaybeObject*>(target));
if (Heap::InFromSpace(target)) { if (Heap::InFromSpace(target)) {
scavenger_->ScavengeObject(slot, target); SlotCallbackResult result = scavenger_->ScavengeObject(slot, target);
bool success = (*slot)->ToStrongOrWeakHeapObject(&target); bool success = (*slot)->ToStrongOrWeakHeapObject(&target);
USE(success); USE(success);
DCHECK(success); DCHECK(success);
scavenger_->PageMemoryFence(reinterpret_cast<MaybeObject*>(target));
if (Heap::InNewSpace(target)) { if (result == KEEP_SLOT) {
SLOW_DCHECK(target->IsHeapObject()); SLOW_DCHECK(target->IsHeapObject());
SLOW_DCHECK(Heap::InToSpace(target));
RememberedSet<OLD_TO_NEW>::Insert(Page::FromAddress(slot_address), RememberedSet<OLD_TO_NEW>::Insert(Page::FromAddress(slot_address),
slot_address); slot_address);
} }
......
...@@ -16,6 +16,12 @@ namespace internal { ...@@ -16,6 +16,12 @@ namespace internal {
class OneshotBarrier; class OneshotBarrier;
enum class CopyAndForwardResult {
SUCCESS_YOUNG_GENERATION,
SUCCESS_OLD_GENERATION,
FAILURE
};
class Scavenger { class Scavenger {
public: public:
static const int kCopiedListSegmentSize = 256; static const int kCopiedListSegmentSize = 256;
...@@ -61,34 +67,43 @@ class Scavenger { ...@@ -61,34 +67,43 @@ class Scavenger {
// Scavenges an object |object| referenced from slot |p|. |object| is required // Scavenges an object |object| referenced from slot |p|. |object| is required
// to be in from space. // to be in from space.
inline void ScavengeObject(HeapObjectReference** p, HeapObject* object); inline SlotCallbackResult ScavengeObject(HeapObjectReference** p,
HeapObject* object);
// Copies |source| to |target| and sets the forwarding pointer in |source|. // Copies |source| to |target| and sets the forwarding pointer in |source|.
V8_INLINE bool MigrateObject(Map* map, HeapObject* source, HeapObject* target, V8_INLINE bool MigrateObject(Map* map, HeapObject* source, HeapObject* target,
int size); int size);
V8_INLINE bool SemiSpaceCopyObject(Map* map, HeapObjectReference** slot, V8_INLINE SlotCallbackResult
HeapObject* object, int object_size); RememberedSetEntryNeeded(CopyAndForwardResult result);
V8_INLINE bool PromoteObject(Map* map, HeapObjectReference** slot, V8_INLINE CopyAndForwardResult SemiSpaceCopyObject(Map* map,
HeapObject* object, int object_size); HeapObjectReference** slot,
HeapObject* object,
int object_size);
V8_INLINE void EvacuateObject(HeapObjectReference** slot, Map* map, V8_INLINE CopyAndForwardResult PromoteObject(Map* map,
HeapObject* source); HeapObjectReference** slot,
HeapObject* object,
// Different cases for object evacuation. int object_size);
V8_INLINE void EvacuateObjectDefault(Map* map, HeapObjectReference** slot, V8_INLINE SlotCallbackResult EvacuateObject(HeapObjectReference** slot,
HeapObject* object, int object_size); Map* map, HeapObject* source);
V8_INLINE void EvacuateJSFunction(Map* map, HeapObject** slot, // Different cases for object evacuation.
JSFunction* object, int object_size); V8_INLINE SlotCallbackResult EvacuateObjectDefault(Map* map,
HeapObjectReference** slot,
inline void EvacuateThinString(Map* map, HeapObject** slot, HeapObject* object,
ThinString* object, int object_size); int object_size);
inline void EvacuateShortcutCandidate(Map* map, HeapObject** slot, inline SlotCallbackResult EvacuateThinString(Map* map, HeapObject** slot,
ConsString* object, int object_size); ThinString* object,
int object_size);
inline SlotCallbackResult EvacuateShortcutCandidate(Map* map,
HeapObject** slot,
ConsString* object,
int object_size);
void IterateAndScavengePromotedObject(HeapObject* target, int size); void IterateAndScavengePromotedObject(HeapObject* target, int size);
......
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