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

Unified Diff: src/isolate.cc

Issue 934773002: Add historgram for number of GC needed to collect a detached context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make tracking default, add tracing, and fix a bug. Created 5 years, 10 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/flag-definitions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 37020da1559b70828dfceedf5eb75cb32391817b..7598051c34df468f9e8fd72c738f977ecef8e328 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2595,21 +2595,25 @@ void Isolate::CheckDetachedContextsAfterGC() {
detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1));
detached_contexts->set(new_length + 1, cell);
new_length += 2;
+ } else {
+ counters()->detached_context_age_in_gc()->AddSample(mark_sweeps);
}
}
- PrintF("%d detached contexts are collected out of %d\n", length - new_length,
- length);
- for (int i = 0; i < new_length; i += 2) {
- int mark_sweeps = Smi::cast(detached_contexts->get(i))->value();
- WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1));
- if (mark_sweeps > 3) {
- PrintF("detached context 0x%p\n survived %d GCs (leak?)\n",
- static_cast<void*>(cell->value()), mark_sweeps);
+ if (FLAG_trace_detached_contexts) {
+ PrintF("%d detached contexts are collected out of %d\n",
+ length - new_length, length);
+ for (int i = 0; i < new_length; i += 2) {
+ int mark_sweeps = Smi::cast(detached_contexts->get(i))->value();
+ WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1));
+ if (mark_sweeps > 3) {
+ PrintF("detached context 0x%p\n survived %d GCs (leak?)\n",
+ static_cast<void*>(cell->value()), mark_sweeps);
+ }
}
}
- if (length == new_length) {
+ if (new_length == 0) {
heap()->set_detached_contexts(heap()->empty_fixed_array());
- } else {
+ } else if (new_length < length) {
heap()->RightTrimFixedArray<Heap::FROM_GC>(*detached_contexts,
length - new_length);
}
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698