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

Unified Diff: runtime/vm/heap.cc

Issue 51653006: Track live instance and allocation counts for classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
Index: runtime/vm/heap.cc
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index 8f6633ca93e5c6e7ab1f5369cf0b6b2ee52b28a7..bcce09e005fdd34922a58d47349f2d31ab9cb8bf 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -173,6 +173,7 @@ void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) {
case kCode: {
bool promotion_failure = new_space_->HadPromotionFailure();
RecordBeforeGC(kOld, promotion_failure ? kPromotionFailure : kOldSpace);
+ UpdateClassStats();
old_space_->MarkSweep(invoke_api_callbacks);
RecordAfterGC();
PrintStats();
@@ -192,6 +193,13 @@ void Heap::UpdateObjectHistogram() {
}
+void Heap::UpdateClassStats() {
+ Isolate* isolate = Isolate::Current();
+ ClassTable* class_table = isolate->class_table();
+ class_table->Collect();
+}
+
+
void Heap::CollectGarbage(Space space) {
ApiCallbacks api_callbacks;
if (space == kOld) {
@@ -205,6 +213,7 @@ void Heap::CollectGarbage(Space space) {
void Heap::CollectAllGarbage() {
RecordBeforeGC(kNew, kFull);
+ UpdateClassStats();
new_space_->Scavenge(kInvokeApiCallbacks);
RecordAfterGC();
PrintStats();

Powered by Google App Engine
This is Rietveld 408576698