Fixes bug in calculation of memory used by new space

Changes Scavenger to use mutator's top_ to calculate memory used in
new space instead of the Scavenger's when the VM is not scavenging.

Closes https://github.com/dart-lang/sdk/issues/30311

R=cbernaschina@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2992153002 .
This commit is contained in:
Diogenes Nunez
2017-08-01 13:29:12 -07:00
parent 6f0cd90b13
commit 044f818f01
2 changed files with 8 additions and 3 deletions
+7
View File
@@ -948,4 +948,11 @@ void Scavenger::Evacuate() {
ASSERT((UsedInWords() == 0) || failed_to_promote_);
}
int64_t Scavenger::UsedInWords() const {
uword saved_top = FlushTLS();
int64_t used_in_words = (top_ - FirstObjectStart()) >> kWordSizeLog2;
UnflushTLS(saved_top);
return used_in_words;
}
} // namespace dart
+1 -3
View File
@@ -201,9 +201,7 @@ class Scavenger {
end_ = value;
}
int64_t UsedInWords() const {
return (top_ - FirstObjectStart()) >> kWordSizeLog2;
}
int64_t UsedInWords() const;
int64_t CapacityInWords() const { return to_->size_in_words(); }
int64_t ExternalInWords() const { return external_size_ >> kWordSizeLog2; }
SpaceUsage GetCurrentUsage() const {