Commit 31ab363c authored by marja@chromium.org's avatar marja@chromium.org

Revert "Update survival statistics correctly in the Scavenger."

This reverts r21991.

Reason: lots of test failures.

BUG=
TBR=hpayer@chromium.org

Review URL: https://codereview.chromium.org/352083002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21992 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 661630f5
...@@ -1986,14 +1986,17 @@ class ScavengingVisitor : public StaticVisitorBase { ...@@ -1986,14 +1986,17 @@ class ScavengingVisitor : public StaticVisitorBase {
} }
Heap* heap = map->GetHeap(); Heap* heap = map->GetHeap();
AllocationResult allocation; if (heap->ShouldBePromoted(object->address(), object_size)) {
AllocationResult allocation;
if (!heap->ShouldBePromoted(object->address(), object_size)) { if (object_contents == DATA_OBJECT) {
ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE));
allocation = heap->new_space()->AllocateRaw(allocation_size); allocation = heap->old_data_space()->AllocateRaw(allocation_size);
} else {
ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE));
allocation = heap->old_pointer_space()->AllocateRaw(allocation_size);
}
// Allocation in the other semi-space may fail due to fragmentation.
// In that case we allocate in the old generation.
HeapObject* target = NULL; // Initialization to please compiler. HeapObject* target = NULL; // Initialization to please compiler.
if (allocation.To(&target)) { if (allocation.To(&target)) {
if (alignment != kObjectAlignment) { if (alignment != kObjectAlignment) {
...@@ -2006,48 +2009,49 @@ class ScavengingVisitor : public StaticVisitorBase { ...@@ -2006,48 +2009,49 @@ class ScavengingVisitor : public StaticVisitorBase {
*slot = target; *slot = target;
MigrateObject(heap, object, target, object_size); MigrateObject(heap, object, target, object_size);
heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); if (object_contents == POINTER_OBJECT) {
heap->IncrementSemiSpaceCopiedObjectSize(object_size); if (map->instance_type() == JS_FUNCTION_TYPE) {
heap->promotion_queue()->insert(
target, JSFunction::kNonWeakFieldsEndOffset);
} else {
heap->promotion_queue()->insert(target, object_size);
}
}
heap->IncrementPromotedObjectsSize(object_size);
return; return;
} }
} }
ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE));
if (object_contents == DATA_OBJECT) { AllocationResult allocation =
ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE)); heap->new_space()->AllocateRaw(allocation_size);
allocation = heap->old_data_space()->AllocateRaw(allocation_size); heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
} else {
ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE)); // Allocation in the other semi-space may fail due to fragmentation.
allocation = heap->old_pointer_space()->AllocateRaw(allocation_size); // In that case we allocate in the old generation.
} if (allocation.IsRetry()) {
if (object_contents == DATA_OBJECT) {
HeapObject* target = NULL; // Initialization to please compiler. ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE));
if (allocation.To(&target)) { allocation = heap->old_data_space()->AllocateRaw(allocation_size);
if (alignment != kObjectAlignment) { } else {
target = EnsureDoubleAligned(heap, target, allocation_size); ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE));
allocation = heap->old_pointer_space()->AllocateRaw(allocation_size);
} }
}
// Order is important: slot might be inside of the target if target HeapObject* target = HeapObject::cast(allocation.ToObjectChecked());
// was allocated over a dead object and slot comes from the store
// buffer.
*slot = target;
MigrateObject(heap, object, target, object_size);
if (object_contents == POINTER_OBJECT) {
if (map->instance_type() == JS_FUNCTION_TYPE) {
heap->promotion_queue()->insert(target,
JSFunction::kNonWeakFieldsEndOffset);
} else {
heap->promotion_queue()->insert(target, object_size);
}
}
heap->IncrementPromotedObjectsSize(object_size); if (alignment != kObjectAlignment) {
return; target = EnsureDoubleAligned(heap, target, allocation_size);
} }
// The scavenger should always have enough space available in the old // Order is important: slot might be inside of the target if target
// generation for promotion. Otherwise a full gc would have been triggered. // was allocated over a dead object and slot comes from the store
UNREACHABLE(); // buffer.
*slot = target;
MigrateObject(heap, object, target, object_size);
heap->IncrementSemiSpaceCopiedObjectSize(object_size);
return;
} }
......
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