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

Unified Diff: src/heap/heap.cc

Issue 1125383007: Postpone counters triggered during GC, and use a HandleScope when calling back. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Codereview feedback Created 5 years, 7 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/heap.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 54a8915788237436b72762d6cb303ed9f189725b..2ba75d0f27c6b40eeaec90ca3c2e25c2f0a95cb1 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -395,6 +395,20 @@ void Heap::ReportStatisticsAfterGC() {
#else
if (FLAG_log_gc) new_space_.ReportStatistics();
#endif // DEBUG
+ for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount);
+ ++i) {
+ int count = deferred_counters_[i];
+ deferred_counters_[i] = 0;
+ while (count > 0) {
+ count--;
+ isolate()->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(i));
+ }
+ }
+}
+
+
+void Heap::IncrementDeferredCount(v8::Isolate::UseCounterFeature feature) {
+ deferred_counters_[feature]++;
}
@@ -925,6 +939,11 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
tracer()->Stop(collector);
}
+ if (collector == MARK_COMPACTOR &&
+ (gc_callback_flags & kGCCallbackFlagForced) != 0) {
+ isolate()->CountUsage(v8::Isolate::kForcedGC);
+ }
+
// Start incremental marking for the next cycle. The heap snapshot
// generator needs incremental marking to stay off after it aborted.
if (!mark_compact_collector()->abort_incremental_marking() &&
@@ -5422,6 +5441,12 @@ bool Heap::SetUp() {
}
}
+ for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount);
+ i++) {
+ deferred_counters_[i] = 0;
+ }
+
+
LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
LOG(isolate_, IntPtrTEvent("heap-available", Available()));
« no previous file with comments | « src/heap/heap.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698