Reviewers: Benedikt Meurer,

Description:
Some thread data simplifications.

Please review this at https://codereview.chromium.org/24036002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+3, -29 lines):
  M src/isolate.h
  M src/isolate.cc


Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 17762b2b0bf9b163cf405531ef97773e53e0495e..d87fd87af5aa1cf9a0383a7365d63d3998afce47 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -347,20 +347,6 @@ RecursiveMutex Isolate::process_wide_mutex_;
 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL;
 Atomic32 Isolate::isolate_counter_ = 0;

-Isolate::PerIsolateThreadData* Isolate::AllocatePerIsolateThreadData(
-    ThreadId thread_id) {
-  ASSERT(!thread_id.Equals(ThreadId::Invalid()));
- PerIsolateThreadData* per_thread = new PerIsolateThreadData(this, thread_id);
-  {
-    LockGuard<RecursiveMutex> lock_guard(&process_wide_mutex_);
-    ASSERT(thread_data_table_->Lookup(this, thread_id) == NULL);
-    thread_data_table_->Insert(per_thread);
-    ASSERT(thread_data_table_->Lookup(this, thread_id) == per_thread);
-  }
-  return per_thread;
-}
-
-
 Isolate::PerIsolateThreadData*
     Isolate::FindOrAllocatePerThreadDataForThisThread() {
   ThreadId thread_id = ThreadId::Current();
@@ -369,9 +355,11 @@ Isolate::PerIsolateThreadData*
     LockGuard<RecursiveMutex> lock_guard(&process_wide_mutex_);
     per_thread = thread_data_table_->Lookup(this, thread_id);
     if (per_thread == NULL) {
-      per_thread = AllocatePerIsolateThreadData(thread_id);
+      per_thread = new PerIsolateThreadData(this, thread_id);
+      thread_data_table_->Insert(per_thread);
     }
   }
+  ASSERT(thread_data_table_->Lookup(this, thread_id) == per_thread);
   return per_thread;
 }

@@ -1717,15 +1705,6 @@ void Isolate::ThreadDataTable::Remove(PerIsolateThreadData* data) {
 }


-void Isolate::ThreadDataTable::Remove(Isolate* isolate,
-                                      ThreadId thread_id) {
-  PerIsolateThreadData* data = Lookup(isolate, thread_id);
-  if (data != NULL) {
-    Remove(data);
-  }
-}
-
-
 void Isolate::ThreadDataTable::RemoveAllThreads(Isolate* isolate) {
   PerIsolateThreadData* data = list_;
   while (data != NULL) {
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 741c4c02ffb17cf409f16a4067e3fd560bc5e2b2..ca070800fcd3bd8816024ee59fae9605cbe9f0a0 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -1155,7 +1155,6 @@ class Isolate {

     PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id);
     void Insert(PerIsolateThreadData* data);
-    void Remove(Isolate* isolate, ThreadId thread_id);
     void Remove(PerIsolateThreadData* data);
     void RemoveAllThreads(Isolate* isolate);

@@ -1206,10 +1205,6 @@ class Isolate {
   static void SetIsolateThreadLocals(Isolate* isolate,
                                      PerIsolateThreadData* data);

-  // Allocate and insert PerIsolateThreadData into the ThreadDataTable
-  // (regardless of whether such data already exists).
-  PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id);
-
   // Find the PerThread for this particular (isolate, thread) combination.
   // If one does not yet exist, allocate a new one.
   PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to