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

Unified Diff: runtime/vm/scavenger.h

Issue 2992753002: Prepares allocation for proper sync with mutator and bg threads. (Closed)
Patch Set: Adds locking when creating new TLABs 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
Index: runtime/vm/scavenger.h
diff --git a/runtime/vm/scavenger.h b/runtime/vm/scavenger.h
index de6d01f9712af815797e8981b5dcaafbe9e38277..b368408e0d04f048f780baeae4985557f67f8809 100644
--- a/runtime/vm/scavenger.h
+++ b/runtime/vm/scavenger.h
@@ -10,6 +10,7 @@
#include "vm/dart.h"
#include "vm/flags.h"
#include "vm/globals.h"
+#include "vm/lockers.h"
#include "vm/raw_object.h"
#include "vm/ring_buffer.h"
#include "vm/spaces.h"
@@ -125,6 +126,7 @@ class Scavenger {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
ASSERT(heap_ != Dart::vm_isolate()->heap());
ASSERT(!scavenging_);
+ MutexLocker ml(space_lock_);
uword result = top_;
intptr_t remaining = end_ - top_;
if (remaining < size) {
@@ -235,7 +237,10 @@ class Scavenger {
void FreeExternal(intptr_t size);
void MakeNewSpaceIterable() const;
- uword FirstObjectStart() const { return to_->start() | object_alignment_; }
+ int64_t FreeSpaceInWords(Isolate* isolate) const;
+ void MakeAllTLABsIterable(Isolate* isolate) const;
+ void FlushTLS() const;
rmacnak 2017/08/10 18:37:07 There is no definition of FlushTLS.
danunez 2017/08/10 20:36:46 Removed this declaration.
+ void AbandonAllTLABs(Isolate* isolate);
private:
// Ids for time and data records in Heap::GCStats.
@@ -254,6 +259,7 @@ class Scavenger {
kToKBAfterStoreBuffer = 3
};
+ uword FirstObjectStart() const { return to_->start() | object_alignment_; }
SemiSpace* Prologue(Isolate* isolate, bool invoke_api_callbacks);
void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor);
void IterateObjectIdTable(Isolate* isolate, ScavengerVisitor* visitor);
@@ -333,6 +339,7 @@ class Scavenger {
bool failed_to_promote_;
+ Mutex* space_lock_;
rmacnak 2017/08/10 18:37:07 // Protects allocation of TLABs.
danunez 2017/08/10 20:36:46 Done.
friend class ScavengerVisitor;
friend class ScavengerWeakVisitor;

Powered by Google App Engine
This is Rietveld 408576698