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

Unified Diff: runtime/vm/heap.cc

Issue 195733009: Basic tag infrastructure (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap.cc
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index 4348d6b6e076c968ebd29567e87bd6173d19fd56..18c26c6e7750d14d51f1f16408148a49f5f6f3cf 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -15,6 +15,7 @@
#include "vm/raw_object.h"
#include "vm/scavenger.h"
#include "vm/stack_frame.h"
+#include "vm/tags.h"
#include "vm/verifier.h"
#include "vm/virtual_memory.h"
#include "vm/weak_table.h"
@@ -176,9 +177,11 @@ RawObject* Heap::FindOldObject(FindObjectVisitor* visitor) const {
void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) {
+ Isolate* isolate = Isolate::Current();
bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks);
switch (space) {
case kNew: {
+ VMTagScope tagScope(isolate, VMTag::kGCNewSpaceTagId);
RecordBeforeGC(kNew, kNewSpace);
UpdateClassHeapStatsBeforeGC(kNew);
new_space_->Scavenge(invoke_api_callbacks);
@@ -192,6 +195,7 @@ void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) {
}
case kOld:
case kCode: {
+ VMTagScope tagScope(isolate, VMTag::kGCOldSpaceTagId);
bool promotion_failure = new_space_->HadPromotionFailure();
RecordBeforeGC(kOld, promotion_failure ? kPromotionFailure : kOldSpace);
UpdateClassHeapStatsBeforeGC(kOld);
@@ -229,16 +233,23 @@ void Heap::CollectGarbage(Space space) {
void Heap::CollectAllGarbage() {
- RecordBeforeGC(kNew, kFull);
- UpdateClassHeapStatsBeforeGC(kNew);
- new_space_->Scavenge(kInvokeApiCallbacks);
- RecordAfterGC();
- PrintStats();
- RecordBeforeGC(kOld, kFull);
- UpdateClassHeapStatsBeforeGC(kOld);
- old_space_->MarkSweep(kInvokeApiCallbacks);
- RecordAfterGC();
- PrintStats();
+ Isolate* isolate = Isolate::Current();
+ {
+ VMTagScope tagScope(isolate, VMTag::kGCNewSpaceTagId);
+ RecordBeforeGC(kNew, kFull);
+ UpdateClassHeapStatsBeforeGC(kNew);
+ new_space_->Scavenge(kInvokeApiCallbacks);
+ RecordAfterGC();
+ PrintStats();
+ }
+ {
+ VMTagScope tagScope(isolate, VMTag::kGCOldSpaceTagId);
+ RecordBeforeGC(kOld, kFull);
+ UpdateClassHeapStatsBeforeGC(kOld);
+ old_space_->MarkSweep(kInvokeApiCallbacks);
+ RecordAfterGC();
+ PrintStats();
+ }
}
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698