| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/isolate.h" | 6 #include "vm/isolate.h" |
| 7 #include "vm/lockers.h" | 7 #include "vm/lockers.h" |
| 8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 #include "vm/profiler.h" | 9 #include "vm/profiler.h" |
| 10 #include "vm/thread_pool.h" | 10 #include "vm/thread_pool.h" |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 563 |
| 564 | 564 |
| 565 TEST_CASE(HelperAllocAndGC) { | 565 TEST_CASE(HelperAllocAndGC) { |
| 566 Monitor done_monitor; | 566 Monitor done_monitor; |
| 567 bool done = false; | 567 bool done = false; |
| 568 Isolate* isolate = Thread::Current()->isolate(); | 568 Isolate* isolate = Thread::Current()->isolate(); |
| 569 // Flush store buffers, etc. | 569 // Flush store buffers, etc. |
| 570 // TODO(koda): Currently, the GC only does this for the current thread, (i.e, | 570 // TODO(koda): Currently, the GC only does this for the current thread, (i.e, |
| 571 // the helper, in this test), but it should be done for all *threads* | 571 // the helper, in this test), but it should be done for all *threads* |
| 572 // while reaching a safepoint. | 572 // while reaching a safepoint. |
| 573 Thread::PrepareForGC(); | 573 isolate->thread_registry()->PrepareForGC(); |
| 574 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); | 574 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); |
| 575 { | 575 { |
| 576 while (true) { | 576 while (true) { |
| 577 isolate->thread_registry()->CheckSafepoint(); | 577 isolate->thread_registry()->CheckSafepoint(); |
| 578 MonitorLocker ml(&done_monitor); | 578 MonitorLocker ml(&done_monitor); |
| 579 if (done) { | 579 if (done) { |
| 580 break; | 580 break; |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace dart | 586 } // namespace dart |
| OLD | NEW |