| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index ef1eb77a500ab4c9916506c13e1295d9fb0a9555..1e7598ceda21731dfe81fdc58da2f109c62b60ce 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -985,6 +985,45 @@ void StoreBufferRebuilder::Callback(MemoryChunk* page, StoreBufferEvent event) {
|
| }
|
|
|
|
|
| +void PromotionQueue::SetNewLimit(Address limit) {
|
| + if (emergency_stack_ != NULL) return;
|
| +
|
| + limit_ = reinterpret_cast<intptr_t*>(limit);
|
| +
|
| + Page* queue_page = Page::FromAllocationTop(reinterpret_cast<Address>(rear_));
|
| + Page* limit_page = Page::FromAllocationTop(limit);
|
| +
|
| + if (queue_page != limit_page || limit_ <= rear_) {
|
| + return;
|
| + }
|
| +
|
| + RelocateQueueHead();
|
| +}
|
| +
|
| +
|
| +void PromotionQueue::RelocateQueueHead() {
|
| + ASSERT(emergency_stack_ == NULL);
|
| +
|
| + Page* p = Page::FromAllocationTop(reinterpret_cast<Address>(rear_));
|
| + intptr_t* head_start = rear_;
|
| + intptr_t* head_end =
|
| + Min(front_, reinterpret_cast<intptr_t*>(p->body_limit()));
|
| +
|
| + int entries_count = (head_end - head_start) / kEntrySizeInWords;
|
| +
|
| + emergency_stack_ = new List<Entry>(2 * entries_count);
|
| +
|
| + while (head_start != head_end) {
|
| + int size = *(head_start++);
|
| + HeapObject* obj = reinterpret_cast<HeapObject*>(*(head_start++));
|
| + emergency_stack_->Add(Entry(obj, size));
|
| + }
|
| + rear_ = head_end;
|
| +
|
| + ASSERT(emergency_stack_->length() > 0);
|
| +}
|
| +
|
| +
|
| void Heap::Scavenge() {
|
| #ifdef DEBUG
|
| if (FLAG_verify_heap) VerifyNonPointerSpacePointers();
|
| @@ -1033,7 +1072,7 @@ void Heap::Scavenge() {
|
| // frees up its size in bytes from the top of the new space, and
|
| // objects are at least one pointer in size.
|
| Address new_space_front = new_space_.ToSpaceStart();
|
| - promotion_queue_.Initialize(new_space_.ToSpaceEnd());
|
| + promotion_queue_.Initialize(new_space());
|
|
|
| #ifdef DEBUG
|
| store_buffer()->Clean();
|
| @@ -1073,10 +1112,11 @@ void Heap::Scavenge() {
|
| &scavenge_visitor);
|
| new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
|
|
|
| -
|
| UpdateNewSpaceReferencesInExternalStringTable(
|
| &UpdateNewSpaceReferenceInExternalStringTableEntry);
|
|
|
| + promotion_queue_.Destroy();
|
| +
|
| LiveObjectList::UpdateReferencesForScavengeGC();
|
| isolate()->runtime_profiler()->UpdateSamplesAfterScavenge();
|
| incremental_marking()->UpdateMarkingDequeAfterScavenge();
|
| @@ -1483,6 +1523,7 @@ class ScavengingVisitor : public StaticVisitorBase {
|
| }
|
| }
|
| MaybeObject* allocation = heap->new_space()->AllocateRaw(object_size);
|
| + heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
|
| Object* result = allocation->ToObjectUnchecked();
|
|
|
| *slot = MigrateObject(heap, object, HeapObject::cast(result), object_size);
|
|
|