Commit c309a633 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Remove the deprecated context disposal GC heuristic.

Review URL: http://codereview.chromium.org/661458

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4003 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9f681fa9
...@@ -438,7 +438,6 @@ bool V8::IsGlobalWeak(i::Object** obj) { ...@@ -438,7 +438,6 @@ bool V8::IsGlobalWeak(i::Object** obj) {
void V8::DisposeGlobal(i::Object** obj) { void V8::DisposeGlobal(i::Object** obj) {
LOG_API("DisposeGlobal"); LOG_API("DisposeGlobal");
if (!i::V8::IsRunning()) return; if (!i::V8::IsRunning()) return;
if ((*obj)->IsGlobalContext()) i::Heap::NotifyContextDisposedDeprecated();
i::GlobalHandles::Destroy(obj); i::GlobalHandles::Destroy(obj);
} }
...@@ -2887,13 +2886,6 @@ Persistent<Context> v8::Context::New( ...@@ -2887,13 +2886,6 @@ Persistent<Context> v8::Context::New(
i::Handle<i::Context> env; i::Handle<i::Context> env;
{ {
ENTER_V8; ENTER_V8;
#if defined(ANDROID)
// On mobile device, full GC is expensive, leave it to the system to
// decide when should make a full GC.
#else
// Give the heap a chance to cleanup if we've disposed contexts.
i::Heap::CollectAllGarbageIfContextDisposedDeprecated();
#endif
v8::Handle<ObjectTemplate> proxy_template = global_template; v8::Handle<ObjectTemplate> proxy_template = global_template;
i::Handle<i::FunctionTemplateInfo> proxy_constructor; i::Handle<i::FunctionTemplateInfo> proxy_constructor;
i::Handle<i::FunctionTemplateInfo> global_constructor; i::Handle<i::FunctionTemplateInfo> global_constructor;
......
...@@ -115,10 +115,7 @@ int Heap::gc_count_ = 0; ...@@ -115,10 +115,7 @@ int Heap::gc_count_ = 0;
int Heap::always_allocate_scope_depth_ = 0; int Heap::always_allocate_scope_depth_ = 0;
int Heap::linear_allocation_scope_depth_ = 0; int Heap::linear_allocation_scope_depth_ = 0;
int Heap::contexts_disposed_ = 0; int Heap::contexts_disposed_ = 0;
bool Heap::context_disposed_use_deprecated_heuristic_ = true;
bool Heap::context_disposed_deprecated_pending_ = false;
#ifdef DEBUG #ifdef DEBUG
bool Heap::allocation_allowed_ = true; bool Heap::allocation_allowed_ = true;
...@@ -374,32 +371,11 @@ void Heap::CollectAllGarbage(bool force_compaction) { ...@@ -374,32 +371,11 @@ void Heap::CollectAllGarbage(bool force_compaction) {
} }
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() { void Heap::NotifyContextDisposed() {
context_disposed_use_deprecated_heuristic_ = false;
contexts_disposed_++; 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) { bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
// The VM is in the GC state until exiting this function. // The VM is in the GC state until exiting this function.
VMState state(GC); VMState state(GC);
...@@ -644,7 +620,6 @@ void Heap::MarkCompact(GCTracer* tracer) { ...@@ -644,7 +620,6 @@ void Heap::MarkCompact(GCTracer* tracer) {
Counters::objs_since_last_full.Set(0); Counters::objs_since_last_full.Set(0);
contexts_disposed_ = 0; contexts_disposed_ = 0;
context_disposed_deprecated_pending_ = false;
} }
......
...@@ -634,13 +634,8 @@ class Heap : public AllStatic { ...@@ -634,13 +634,8 @@ class Heap : public AllStatic {
// parameter is true. // parameter is true.
static void CollectAllGarbage(bool force_compaction); static void CollectAllGarbage(bool force_compaction);
// Performs a full garbage collection if a context has been disposed
// since the last time the check was performed.
static void CollectAllGarbageIfContextDisposedDeprecated();
// Notify the heap that a context has been disposed. // Notify the heap that a context has been disposed.
static void NotifyContextDisposed(); static void NotifyContextDisposed();
static void NotifyContextDisposedDeprecated();
// Utility to invoke the scavenger. This is needed in test code to // Utility to invoke the scavenger. This is needed in test code to
// ensure correct callback for weak global handles. // ensure correct callback for weak global handles.
...@@ -917,8 +912,6 @@ class Heap : public AllStatic { ...@@ -917,8 +912,6 @@ class Heap : public AllStatic {
// For keeping track of context disposals. // For keeping track of context disposals.
static int contexts_disposed_; static int contexts_disposed_;
static bool context_disposed_use_deprecated_heuristic_;
static bool context_disposed_deprecated_pending_;
#if defined(V8_TARGET_ARCH_X64) #if defined(V8_TARGET_ARCH_X64)
static const int kMaxObjectSizeInNewSpace = 512*KB; static const int kMaxObjectSizeInNewSpace = 512*KB;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment