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

Unified Diff: runtime/vm/scavenger.h

Issue 2992343002: Attempts to fix bugs introduced in 8b6fcf50e85d. (Closed)
Patch Set: Removes UnflushTLS() and renames FlushTLS to something appropriate 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.h
diff --git a/runtime/vm/scavenger.h b/runtime/vm/scavenger.h
index 1fd7c9fe2bd88b93e8f26e2c6b7964e11a0408bc..de6d01f9712af815797e8981b5dcaafbe9e38277 100644
--- a/runtime/vm/scavenger.h
+++ b/runtime/vm/scavenger.h
@@ -121,6 +121,25 @@ class Scavenger {
RawObject* FindObject(FindObjectVisitor* visitor) const;
+ uword TryAllocateNewTLAB(Thread* thread, intptr_t size) {
+ ASSERT(Utils::IsAligned(size, kObjectAlignment));
+ ASSERT(heap_ != Dart::vm_isolate()->heap());
+ ASSERT(!scavenging_);
+ uword result = top_;
+ intptr_t remaining = end_ - top_;
+ if (remaining < size) {
+ return 0;
+ }
+ ASSERT(to_->Contains(result));
+ ASSERT((result & kObjectAlignmentMask) == object_alignment_);
+ top_ += size;
+ ASSERT(to_->Contains(top_) || (top_ == to_->end()));
+ ASSERT(result < top_);
+ thread->set_top(result);
+ thread->set_end(top_);
+ return result;
+ }
+
uword AllocateGC(intptr_t size) {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
ASSERT(heap_ != Dart::vm_isolate()->heap());
@@ -134,7 +153,7 @@ class Scavenger {
ASSERT(to_->Contains(result));
ASSERT((result & kObjectAlignmentMask) == object_alignment_);
top_ += size;
- ASSERT(to_->Contains(top_) || (top_ == to_->end()));
+ ASSERT((to_->Contains(top_)) || (top_ == to_->end()));
return result;
}
@@ -143,6 +162,8 @@ class Scavenger {
ASSERT(heap_ != Dart::vm_isolate()->heap());
ASSERT(thread->IsMutatorThread());
ASSERT(thread->isolate()->IsMutatorThreadScheduled());
+ ASSERT(thread->top() <= top_);
+ ASSERT((thread->end() == 0) || (thread->end() == top_));
#if defined(DEBUG)
if (FLAG_gc_at_alloc) {
ASSERT(!scavenging_);
@@ -159,7 +180,7 @@ class Scavenger {
ASSERT(to_->Contains(result));
ASSERT((result & kObjectAlignmentMask) == object_alignment_);
top += size;
- ASSERT(to_->Contains(top) || (top == to_->end()));
+ ASSERT((to_->Contains(top)) || (top == to_->end()));
thread->set_top(top);
return result;
}
@@ -180,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 {
@@ -215,7 +234,8 @@ class Scavenger {
void AllocateExternal(intptr_t size);
void FreeExternal(intptr_t size);
- void FlushTLS() const;
+ void MakeNewSpaceIterable() const;
+ uword FirstObjectStart() const { return to_->start() | object_alignment_; }
private:
// Ids for time and data records in Heap::GCStats.
@@ -234,7 +254,6 @@ 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);
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698