| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 Isolate* isolate_; | 559 Isolate* isolate_; |
| 560 Monitor* done_monitor_; | 560 Monitor* done_monitor_; |
| 561 bool* done_; | 561 bool* done_; |
| 562 }; | 562 }; |
| 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. | |
| 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* | |
| 572 // while reaching a safepoint. | |
| 573 isolate->thread_registry()->PrepareForGC(); | |
| 574 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); | 569 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); |
| 575 { | 570 { |
| 576 while (true) { | 571 while (true) { |
| 577 isolate->thread_registry()->CheckSafepoint(); | 572 isolate->thread_registry()->CheckSafepoint(); |
| 578 MonitorLocker ml(&done_monitor); | 573 MonitorLocker ml(&done_monitor); |
| 579 if (done) { | 574 if (done) { |
| 580 break; | 575 break; |
| 581 } | 576 } |
| 582 } | 577 } |
| 583 } | 578 } |
| 584 } | 579 } |
| 585 | 580 |
| 586 } // namespace dart | 581 } // namespace dart |
| OLD | NEW |