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

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: 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
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 31b93e71991e219b5c6050bd0f17bd890f6018ec..a34c57da0a8dc8c186260bd5b1ad3289442aeed3 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1451,6 +1451,19 @@ static bool IsUnscavengedHeapObject(Heap* heap, Object** p) {
}
+static bool IsUnModifiedNewSpaceObject(Object** p) {
+ Object* object = *p;
+ if (object->IsHeapObject()) {
+ HeapObject* heap_object = reinterpret_cast<HeapObject*>(object);
+ if (!heap_object->GetIsolate()->heap()->InFromSpace(heap_object))
jochen (gone - plz use gerrit) 2015/09/21 11:33:25 if (!IsUnscavengedHeapObject(..)) return true;
+ return true;
+ if (heap_object->map()->GetBackPointer()->IsUndefined()) return true;
jochen (gone - plz use gerrit) 2015/09/21 11:54:19 maybe this is the wrong check? Try heap_object->ma
+ return false;
+ }
+ return true;
+}
+
+
void Heap::ScavengeStoreBufferCallback(Heap* heap, MemoryChunk* page,
StoreBufferEvent event) {
heap->store_buffer_rebuilder_.Callback(page, event);
@@ -1607,7 +1620,11 @@ void Heap::Scavenge() {
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
}
- {
+ if (FLAG_scavenge_remove_unmodified_objects) {
+ isolate()->global_handles()->IterateNewSpaceWeakRoots(
+ &scavenge_visitor, &IsUnModifiedNewSpaceObject);
+ new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
+ } else {
GCTracer::Scope gc_scope(tracer(),
GCTracer::Scope::SCAVENGER_OBJECT_GROUPS);
while (isolate()->global_handles()->IterateObjectGroups(
« src/global-handles.cc ('K') | « 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