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

Side by Side Diff: runtime/vm/thread_test.cc

Issue 1292353004: Safepointing in GC (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: More git cleanup. Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698