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

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: modified check for unmodified objects 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..b15058c0d97f27c10515e79ac4fba00cda7d5179 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1451,6 +1451,24 @@ 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 (!heap_object->GetIsolate()->heap()->InFromSpace(heap_object)) return true;
+ if (heap_object->map_word().IsForwardingAddress()) return true;
+ if (!object->IsJSObject()) {
+ DCHECK(object->IsName());
+ return false;
+ }
+ // if (heap_object->map()->GetBackPointer()->IsUndefined()) return true;
+ JSFunction* constructor =
+ JSFunction::cast((JSObject::cast(object))->map()->GetConstructor());
+ if (constructor->initial_map() == heap_object->map()) return true;
mythria 2015/09/22 10:45:07 I modified the check and I still have the same pro
+ return false;
+}
+
+
void Heap::ScavengeStoreBufferCallback(Heap* heap, MemoryChunk* page,
StoreBufferEvent event) {
heap->store_buffer_rebuilder_.Callback(page, event);
@@ -1607,7 +1625,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(
« 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