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

Unified Diff: runtime/vm/scavenger.h

Issue 2951333002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: Created 3 years, 6 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
diff --git a/runtime/vm/scavenger.h b/runtime/vm/scavenger.h
index 7fa3950f701eb2847e9356e43f952552e8f01699..9bddadaec4053fca62ce78feda384fcacfc8f67d 100644
--- a/runtime/vm/scavenger.h
+++ b/runtime/vm/scavenger.h
@@ -124,11 +124,17 @@ class Scavenger {
uword TryAllocate(intptr_t size) {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
ASSERT(heap_ != Dart::vm_isolate()->heap());
+
#if defined(DEBUG)
if (FLAG_gc_at_alloc && !scavenging_) {
Scavenge();
+ ASSERT(Isolate::Current()->mutator_thread()->top() == top_);
rmacnak 2017/06/22 22:31:51 Thread::Current() should be the mutator
danunez 2017/06/30 20:35:57 Done.
}
#endif
+
+ top_ = Isolate::Current()->mutator_thread()->top();
+ ASSERT(Isolate::Current()->mutator_thread()->end() == end_);
+
uword result = top_;
intptr_t remaining = end_ - top_;
if (remaining < size) {
@@ -139,6 +145,7 @@ class Scavenger {
top_ += size;
ASSERT(to_->Contains(top_) || (top_ == to_->end()));
+ Isolate::Current()->mutator_thread()->set_top_offset(top_);
return result;
}
@@ -234,6 +241,7 @@ class Scavenger {
void PushToPromotedStack(uword addr) {
ASSERT(scavenging_);
end_ -= sizeof(addr);
+ Isolate::Current()->mutator_thread()->set_end_offset(end_);
ASSERT(end_ > top_);
*reinterpret_cast<uword*>(end_) = addr;
}
@@ -241,6 +249,7 @@ class Scavenger {
ASSERT(scavenging_);
uword result = *reinterpret_cast<uword*>(end_);
end_ += sizeof(result);
+ Isolate::Current()->mutator_thread()->set_end_offset(end_);
ASSERT(end_ <= to_->end());
return result;
}
@@ -295,6 +304,8 @@ class Scavenger {
// The total size of external data associated with objects in this scavenger.
intptr_t external_size_;
+ Mutex* space_lock_;
+
friend class ScavengerVisitor;
friend class ScavengerWeakVisitor;

Powered by Google App Engine
This is Rietveld 408576698