Revision: 14439
Author:   [email protected]
Date:     Thu Apr 25 05:08:10 2013
Log: Tell the GC prologues to construct RetainedObjectInfos only when needed.

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ä <[email protected]>.
http://code.google.com/p/v8/source/detail?r=14439

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/heap-snapshot-generator.cc
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h

=======================================
--- /branches/bleeding_edge/include/v8.h        Thu Apr 25 05:02:23 2013
+++ /branches/bleeding_edge/include/v8.h        Thu Apr 25 05:08:10 2013
@@ -3053,7 +3053,8 @@

 enum GCCallbackFlags {
   kNoGCCallbackFlags = 0,
-  kGCCallbackFlagCompacted = 1 << 0
+  kGCCallbackFlagCompacted = 1 << 0,
+  kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1
 };

 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags);
=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.cc Wed Apr 24 08:59:23 2013 +++ /branches/bleeding_edge/src/heap-snapshot-generator.cc Thu Apr 25 05:08:10 2013
@@ -1936,7 +1936,8 @@
   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);
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Apr 24 07:44:08 2013
+++ /branches/bleeding_edge/src/heap.cc Thu Apr 25 05:08:10 2013
@@ -893,7 +893,7 @@
   {
     GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
     VMState<EXTERNAL> state(isolate_);
-    CallGCPrologueCallbacks(gc_type);
+    CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags);
   }

   EnsureFromSpaceIsCommitted();
@@ -1028,13 +1028,13 @@
 }


-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);
     }
   }
 }
=======================================
--- /branches/bleeding_edge/src/heap.h  Thu Apr 25 05:02:23 2013
+++ /branches/bleeding_edge/src/heap.h  Thu Apr 25 05:08:10 2013
@@ -1761,7 +1761,7 @@

   inline Isolate* isolate();

-  void CallGCPrologueCallbacks(GCType gc_type);
+  void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags);
   void CallGCEpilogueCallbacks(GCType gc_type);

   inline bool OldGenerationAllocationLimitReached();

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to