| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/thread.h" | 5 #include "vm/thread.h" |
| 6 | 6 |
| 7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 InterruptableThreadState* thread_state = | 132 InterruptableThreadState* thread_state = |
| 133 ThreadInterrupter::GetCurrentThreadState(); | 133 ThreadInterrupter::GetCurrentThreadState(); |
| 134 #if defined(DEBUG) | 134 #if defined(DEBUG) |
| 135 Isolate::CheckForDuplicateThreadState(thread_state); | 135 Isolate::CheckForDuplicateThreadState(thread_state); |
| 136 #endif | 136 #endif |
| 137 ASSERT(thread_state != NULL); | 137 ASSERT(thread_state != NULL); |
| 138 Profiler::BeginExecution(isolate); | 138 Profiler::BeginExecution(isolate); |
| 139 isolate->set_thread_state(thread_state); | 139 isolate->set_thread_state(thread_state); |
| 140 isolate->set_vm_tag(VMTag::kVMTagId); | 140 isolate->set_vm_tag(VMTag::kVMTagId); |
| 141 ASSERT(thread->store_buffer_block_ == NULL); | 141 ASSERT(thread->store_buffer_block_ == NULL); |
| 142 thread->store_buffer_block_ = isolate->store_buffer()->PopBlock(); | 142 thread->store_buffer_block_ = isolate->store_buffer()->PopNonFullBlock(); |
| 143 ASSERT(isolate->heap() != NULL); | 143 ASSERT(isolate->heap() != NULL); |
| 144 thread->heap_ = isolate->heap(); | 144 thread->heap_ = isolate->heap(); |
| 145 thread->Schedule(isolate); | 145 thread->Schedule(isolate); |
| 146 } | 146 } |
| 147 | 147 |
| 148 | 148 |
| 149 void Thread::ExitIsolate() { | 149 void Thread::ExitIsolate() { |
| 150 Thread* thread = Thread::Current(); | 150 Thread* thread = Thread::Current(); |
| 151 // TODO(koda): Audit callers; they should know whether they're in an isolate. | 151 // TODO(koda): Audit callers; they should know whether they're in an isolate. |
| 152 if (thread == NULL || thread->isolate() == NULL) return; | 152 if (thread == NULL || thread->isolate() == NULL) return; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 sb->PushBlock(block, kCheckThreshold); | 206 sb->PushBlock(block, kCheckThreshold); |
| 207 thread->store_buffer_block_ = sb->PopEmptyBlock(); | 207 thread->store_buffer_block_ = sb->PopEmptyBlock(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 void Thread::StoreBufferBlockProcess(bool check_threshold) { | 211 void Thread::StoreBufferBlockProcess(bool check_threshold) { |
| 212 StoreBuffer* sb = isolate()->store_buffer(); | 212 StoreBuffer* sb = isolate()->store_buffer(); |
| 213 StoreBufferBlock* block = store_buffer_block_; | 213 StoreBufferBlock* block = store_buffer_block_; |
| 214 store_buffer_block_ = NULL; | 214 store_buffer_block_ = NULL; |
| 215 sb->PushBlock(block, check_threshold); | 215 sb->PushBlock(block, check_threshold); |
| 216 store_buffer_block_ = sb->PopBlock(); | 216 store_buffer_block_ = sb->PopNonFullBlock(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 void Thread::StoreBufferAddObject(RawObject* obj) { | 220 void Thread::StoreBufferAddObject(RawObject* obj) { |
| 221 store_buffer_block_->Push(obj); | 221 store_buffer_block_->Push(obj); |
| 222 if (store_buffer_block_->IsFull()) { | 222 if (store_buffer_block_->IsFull()) { |
| 223 StoreBufferBlockProcess(true); | 223 StoreBufferBlockProcess(true); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ | 258 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
| 259 ASSERT((expr)->IsVMHeapObject()); \ | 259 ASSERT((expr)->IsVMHeapObject()); \ |
| 260 if (object.raw() == expr) return Thread::member_name##offset(); | 260 if (object.raw() == expr) return Thread::member_name##offset(); |
| 261 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) | 261 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
| 262 #undef COMPUTE_OFFSET | 262 #undef COMPUTE_OFFSET |
| 263 UNREACHABLE(); | 263 UNREACHABLE(); |
| 264 return -1; | 264 return -1; |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace dart | 267 } // namespace dart |
| OLD | NEW |