| Index: src/isolate.cc
|
| ===================================================================
|
| --- src/isolate.cc (revision 8618)
|
| +++ src/isolate.cc (working copy)
|
| @@ -190,8 +190,8 @@
|
|
|
|
|
| private:
|
| - explicit PreallocatedMemoryThread(Isolate* isolate)
|
| - : Thread(isolate, "v8:PreallocMem"),
|
| + PreallocatedMemoryThread()
|
| + : Thread("v8:PreallocMem"),
|
| keep_running_(true),
|
| wait_for_ever_semaphore_(OS::CreateSemaphore(0)),
|
| data_ready_semaphore_(OS::CreateSemaphore(0)),
|
| @@ -219,7 +219,7 @@
|
|
|
| void Isolate::PreallocatedMemoryThreadStart() {
|
| if (preallocated_memory_thread_ != NULL) return;
|
| - preallocated_memory_thread_ = new PreallocatedMemoryThread(this);
|
| + preallocated_memory_thread_ = new PreallocatedMemoryThread();
|
| preallocated_memory_thread_->Start();
|
| }
|
|
|
| @@ -1279,9 +1279,11 @@
|
|
|
|
|
| char* Isolate::ArchiveThread(char* to) {
|
| +#ifdef ENABLE_LOGGING_AND_PROFILING
|
| if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) {
|
| RuntimeProfiler::IsolateExitedJS(this);
|
| }
|
| +#endif
|
| memcpy(to, reinterpret_cast<char*>(thread_local_top()),
|
| sizeof(ThreadLocalTop));
|
| InitializeThreadLocal();
|
| @@ -1301,9 +1303,12 @@
|
| thread_local_top()->simulator_ = Simulator::current(this);
|
| #endif
|
| #endif
|
| +#ifdef ENABLE_LOGGING_AND_PROFILING
|
| if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) {
|
| RuntimeProfiler::IsolateEnteredJS(this);
|
| }
|
| + ASSERT(context() == NULL || context()->IsContext());
|
| +#endif
|
| return from + sizeof(ThreadLocalTop);
|
| }
|
|
|
| @@ -1346,6 +1351,16 @@
|
| }
|
|
|
|
|
| +void Isolate::ThreadDataTable::RemoveAllThreads(Isolate* isolate) {
|
| + PerIsolateThreadData* data = list_;
|
| + while (data != NULL) {
|
| + PerIsolateThreadData* next = data->next_;
|
| + if (data->isolate() == isolate) Remove(data);
|
| + data = next;
|
| + }
|
| +}
|
| +
|
| +
|
| #ifdef DEBUG
|
| #define TRACE_ISOLATE(tag) \
|
| do { \
|
| @@ -1396,8 +1411,6 @@
|
| ast_sentinels_(NULL),
|
| string_tracker_(NULL),
|
| regexp_stack_(NULL),
|
| - frame_element_constant_list_(0),
|
| - result_constant_list_(0),
|
| embedder_data_(NULL) {
|
| TRACE_ISOLATE(constructor);
|
|
|
| @@ -1432,10 +1445,6 @@
|
| debugger_ = NULL;
|
| #endif
|
|
|
| -#ifdef ENABLE_LOGGING_AND_PROFILING
|
| - producer_heap_profile_ = NULL;
|
| -#endif
|
| -
|
| handle_scope_data_.Initialize();
|
|
|
| #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \
|
| @@ -1462,6 +1471,10 @@
|
|
|
| Deinit();
|
|
|
| + { ScopedLock lock(process_wide_mutex_);
|
| + thread_data_table_->RemoveAllThreads(this);
|
| + }
|
| +
|
| if (!IsDefaultIsolate()) {
|
| delete this;
|
| }
|
| @@ -1520,11 +1533,6 @@
|
| Isolate::~Isolate() {
|
| TRACE_ISOLATE(destructor);
|
|
|
| -#ifdef ENABLE_LOGGING_AND_PROFILING
|
| - delete producer_heap_profile_;
|
| - producer_heap_profile_ = NULL;
|
| -#endif
|
| -
|
| delete unicode_cache_;
|
| unicode_cache_ = NULL;
|
|
|
| @@ -1600,8 +1608,7 @@
|
| ASSERT(Isolate::Current() == this);
|
| #ifdef ENABLE_DEBUGGER_SUPPORT
|
| debug_ = new Debug(this);
|
| - debugger_ = new Debugger();
|
| - debugger_->isolate_ = this;
|
| + debugger_ = new Debugger(this);
|
| #endif
|
|
|
| memory_allocator_ = new MemoryAllocator();
|
| @@ -1641,11 +1648,6 @@
|
| regexp_stack_ = new RegExpStack();
|
| regexp_stack_->isolate_ = this;
|
|
|
| -#ifdef ENABLE_LOGGING_AND_PROFILING
|
| - producer_heap_profile_ = new ProducerHeapProfile();
|
| - producer_heap_profile_->isolate_ = this;
|
| -#endif
|
| -
|
| state_ = PREINITIALIZED;
|
| return true;
|
| }
|
| @@ -1735,11 +1737,11 @@
|
| return false;
|
| }
|
|
|
| + InitializeThreadLocal();
|
| +
|
| bootstrapper_->Initialize(create_heap_objects);
|
| builtins_.Setup(create_heap_objects);
|
|
|
| - InitializeThreadLocal();
|
| -
|
| // Only preallocate on the first initialization.
|
| if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) {
|
| // Start the thread which will set aside some memory.
|
| @@ -1859,11 +1861,6 @@
|
| }
|
|
|
|
|
| -void Isolate::ResetEagerOptimizingData() {
|
| - compilation_cache_->ResetEagerOptimizingData();
|
| -}
|
| -
|
| -
|
| #ifdef DEBUG
|
| #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
|
| const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
|
|
|