Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index 31b93e71991e219b5c6050bd0f17bd890f6018ec..dda79ce24ea08e4bc5606b6cbdae5ec0f1b8f6a6 100644 |
| --- a/src/heap/heap.cc |
| +++ b/src/heap/heap.cc |
| @@ -1451,6 +1451,21 @@ static bool IsUnscavengedHeapObject(Heap* heap, Object** p) { |
| } |
| +static bool IsUnModifiedNewSpaceObject(Object** p) { |
| + Object* object = *p; |
| + DCHECK(object->IsHeapObject()); |
| + HeapObject* heap_object = HeapObject::cast(object); |
| + if (!object->IsJSObject()) { |
| + return false; |
| + } |
| + Object* obj_constructor = (JSObject::cast(object))->map()->GetConstructor(); |
| + JSFunction* constructor = JSFunction::cast(obj_constructor); |
| + if (constructor == NULL) return false; |
| + if (constructor->initial_map() == heap_object->map()) return true; |
| + return false; |
| +} |
| + |
| + |
| void Heap::ScavengeStoreBufferCallback(Heap* heap, MemoryChunk* page, |
| StoreBufferEvent event) { |
| heap->store_buffer_rebuilder_.Callback(page, event); |
| @@ -1569,6 +1584,13 @@ void Heap::Scavenge() { |
| promotion_queue_.Initialize(); |
| ScavengeVisitor scavenge_visitor(this); |
| + |
| + if (FLAG_scavenge_remove_unmodified_objects) { |
| + isolate()->global_handles()->IdentifyWeakUnmodifiedObjects( |
|
mythria
2015/09/25 17:23:51
Before, we process anything we park the unmodified
|
| + &IsUnModifiedNewSpaceObject); |
| + } |
| + |
| + |
| { |
| // Copy roots. |
| GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_ROOTS); |
| @@ -1607,7 +1629,7 @@ void Heap::Scavenge() { |
| new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
| } |
| - { |
| + if (!FLAG_scavenge_remove_unmodified_objects) { |
| GCTracer::Scope gc_scope(tracer(), |
| GCTracer::Scope::SCAVENGER_OBJECT_GROUPS); |
| while (isolate()->global_handles()->IterateObjectGroups( |
| @@ -2852,8 +2874,8 @@ void Heap::AddAllocationSiteToScratchpad(AllocationSite* site, |
| // candidates are not part of the global list of old space pages and |
| // releasing an evacuation candidate due to a slots buffer overflow |
| // results in lost pages. |
| - mark_compact_collector()->ForceRecordSlot(allocation_sites_scratchpad(), |
| - slot, *slot); |
| + mark_compact_collector()->RecordSlot(allocation_sites_scratchpad(), slot, |
| + *slot); |
| } |
| allocation_sites_scratchpad_length_++; |
| } |