Chromium Code Reviews| Index: runtime/vm/heap.cc |
| diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc |
| index da9e6790dab711e48223c9b4c9528e6d4d02be9b..23a380b5f90a9c1415a487722e8b4e32319a40cb 100644 |
| --- a/runtime/vm/heap.cc |
| +++ b/runtime/vm/heap.cc |
| @@ -88,13 +88,13 @@ uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) { |
| Thread* thread = Thread::Current(); |
| if (thread->CanCollectGarbage()) { |
| { |
|
Vyacheslav Egorov (Google)
2016/12/31 11:09:48
this block of code is repeated twice - maybe make
siva
2017/01/05 19:06:10
Done.
|
| + // Wait for any GC tasks that are in progress. |
| MonitorLocker ml(old_space_.tasks_lock()); |
| - addr = old_space_.TryAllocate(size, type); |
| - while ((addr == 0) && (old_space_.tasks() > 0)) { |
| + while (old_space_.tasks() > 0) { |
| ml.WaitWithSafepointCheck(thread); |
| - addr = old_space_.TryAllocate(size, type); |
| } |
| } |
| + addr = old_space_.TryAllocate(size, type); |
| if (addr != 0) { |
| return addr; |
| } |
| @@ -107,12 +107,11 @@ uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) { |
| // Wait for all of the concurrent tasks to finish before giving up. |
| { |
| MonitorLocker ml(old_space_.tasks_lock()); |
| - addr = old_space_.TryAllocate(size, type); |
| - while ((addr == 0) && (old_space_.tasks() > 0)) { |
| + while (old_space_.tasks() > 0) { |
| ml.WaitWithSafepointCheck(thread); |
| - addr = old_space_.TryAllocate(size, type); |
| } |
| } |
| + addr = old_space_.TryAllocate(size, type); |
| if (addr != 0) { |
| return addr; |
| } |