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

Unified Diff: runtime/vm/heap.cc

Issue 1541073002: Implement safepointing of threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 4 years, 11 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/heap.cc
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index 71109eeaee5589d5d9766799c6c94baa84fd627f..f6c35eee2c2040e83a4f4526ca6c90e856151b37 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -97,11 +97,12 @@ uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) {
}
// If we are in the process of running a sweep wait for the sweeper to free
zra 2016/01/08 23:32:07 sweep, wait
siva 2016/01/12 21:26:22 Done.
// memory.
+ Thread* thread = Thread::Current();
{
MonitorLocker ml(old_space_.tasks_lock());
addr = old_space_.TryAllocate(size, type);
while ((addr == 0) && (old_space_.tasks() > 0)) {
- ml.Wait();
+ ml.WaitWithSafepointCheck(thread);
addr = old_space_.TryAllocate(size, type);
}
}
@@ -119,7 +120,7 @@ uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) {
MonitorLocker ml(old_space_.tasks_lock());
addr = old_space_.TryAllocate(size, type);
while ((addr == 0) && (old_space_.tasks() > 0)) {
- ml.Wait();
+ ml.WaitWithSafepointCheck(thread);
addr = old_space_.TryAllocate(size, type);
}
}
@@ -136,7 +137,7 @@ uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) {
{
MonitorLocker ml(old_space_.tasks_lock());
while (old_space_.tasks() > 0) {
- ml.Wait();
+ ml.WaitWithSafepointCheck(thread);
}
}
addr = old_space_.TryAllocate(size, type, PageSpace::kForceGrowth);

Powered by Google App Engine
This is Rietveld 408576698