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

Unified Diff: runtime/vm/heap.cc

Issue 2980033002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: Created 3 years, 5 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/heap.h ('k') | runtime/vm/intrinsifier_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap.cc
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index 9d741133bed6c7389dc7f13d93589601162f4115..334e90364f5d6e16e70ef2a084ad47a76d0a5d78 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -61,13 +61,14 @@ uword Heap::AllocateNew(intptr_t size) {
ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0);
// Currently, only the Dart thread may allocate in new space.
isolate()->AssertCurrentThreadIsMutator();
- uword addr = new_space_.TryAllocate(size);
+ Thread* thread = Thread::Current();
+ uword addr = new_space_.TryAllocateInTLAB(thread, size);
if (addr == 0) {
// This call to CollectGarbage might end up "reusing" a collection spawned
// from a different thread and will be racing to allocate the requested
// memory with other threads being released after the collection.
CollectGarbage(kNew);
- addr = new_space_.TryAllocate(size);
+ addr = new_space_.TryAllocateInTLAB(thread, size);
if (addr == 0) {
return AllocateOld(size, HeapPage::kData);
}
@@ -470,24 +471,6 @@ void Heap::WriteProtect(bool read_only) {
old_space_.WriteProtect(read_only);
}
-intptr_t Heap::TopOffset(Heap::Space space) {
- if (space == kNew) {
- return OFFSET_OF(Heap, new_space_) + Scavenger::top_offset();
- } else {
- ASSERT(space == kOld);
- return OFFSET_OF(Heap, old_space_) + PageSpace::top_offset();
- }
-}
-
-intptr_t Heap::EndOffset(Heap::Space space) {
- if (space == kNew) {
- return OFFSET_OF(Heap, new_space_) + Scavenger::end_offset();
- } else {
- ASSERT(space == kOld);
- return OFFSET_OF(Heap, old_space_) + PageSpace::end_offset();
- }
-}
-
void Heap::Init(Isolate* isolate,
intptr_t max_new_gen_words,
intptr_t max_old_gen_words,
@@ -561,6 +544,10 @@ bool Heap::Verify(MarkExpectation mark_expectation) const {
bool Heap::VerifyGC(MarkExpectation mark_expectation) const {
StackZone stack_zone(Thread::Current());
+
+ // Change the new space's top_ with the more up-to-date thread's view of top_
+ new_space_.FlushTLS();
+
ObjectSet* allocated_set =
CreateAllocatedObjectSet(stack_zone.GetZone(), mark_expectation);
VerifyPointersVisitor visitor(isolate(), allocated_set);
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/intrinsifier_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698