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

Unified Diff: runtime/vm/scavenger.cc

Issue 2993203002: Changes calculation of Scavenger's UsedInWords (Closed)
Patch Set: Created 3 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.cc
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index 3d40c23bcf6e030e6658ee4ba067cdf9a0d55fd4..935a5c8f5cf8833dbed81705268801f2cc778686 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -924,8 +924,16 @@ void Scavenger::Evacuate() {
}
int64_t Scavenger::UsedInWords() const {
- int64_t used_in_words = (top_ - FirstObjectStart()) >> kWordSizeLog2;
- return used_in_words;
+ int64_t free_space_in_tlab = 0;
+ if (heap_->isolate()->IsMutatorThreadScheduled()) {
+ Thread* mutator_thread = heap_->isolate()->mutator_thread();
+ if (mutator_thread->HasActiveTLAB()) {
+ free_space_in_tlab =
+ (mutator_thread->end() - mutator_thread->top()) >> kWordSizeLog2;
+ }
+ }
+ int64_t max_space_used = (top_ - FirstObjectStart()) >> kWordSizeLog2;
+ return max_space_used - free_space_in_tlab;
}
} // namespace dart
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698