Index: src/heap.cc |
=================================================================== |
--- src/heap.cc (revision 13485) |
+++ src/heap.cc (working copy) |
@@ -882,24 +882,13 @@ |
} |
#endif |
- if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { |
- ASSERT(!allocation_allowed_); |
- GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
- VMState state(isolate_, EXTERNAL); |
- global_gc_prologue_callback_(); |
- } |
- |
GCType gc_type = |
collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; |
{ |
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
VMState state(isolate_, EXTERNAL); |
- for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { |
- if (gc_type & gc_prologue_callbacks_[i].gc_type) { |
- gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); |
- } |
- } |
+ CallGCPrologueCallbacks(gc_type); |
} |
EnsureFromSpaceIsCommitted(); |
@@ -1009,21 +998,9 @@ |
{ |
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
VMState state(isolate_, EXTERNAL); |
- GCCallbackFlags callback_flags = kNoGCCallbackFlags; |
- for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { |
- if (gc_type & gc_epilogue_callbacks_[i].gc_type) { |
- gc_epilogue_callbacks_[i].callback(gc_type, callback_flags); |
- } |
- } |
+ CallGCEpilogueCallbacks(gc_type); |
} |
- if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { |
- ASSERT(!allocation_allowed_); |
- GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
- VMState state(isolate_, EXTERNAL); |
- global_gc_epilogue_callback_(); |
- } |
- |
#ifdef VERIFY_HEAP |
if (FLAG_verify_heap) { |
VerifySymbolTable(); |
@@ -1034,6 +1011,30 @@ |
} |
+void Heap::CallGCPrologueCallbacks(GCType gc_type) { |
+ if (gc_type == kGCTypeMarkSweepCompact && global_gc_prologue_callback_) { |
+ global_gc_prologue_callback_(); |
+ } |
+ for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { |
+ if (gc_type & gc_prologue_callbacks_[i].gc_type) { |
+ gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); |
+ } |
+ } |
+} |
+ |
+ |
+void Heap::CallGCEpilogueCallbacks(GCType gc_type) { |
+ for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { |
+ if (gc_type & gc_epilogue_callbacks_[i].gc_type) { |
+ gc_epilogue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); |
+ } |
+ } |
+ if (gc_type == kGCTypeMarkSweepCompact && global_gc_epilogue_callback_) { |
+ global_gc_epilogue_callback_(); |
+ } |
+} |
+ |
+ |
void Heap::MarkCompact(GCTracer* tracer) { |
gc_state_ = MARK_COMPACT; |
LOG(isolate_, ResourceEvent("markcompact", "begin")); |
@@ -1376,6 +1377,7 @@ |
new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
} |
isolate()->global_handles()->RemoveObjectGroups(); |
+ isolate()->global_handles()->RemoveImplicitRefGroups(); |
isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles( |
&IsUnscavengedHeapObject); |