| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 Monitor done_monitor; | 491 Monitor done_monitor; |
| 492 bool done = false; | 492 bool done = false; |
| 493 Isolate* isolate = Thread::Current()->isolate(); | 493 Isolate* isolate = Thread::Current()->isolate(); |
| 494 // Flush store buffers, etc. | 494 // Flush store buffers, etc. |
| 495 // TODO(koda): Currently, the GC only does this for the current thread, (i.e, | 495 // TODO(koda): Currently, the GC only does this for the current thread, (i.e, |
| 496 // the helper, in this test), but it should be done for all *threads* | 496 // the helper, in this test), but it should be done for all *threads* |
| 497 // while reaching a safepoint. | 497 // while reaching a safepoint. |
| 498 Thread::PrepareForGC(); | 498 Thread::PrepareForGC(); |
| 499 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); | 499 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); |
| 500 { | 500 { |
| 501 // Manually wait. | 501 while (true) { |
| 502 // TODO(koda): Replace with execution of Dart and/or VM code when GC | 502 isolate->thread_registry()->CheckSafepoint(); |
| 503 // actually safepoints everything. | 503 MonitorLocker ml(&done_monitor); |
| 504 MonitorLocker ml(&done_monitor); | 504 if (done) { |
| 505 while (!done) { | 505 break; |
| 506 ml.Wait(); | 506 } |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 } // namespace dart | 511 } // namespace dart |
| OLD | NEW |