Revision: 4049
Author: [email protected]
Date: Mon Mar  8 03:19:20 2010
Log: Let the callers of V8::ContextDisposedNoticication() know
how many pending context disposals there are.
Review URL: http://codereview.chromium.org/669266
http://code.google.com/p/v8/source/detail?r=4049

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h

=======================================
--- /branches/bleeding_edge/include/v8.h        Thu Mar  4 04:13:04 2010
+++ /branches/bleeding_edge/include/v8.h        Mon Mar  8 03:19:20 2010
@@ -2507,9 +2507,11 @@

   /**
    * Optional notification that a context has been disposed. V8 uses
-   * these notifications to guide the garbage collection heuristic.
+   * these notifications to guide the GC heuristic. Returns the number
+   * of context disposals - including this one - since the last time
+   * V8 had a chance to clean up.
    */
-  static void ContextDisposedNotification();
+  static int ContextDisposedNotification();

  private:
   V8();
=======================================
--- /branches/bleeding_edge/src/api.cc  Thu Mar  4 05:25:23 2010
+++ /branches/bleeding_edge/src/api.cc  Mon Mar  8 03:19:20 2010
@@ -2872,9 +2872,9 @@
 }


-void v8::V8::ContextDisposedNotification() {
-  if (!i::V8::IsRunning()) return;
-  i::Heap::NotifyContextDisposed();
+int v8::V8::ContextDisposedNotification() {
+  if (!i::V8::IsRunning()) return 0;
+  return i::Heap::NotifyContextDisposed();
 }


=======================================
--- /branches/bleeding_edge/src/heap.cc Fri Mar  5 05:35:59 2010
+++ /branches/bleeding_edge/src/heap.cc Mon Mar  8 03:19:20 2010
@@ -370,11 +370,6 @@
   CollectGarbage(0, OLD_POINTER_SPACE);
   MarkCompactCollector::SetForceCompaction(false);
 }
-
-
-void Heap::NotifyContextDisposed() {
-  contexts_disposed_++;
-}


 bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
=======================================
--- /branches/bleeding_edge/src/heap.h  Thu Mar  4 06:03:08 2010
+++ /branches/bleeding_edge/src/heap.h  Mon Mar  8 03:19:20 2010
@@ -643,7 +643,7 @@
   static void CollectAllGarbage(bool force_compaction);

   // Notify the heap that a context has been disposed.
-  static void NotifyContextDisposed();
+  static int NotifyContextDisposed() { return ++contexts_disposed_; }

   // Utility to invoke the scavenger. This is needed in test code to
   // ensure correct callback for weak global handles.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to