The GC prologue is called by the GC, but also by the heap snapshotter. The
RetainedObjectInfos are only needed by the heap snapshotter, so it's wasteful to
construct them always. (And it will be even more wasteful when Blink migrates to
the new GC APIs, since after that point it no longer knows about object groups.)
BUG=
Review URL: https://codereview.chromium.org/
14471028
Patch from Marja Hölttä <marja@chromium.org>.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14439
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
enum GCCallbackFlags {
kNoGCCallbackFlags = 0,
- kGCCallbackFlagCompacted = 1 << 0
+ kGCCallbackFlagCompacted = 1 << 0,
+ kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1
};
typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags);
Isolate* isolate = Isolate::Current();
const GCType major_gc_type = kGCTypeMarkSweepCompact;
// Record objects that are joined into ObjectGroups.
- isolate->heap()->CallGCPrologueCallbacks(major_gc_type);
+ isolate->heap()->CallGCPrologueCallbacks(
+ major_gc_type, kGCCallbackFlagConstructRetainedObjectInfos);
List<ObjectGroup*>* groups = isolate->global_handles()->object_groups();
for (int i = 0; i < groups->length(); ++i) {
ObjectGroup* group = groups->at(i);
{
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
VMState<EXTERNAL> state(isolate_);
- CallGCPrologueCallbacks(gc_type);
+ CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags);
}
EnsureFromSpaceIsCommitted();
}
-void Heap::CallGCPrologueCallbacks(GCType gc_type) {
+void Heap::CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags) {
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);
+ gc_prologue_callbacks_[i].callback(gc_type, flags);
}
}
}
inline Isolate* isolate();
- void CallGCPrologueCallbacks(GCType gc_type);
+ void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags);
void CallGCEpilogueCallbacks(GCType gc_type);
inline bool OldGenerationAllocationLimitReached();