Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index b75f751562b43174459a1af00382e210c50db521..c138f90ce3fe8091355c25f16614028af5209eaa 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -1547,6 +1547,29 @@ void Heap::Scavenge() { |
PrintF("AllocationMementos found during scavenge = %d\n", |
allocation_mementos_found_); |
} |
+ |
+ if (FLAG_allocation_site_pretenuring) { |
+ int pretenure_decisions_made = 0; |
+ Object* cur = allocation_sites_list(); |
+ if (cur->IsAllocationSite()) { |
+ while (cur->IsAllocationSite()) { |
+ AllocationSite* casted = AllocationSite::cast(cur); |
+ if (!(casted->DecisionMade())) { |
Hannes Payer (out of office)
2013/11/21 20:52:24
See the other comment about not enough allocation
mvstanton
2013/11/22 11:18:51
I've simplified and encapsulated this code in a wa
|
+ casted->Decide(); |
+ if (casted->GetPretenureMode() == TENURED) { |
+ pretenure_decisions_made++; |
+ } |
+ } |
+ casted->Clear(); |
+ cur = casted->weak_next(); |
+ } |
+ } |
Hannes Payer (out of office)
2013/11/21 20:52:24
Right now we do not support switching state which
mvstanton
2013/11/22 11:18:51
Done.
|
+ |
+ if (FLAG_trace_track_allocation_sites && pretenure_decisions_made > 0) { |
+ PrintF("Scavenge: pretenure decisions made: %d\n", |
+ pretenure_decisions_made); |
+ } |
+ } |
} |
@@ -4376,6 +4399,9 @@ MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space, |
alloc_memento->set_map_no_write_barrier(allocation_memento_map()); |
ASSERT(allocation_site->map() == allocation_site_map()); |
alloc_memento->set_allocation_site(*allocation_site, SKIP_WRITE_BARRIER); |
+ if (FLAG_allocation_site_pretenuring) { |
+ allocation_site->IncrementMementoCreateCount(); |
Hannes Payer (out of office)
2013/11/21 20:52:24
I am wondering if this counter is not only interes
mvstanton
2013/11/22 11:18:51
Maybe so, but not yet. I like the idea of keeping
|
+ } |
return result; |
} |
@@ -4808,8 +4834,7 @@ MaybeObject* Heap::CopyJSObject(JSObject* source, AllocationSite* site) { |
int object_size = map->instance_size(); |
Object* clone; |
- ASSERT(site == NULL || (AllocationSite::CanTrack(map->instance_type()) && |
- map->instance_type() == JS_ARRAY_TYPE)); |
+ ASSERT(site == NULL || AllocationSite::CanTrack(map->instance_type())); |
WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER; |
@@ -4851,6 +4876,9 @@ MaybeObject* Heap::CopyJSObject(JSObject* source, AllocationSite* site) { |
alloc_memento->set_map_no_write_barrier(allocation_memento_map()); |
ASSERT(site->map() == allocation_site_map()); |
alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER); |
+ if (FLAG_allocation_site_pretenuring) { |
+ site->IncrementMementoCreateCount(); |
+ } |
HeapProfiler* profiler = isolate()->heap_profiler(); |
if (profiler->is_tracking_allocations()) { |
profiler->UpdateObjectSizeEvent(HeapObject::cast(clone)->address(), |