Ensure the word after top is cleared in newspace if top < high.

BUG=
R=ulan@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19014 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2014-02-01 10:35:36 +00:00
parent d34938fe34
commit 9e995fdd91
2 changed files with 15 additions and 1 deletions

View File

@ -488,7 +488,7 @@ void Heap::ScavengePointer(HeapObject** p) {
void Heap::UpdateAllocationSiteFeedback(HeapObject* object) { void Heap::UpdateAllocationSiteFeedback(HeapObject* object) {
Heap* heap = object->GetHeap(); Heap* heap = object->GetHeap();
ASSERT(heap->InNewSpace(object)); ASSERT(heap->InFromSpace(object));
if (!FLAG_allocation_site_pretenuring || if (!FLAG_allocation_site_pretenuring ||
!AllocationSite::CanTrack(object->map()->instance_type())) return; !AllocationSite::CanTrack(object->map()->instance_type())) return;

View File

@ -3007,6 +3007,20 @@ void MarkCompactCollector::EvacuateNewSpace() {
new_space->Flip(); new_space->Flip();
new_space->ResetAllocationInfo(); new_space->ResetAllocationInfo();
// UpdateAllocationSiteFeedback expects that only objects at the end of
// newspace are not guaranteed to have the next word clear. It relies on
// FromSpacePageHigh to check whether an object is at the end of newspace.
// However, it is possible that newspace is being evacuated without it being
// full, e.g. to make the heap iterable, hence top will not equal high. In
// that case, fill up newspace with a filler to ensure the next word is
// cleared.
if (FLAG_allocation_site_pretenuring &&
from_top < new_space->FromSpacePageHigh()) {
Address limit = NewSpacePage::FromLimit(from_top)->area_end();
int remaining_in_page = static_cast<int>(limit - from_top);
heap()->CreateFillerObjectAt(from_top, remaining_in_page);
}
int survivors_size = 0; int survivors_size = 0;
// First pass: traverse all objects in inactive semispace, remove marks, // First pass: traverse all objects in inactive semispace, remove marks,