Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Unified Diff: src/heap/heap.cc

Issue 1358703003: Changed scavenge GC to collect unmodified references (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Re-implemented scavenge optimization to discard unmodified references Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/global-handles.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_++;
}
« no previous file with comments | « src/global-handles.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698