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

Unified Diff: runtime/vm/scavenger.h

Issue 187113003: Track external allocated memory for weak persistent handles. (Closed) Base URL: http://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
Index: runtime/vm/scavenger.h
===================================================================
--- runtime/vm/scavenger.h (revision 33235)
+++ runtime/vm/scavenger.h (working copy)
@@ -74,6 +74,9 @@
return (top_ - FirstObjectStart()) >> kWordSizeLog2;
}
intptr_t CapacityInWords() const { return space_->size() >> kWordSizeLog2; }
+ intptr_t ExternalInWords() const {
+ return external_size_ >> kWordSizeLog2;
+ }
void VisitObjects(ObjectVisitor* visitor) const;
void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
@@ -108,6 +111,9 @@
void PrintToJSONObject(JSONObject* object);
+ void AllocateExternal(intptr_t size);
+ void FreeExternal(intptr_t size);
+
private:
// Ids for time and data records in Heap::GCStats.
enum {
@@ -149,17 +155,23 @@
// object sizes are always greater than sizeof(uword) and promoted objects do
// not consume space in the to space they leave enough room for this stack.
void PushToPromotedStack(uword addr) {
+ ASSERT(scavenging_);
+ ASSERT(external_size_ == 0);
end_ -= sizeof(addr);
ASSERT(end_ > top_);
*reinterpret_cast<uword*>(end_) = addr;
}
uword PopFromPromotedStack() {
+ ASSERT(scavenging_);
+ ASSERT(external_size_ == 0);
uword result = *reinterpret_cast<uword*>(end_);
end_ += sizeof(result);
ASSERT(end_ <= to_->end());
return result;
}
bool PromotedStackHasMore() const {
+ ASSERT(scavenging_);
+ ASSERT(external_size_ == 0);
return end_ < to_->end();
}
@@ -194,6 +206,10 @@
int64_t gc_time_micros_;
intptr_t collections_;
+ // The total size of external data associated with objects in this scavenger.
+ // External allocations decrease end_. If promoted stack is in use, this is 0.
+ intptr_t external_size_;
+
friend class ScavengerVisitor;
friend class ScavengerWeakVisitor;
« runtime/vm/heap.h ('K') | « runtime/vm/pages.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698