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

Unified Diff: runtime/vm/thread.cc

Issue 1533023002: - Make sure to prepare all threads for GC. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index db6f42e20438db6f2820330a6119baddf98e748a..134b7595bf2f07a06c696f1c8a20cd1ab979e901 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -236,16 +236,14 @@ void Thread::ExitIsolateAsHelper(bool bypass_safepoint) {
}
-// TODO(koda): Make non-static and invoke in SafepointThreads.
void Thread::PrepareForGC() {
- Thread* thread = Thread::Current();
- // Prevent scheduling another GC.
- thread->StoreBufferRelease(StoreBuffer::kIgnoreThreshold);
+ ASSERT(isolate()->thread_registry()->AtSafepoint());
+ // Prevent scheduling another GC by ignoring the threshold.
+ StoreBufferRelease(StoreBuffer::kIgnoreThreshold);
// Make sure to get an *empty* block; the isolate needs all entries
// at GC time.
// TODO(koda): Replace with an epilogue (PrepareAfterGC) that acquires.
- thread->store_buffer_block_ =
- thread->isolate()->store_buffer()->PopEmptyBlock();
+ store_buffer_block_ = isolate()->store_buffer()->PopEmptyBlock();
}
@@ -274,7 +272,7 @@ void Thread::StoreBufferAddObjectGC(RawObject* obj) {
void Thread::StoreBufferRelease(StoreBuffer::ThresholdPolicy policy) {
StoreBufferBlock* block = store_buffer_block_;
store_buffer_block_ = NULL;
- isolate_->store_buffer()->PushBlock(block, policy);
+ isolate()->store_buffer()->PushBlock(block, policy);
}
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698