Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 12c9753bfa4b943e3013c9628f07ce8a239f1f8d..1d8a8258d4bd5ef4921183c0ff7676ff410763ae 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1307,6 +1307,7 @@ char* Isolate::RestoreThread(char* from) { |
if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
RuntimeProfiler::IsolateEnteredJS(this); |
} |
+ ASSERT(context() == NULL || context()->IsContext()); |
#endif |
return from + sizeof(ThreadLocalTop); |
} |
@@ -1350,6 +1351,16 @@ void Isolate::ThreadDataTable::Remove(Isolate* isolate, |
} |
+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 { \ |
@@ -1464,6 +1475,10 @@ void Isolate::TearDown() { |
Deinit(); |
+ { ScopedLock lock(process_wide_mutex_); |
+ thread_data_table_->RemoveAllThreads(this); |
+ } |
+ |
if (!IsDefaultIsolate()) { |
delete this; |
} |