Chromium Code Reviews| Index: runtime/vm/thread.cc |
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc |
| index 79919d4f9313ef0ea163a25b0b2071e588629fe4..909342f22f75d1f2f9aa73f10b71a446dc73c30e 100644 |
| --- a/runtime/vm/thread.cc |
| +++ b/runtime/vm/thread.cc |
| @@ -72,6 +72,8 @@ void Thread::EnterIsolate(Isolate* isolate) { |
| Profiler::BeginExecution(isolate); |
| isolate->set_thread_state(thread_state); |
| isolate->set_vm_tag(VMTag::kVMTagId); |
| + ASSERT(thread->store_buffer_block_ == NULL); |
| + thread->store_buffer_block_ = isolate->store_buffer()->PopPartialOrEmpty(); |
|
Ivan Posva
2015/06/08 13:05:21
Looking at this use here I am revising my suggesti
koda
2015/06/09 13:10:30
Done.
|
| } |
| @@ -80,6 +82,8 @@ void Thread::ExitIsolate() { |
| // TODO(koda): Audit callers; they should know whether they're in an isolate. |
| if (thread == NULL || thread->isolate() == NULL) return; |
| Isolate* isolate = thread->isolate(); |
| + isolate->store_buffer()->Push(thread->store_buffer_block_); |
| + thread->store_buffer_block_ = NULL; |
| if (isolate->is_runnable()) { |
| isolate->set_vm_tag(VMTag::kIdleTagId); |
| } else { |
| @@ -106,6 +110,9 @@ 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->isolate_ = NULL; |
| @@ -113,6 +120,37 @@ void Thread::ExitIsolateAsHelper() { |
| } |
| +void Thread::PrepareForGC() { |
| + Thread* thread = Thread::Current(); |
| + StoreBuffer* sb = thread->isolate()->store_buffer(); |
| + sb->Push(thread->store_buffer_block_, false); |
|
Ivan Posva
2015/06/08 13:05:21
Please explain in a comment why you are passing fa
koda
2015/06/09 13:10:30
Done.
|
| + thread->store_buffer_block_ = sb->PopEmpty(); |
| +} |
| + |
| + |
| +void Thread::StoreBufferBlockProcess(bool check_threshold) { |
| + StoreBuffer* sb = isolate()->store_buffer(); |
| + sb->Push(store_buffer_block_, check_threshold); |
|
Ivan Posva
2015/06/08 13:05:21
The fact that we still have a reference to the Sto
koda
2015/06/09 13:10:30
Done.
|
| + store_buffer_block_ = sb->PopPartialOrEmpty(); |
| +} |
| + |
| + |
| +void Thread::StoreBufferAddObject(RawObject* obj) { |
| + store_buffer_block_->Add(obj); |
| + if (store_buffer_block_->IsFull()) { |
| + StoreBufferBlockProcess(true); |
| + } |
| +} |
| + |
| + |
| +void Thread::StoreBufferAddObjectGC(RawObject* obj) { |
| + store_buffer_block_->Add(obj); |
| + if (store_buffer_block_->IsFull()) { |
| + StoreBufferBlockProcess(false); |
| + } |
| +} |
| + |
| + |
| CHA* Thread::cha() const { |
| ASSERT(isolate_ != NULL); |
| return isolate_->cha_; |