| Index: runtime/vm/thread.cc
|
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
|
| index ba6db93eacd7aeb166d49bbcbba0c59c8719d911..27031776ecedf0de1483151aa3dbb60b47bc2a6f 100644
|
| --- a/runtime/vm/thread.cc
|
| +++ b/runtime/vm/thread.cc
|
| @@ -5,8 +5,10 @@
|
| #include "vm/thread.h"
|
|
|
| #include "vm/isolate.h"
|
| +#include "vm/object.h"
|
| #include "vm/os_thread.h"
|
| #include "vm/profiler.h"
|
| +#include "vm/stub_code.h"
|
| #include "vm/thread_interrupter.h"
|
|
|
|
|
| @@ -23,10 +25,21 @@ static void DeleteThread(void* thread) {
|
| }
|
|
|
|
|
| -void Thread::InitOnce() {
|
| +void Thread::InitOnceBeforeIsolate() {
|
| ASSERT(thread_key_ == OSThread::kUnsetThreadLocalKey);
|
| thread_key_ = OSThread::CreateThreadLocal(DeleteThread);
|
| ASSERT(thread_key_ != OSThread::kUnsetThreadLocalKey);
|
| + ASSERT(Thread::Current() == NULL);
|
| + // Postpone initialization of VM constants for this first thread.
|
| + SetCurrent(new Thread(false));
|
| +}
|
| +
|
| +
|
| +void Thread::InitOnceAfterObjectAndStubCode() {
|
| + Thread* thread = Thread::Current();
|
| + ASSERT(thread != NULL);
|
| + ASSERT(thread->isolate() == Dart::vm_isolate());
|
| + thread->InitVMConstants();
|
| }
|
|
|
|
|
| @@ -53,6 +66,31 @@ void Thread::CleanUp() {
|
| #endif
|
|
|
|
|
| +Thread::Thread(bool init_vm_constants)
|
| + : isolate_(NULL),
|
| + store_buffer_block_(NULL),
|
| + object_null_(NULL),
|
| + bool_true_(NULL),
|
| + bool_false_(NULL),
|
| + update_store_buffer_entry_point_(0) {
|
| + if (init_vm_constants) {
|
| + InitVMConstants();
|
| + }
|
| +}
|
| +
|
| +
|
| +void Thread::InitVMConstants() {
|
| + ASSERT(object_null_ == NULL);
|
| + object_null_ = Object::null();
|
| + ASSERT(bool_true_ == NULL);
|
| + bool_true_ = Object::bool_true().raw();
|
| + ASSERT(bool_false_ == NULL);
|
| + bool_false_ = Object::bool_false().raw();
|
| + ASSERT(update_store_buffer_entry_point_ == 0);
|
| + update_store_buffer_entry_point_ = StubCode::UpdateStoreBufferEntryPoint();
|
| +}
|
| +
|
| +
|
| void Thread::EnterIsolate(Isolate* isolate) {
|
| Thread* thread = Thread::Current();
|
| ASSERT(thread != NULL);
|
|
|