Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: src/heap.cc

Issue 795003: Version 2.1.2.7... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 4070)
+++ src/heap.cc (working copy)
@@ -115,7 +115,10 @@
int Heap::always_allocate_scope_depth_ = 0;
int Heap::linear_allocation_scope_depth_ = 0;
+
int Heap::contexts_disposed_ = 0;
+bool Heap::context_disposed_use_deprecated_heuristic_ = true;
+bool Heap::context_disposed_deprecated_pending_ = false;
#ifdef DEBUG
bool Heap::allocation_allowed_ = true;
@@ -371,11 +374,32 @@
}
+void Heap::CollectAllGarbageIfContextDisposedDeprecated() {
+ if (!context_disposed_use_deprecated_heuristic_) return;
+ // If the garbage collector interface is exposed through the global
+ // gc() function, we avoid being clever about forcing GCs when
+ // contexts are disposed and leave it to the embedder to make
+ // informed decisions about when to force a collection.
+ if (!FLAG_expose_gc && context_disposed_deprecated_pending_) {
+ HistogramTimerScope scope(&Counters::gc_context);
+ CollectAllGarbage(false);
+ }
+ context_disposed_deprecated_pending_ = false;
+}
+
+
void Heap::NotifyContextDisposed() {
+ context_disposed_use_deprecated_heuristic_ = false;
contexts_disposed_++;
}
+void Heap::NotifyContextDisposedDeprecated() {
+ if (!context_disposed_use_deprecated_heuristic_) return;
+ context_disposed_deprecated_pending_ = true;
+}
+
+
bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
// The VM is in the GC state until exiting this function.
VMState state(GC);
@@ -609,6 +633,7 @@
Counters::objs_since_last_full.Set(0);
contexts_disposed_ = 0;
+ context_disposed_deprecated_pending_ = false;
}
« no previous file with comments | « src/heap.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698