Index: runtime/vm/thread.cc |
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc |
index 3b3eb3308d30b292147168449f670ba1f62033f5..82590ecb2c7dcda89478c036bb7c3fab14b45459 100644 |
--- a/runtime/vm/thread.cc |
+++ b/runtime/vm/thread.cc |
@@ -153,9 +153,8 @@ void Thread::ExitIsolate() { |
Profiler::EndExecution(isolate); |
thread->set_thread_state(NULL); |
thread->Unschedule(); |
- StoreBufferBlock* block = thread->store_buffer_block_; |
- thread->store_buffer_block_ = NULL; |
- isolate->store_buffer()->PushBlock(block); |
+ // TODO(koda): Move store_buffer_block_ into State. |
+ thread->StoreBufferFlush(); |
if (isolate->is_runnable()) { |
isolate->set_vm_tag(VMTag::kIdleTagId); |
} else { |
@@ -173,6 +172,8 @@ void Thread::EnterIsolateAsHelper(Isolate* isolate) { |
ASSERT(thread != NULL); |
ASSERT(thread->isolate() == NULL); |
thread->isolate_ = isolate; |
+ ASSERT(thread->store_buffer_block_ == NULL); |
+ thread->store_buffer_block_ = isolate->store_buffer()->PopNonFullBlock(); |
ASSERT(isolate->heap() != NULL); |
thread->heap_ = isolate->heap(); |
ASSERT(thread->thread_state() == NULL); |
@@ -185,12 +186,11 @@ void Thread::EnterIsolateAsHelper(Isolate* isolate) { |
void Thread::ExitIsolateAsHelper() { |
Thread* thread = Thread::Current(); |
- // If the helper thread chose to use the store buffer, check that it has |
- // already been flushed manually. |
- ASSERT(thread->store_buffer_block_ == NULL); |
Isolate* isolate = thread->isolate(); |
ASSERT(isolate != NULL); |
thread->Unschedule(); |
+ // TODO(koda): Move store_buffer_block_ into State. |
+ thread->StoreBufferFlush(); |
thread->set_thread_state(NULL); |
thread->isolate_ = NULL; |
thread->heap_ = NULL; |
@@ -200,21 +200,16 @@ void Thread::ExitIsolateAsHelper() { |
void Thread::PrepareForGC() { |
Thread* thread = Thread::Current(); |
- StoreBuffer* sb = thread->isolate()->store_buffer(); |
- StoreBufferBlock* block = thread->store_buffer_block_; |
- thread->store_buffer_block_ = NULL; |
const bool kCheckThreshold = false; // Prevent scheduling another GC. |
Ivan Posva
2015/08/14 22:15:29
Name is reverse from its meaning. Should be kDoNot
koda
2015/08/17 15:51:07
Done.
|
- sb->PushBlock(block, kCheckThreshold); |
- thread->store_buffer_block_ = sb->PopEmptyBlock(); |
+ thread->StoreBufferFlush(kCheckThreshold); |
+ thread->store_buffer_block_ = |
+ thread->isolate()->store_buffer()->PopEmptyBlock(); |
} |
void Thread::StoreBufferBlockProcess(bool check_threshold) { |
- StoreBuffer* sb = isolate()->store_buffer(); |
- StoreBufferBlock* block = store_buffer_block_; |
- store_buffer_block_ = NULL; |
- sb->PushBlock(block, check_threshold); |
- store_buffer_block_ = sb->PopNonFullBlock(); |
+ StoreBufferFlush(check_threshold); |
+ store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock(); |
} |
@@ -234,6 +229,13 @@ void Thread::StoreBufferAddObjectGC(RawObject* obj) { |
} |
+void Thread::StoreBufferFlush(bool check_threshold) { |
Ivan Posva
2015/08/14 22:15:29
Unused parameter "check_threshold".
How about Sto
koda
2015/08/17 15:51:07
Done.
|
+ StoreBufferBlock* block = store_buffer_block_; |
+ store_buffer_block_ = NULL; |
+ isolate_->store_buffer()->PushBlock(block); |
+} |
+ |
+ |
CHA* Thread::cha() const { |
ASSERT(isolate_ != NULL); |
return isolate_->cha_; |