how many pending context disposals there are.
Review URL: http://codereview.chromium.org/669266
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4049
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
/**
* 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();
}
-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();
}
}
-void Heap::NotifyContextDisposed() {
- contexts_disposed_++;
-}
-
-
bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
// The VM is in the GC state until exiting this function.
VMState state(GC);
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.