| Index: src/heap-inl.h
|
| diff --git a/src/heap-inl.h b/src/heap-inl.h
|
| index 3dce348727477c260c894f3710956e4fe0e2ce8f..fedf450ef16de2c80f86d9f126a43ce03211559d 100644
|
| --- a/src/heap-inl.h
|
| +++ b/src/heap-inl.h
|
| @@ -28,6 +28,8 @@
|
| #ifndef V8_HEAP_INL_H_
|
| #define V8_HEAP_INL_H_
|
|
|
| +#include <cmath>
|
| +
|
| #include "heap.h"
|
| #include "isolate.h"
|
| #include "list-inl.h"
|
| @@ -484,22 +486,33 @@ void Heap::ScavengePointer(HeapObject** p) {
|
|
|
|
|
| void Heap::UpdateAllocationSiteFeedback(HeapObject* object) {
|
| - if (FLAG_allocation_site_pretenuring &&
|
| - AllocationSite::CanTrack(object->map()->instance_type())) {
|
| - AllocationMemento* memento = AllocationMemento::FindForHeapObject(
|
| - object, true);
|
| - if (memento != NULL) {
|
| - ASSERT(memento->IsValid());
|
| - bool add_to_scratchpad =
|
| - memento->GetAllocationSite()->IncrementMementoFoundCount();
|
| - Heap* heap = object->GetIsolate()->heap();
|
| - if (add_to_scratchpad && heap->allocation_sites_scratchpad_length <
|
| - kAllocationSiteScratchpadSize) {
|
| - heap->allocation_sites_scratchpad[
|
| - heap->allocation_sites_scratchpad_length++] =
|
| - memento->GetAllocationSite();
|
| - }
|
| - }
|
| + Heap* heap = object->GetHeap();
|
| + ASSERT(heap->InNewSpace(object));
|
| +
|
| + if (!FLAG_allocation_site_pretenuring ||
|
| + !heap->new_space_high_promotion_mode_active_ ||
|
| + !AllocationSite::CanTrack(object->map()->instance_type())) return;
|
| +
|
| + // Either object is the last object in the from space, or there is another
|
| + // object of at least word size (the header map word) following it, so
|
| + // suffices to compare ptr and top here.
|
| + Address ptr = object->address() + object->Size();
|
| + Address top = heap->new_space()->FromSpacePageHigh();
|
| + ASSERT(ptr == top || ptr + HeapObject::kHeaderSize <= top);
|
| + if (ptr == top) return;
|
| +
|
| + HeapObject* candidate = HeapObject::FromAddress(ptr);
|
| + if (candidate->map() != heap->allocation_memento_map()) return;
|
| +
|
| + AllocationMemento* memento = AllocationMemento::cast(candidate);
|
| + if (!memento->IsValid()) return;
|
| +
|
| + if (memento->GetAllocationSite()->IncrementMementoFoundCount() &&
|
| + heap->allocation_sites_scratchpad_length <
|
| + kAllocationSiteScratchpadSize) {
|
| + heap->allocation_sites_scratchpad[
|
| + heap->allocation_sites_scratchpad_length++] =
|
| + memento->GetAllocationSite();
|
| }
|
| }
|
|
|
| @@ -531,10 +544,13 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
|
| }
|
|
|
|
|
| -bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason) {
|
| +bool Heap::CollectGarbage(AllocationSpace space,
|
| + const char* gc_reason,
|
| + const v8::GCCallbackFlags callbackFlags) {
|
| const char* collector_reason = NULL;
|
| GarbageCollector collector = SelectGarbageCollector(space, &collector_reason);
|
| - return CollectGarbage(space, collector, gc_reason, collector_reason);
|
| + return CollectGarbage(
|
| + space, collector, gc_reason, collector_reason, callbackFlags);
|
| }
|
|
|
|
|
|
|