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:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user