Revision: 5104
Author: [email protected]
Date: Tue Jul 20 11:14:13 2010
Log: [Isolates] Patch to land http://codereview.chromium.org/3043007 by Maxim.Mossienko.

Review URL: http://codereview.chromium.org/3044013
http://code.google.com/p/v8/source/detail?r=5104

Modified:
 /branches/experimental/isolates/src/api.cc
 /branches/experimental/isolates/src/platform-freebsd.cc
 /branches/experimental/isolates/src/platform-nullos.cc
 /branches/experimental/isolates/src/platform-openbsd.cc
 /branches/experimental/isolates/src/platform-solaris.cc
 /branches/experimental/isolates/src/platform-win32.cc
 /branches/experimental/isolates/src/v8threads.cc
 /branches/experimental/isolates/src/v8threads.h
 /branches/experimental/isolates/test/cctest/test-platform-win32.cc

=======================================
--- /branches/experimental/isolates/src/api.cc  Fri Jul 16 10:48:57 2010
+++ /branches/experimental/isolates/src/api.cc  Tue Jul 20 11:14:13 2010
@@ -3953,13 +3953,13 @@
 }


-Isolate::Isolate* New() {
+Isolate* Isolate::New() {
   UNIMPLEMENTED();
   return NULL;
 }


-Isolate::Isolate* GetCurrent() {
+Isolate* Isolate::GetCurrent() {
   UNIMPLEMENTED();
   return NULL;
 }
=======================================
--- /branches/experimental/isolates/src/platform-freebsd.cc Mon May 31 21:48:19 2010 +++ /branches/experimental/isolates/src/platform-freebsd.cc Tue Jul 20 11:14:13 2010
@@ -404,7 +404,9 @@
 }


-Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
+Thread::Thread(Isolate* isolate)
+    : ThreadHandle(ThreadHandle::INVALID),
+      isolate_(isolate) {
 }


@@ -419,6 +421,7 @@
   // one) so we initialize it here too.
   thread->thread_handle_data()->thread_ = pthread_self();
   ASSERT(thread->IsValid());
+  Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
   thread->Run();
   return NULL;
 }
@@ -611,8 +614,11 @@
 };


-Sampler::Sampler(int interval, bool profiling)
-    : interval_(interval), profiling_(profiling), active_(false) {
+Sampler::Sampler(Isolate* isolate, int interval, bool profiling)
+    : isolate_(isolate),
+      interval_(interval),
+      profiling_(profiling),
+      active_(false) {
   data_ = new PlatformData();
 }

=======================================
--- /branches/experimental/isolates/src/platform-nullos.cc Fri Nov 13 04:32:57 2009 +++ /branches/experimental/isolates/src/platform-nullos.cc Tue Jul 20 11:14:13 2010
@@ -309,7 +309,9 @@
 }


-Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
+Thread::Thread(Isolate* isolate)
+    : ThreadHandle(ThreadHandle::INVALID),
+      isolate_(isolate) {
   UNIMPLEMENTED();
 }

=======================================
--- /branches/experimental/isolates/src/platform-openbsd.cc Thu Jul 15 20:09:25 2010 +++ /branches/experimental/isolates/src/platform-openbsd.cc Tue Jul 20 11:14:13 2010
@@ -380,7 +380,9 @@
 }


-Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
+Thread::Thread(Isolate* isolate)
+    : ThreadHandle(ThreadHandle::INVALID),
+      isolate_(isolate) {
 }


@@ -395,6 +397,7 @@
   // one) so we initialize it here too.
   thread->thread_handle_data()->thread_ = pthread_self();
   ASSERT(thread->IsValid());
+  Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
   thread->Run();
   return NULL;
 }
@@ -566,8 +569,11 @@
 };


-Sampler::Sampler(int interval, bool profiling)
-    : interval_(interval), profiling_(profiling), active_(false) {
+Sampler::Sampler(Isolate* isolate, int interval, bool profiling)
+    : isolate_(isolate),
+      interval_(interval),
+      profiling_(profiling),
+      active_(false) {
   data_ = new PlatformData();
 }

=======================================
--- /branches/experimental/isolates/src/platform-solaris.cc Mon May 31 21:48:19 2010 +++ /branches/experimental/isolates/src/platform-solaris.cc Tue Jul 20 11:14:13 2010
@@ -395,7 +395,9 @@
 }


-Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
+Thread::Thread(Isolate* isolate)
+    : ThreadHandle(ThreadHandle::INVALID),
+      isolate_(isolate) {
 }


@@ -410,6 +412,7 @@
   // one) so we initialize it here too.
   thread->thread_handle_data()->thread_ = pthread_self();
   ASSERT(thread->IsValid());
+  Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
   thread->Run();
   return NULL;
 }
@@ -597,8 +600,11 @@
 };


-Sampler::Sampler(int interval, bool profiling)
-    : interval_(interval), profiling_(profiling), active_(false) {
+Sampler::Sampler(Isolate* isolate, int interval, bool profiling)
+    : isolate_(isolate),
+      interval_(interval),
+      profiling_(profiling),
+      active_(false) {
   data_ = new PlatformData();
 }

=======================================
--- /branches/experimental/isolates/src/platform-win32.cc Thu Jul 1 14:55:46 2010 +++ /branches/experimental/isolates/src/platform-win32.cc Tue Jul 20 11:14:13 2010
@@ -1423,6 +1423,7 @@
   // don't know which thread will run first (the original thread or the new
   // one) so we initialize it here too.
   thread->thread_handle_data()->tid_ = GetCurrentThreadId();
+  Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
   thread->Run();
   return 0;
 }
@@ -1466,7 +1467,9 @@
 // Initialize a Win32 thread object. The thread has an invalid thread
 // handle until it is started.

-Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
+Thread::Thread(Isolate* isolate)
+    : ThreadHandle(ThreadHandle::INVALID),
+      isolate_(isolate) {
   data_ = new PlatformData(kNoThread);
 }

@@ -1853,14 +1856,18 @@
 static unsigned int __stdcall SamplerEntry(void* arg) {
   Sampler::PlatformData* data =
       reinterpret_cast<Sampler::PlatformData*>(arg);
+ Thread::SetThreadLocal(Isolate::isolate_key(), data->sampler_->isolate());
   data->Runner();
   return 0;
 }


 // Initialize a profile sampler.
-Sampler::Sampler(int interval, bool profiling)
-    : interval_(interval), profiling_(profiling), active_(false) {
+Sampler::Sampler(Isolate* isolate, int interval, bool profiling)
+    : isolate_(isolate),
+      interval_(interval),
+      profiling_(profiling),
+      active_(false) {
   data_ = new PlatformData(this);
 }

=======================================
--- /branches/experimental/isolates/src/v8threads.cc Fri Jul 16 10:48:57 2010 +++ /branches/experimental/isolates/src/v8threads.cc Tue Jul 20 11:14:13 2010
@@ -404,11 +404,6 @@
     }
   }
 }
-
-
-// This is the ContextSwitcher singleton. There is at most a single thread
-// running which delivers preemption events to V8 threads.
-ContextSwitcher* ContextSwitcher::singleton_ = NULL;


 ContextSwitcher::ContextSwitcher(Isolate* isolate, int every_n_ms)
=======================================
--- /branches/experimental/isolates/src/v8threads.h     Fri Jul 16 10:48:57 2010
+++ /branches/experimental/isolates/src/v8threads.h     Tue Jul 20 11:14:13 2010
@@ -161,9 +161,6 @@

   bool keep_going_;
   int sleep_ms_;
-  Isolate* isolate_;
-
-  static ContextSwitcher* singleton_;
 };

 } }  // namespace v8::internal
=======================================
--- /branches/experimental/isolates/test/cctest/test-platform-win32.cc Tue Sep 9 13:08:45 2008 +++ /branches/experimental/isolates/test/cctest/test-platform-win32.cc Tue Jul 20 11:14:13 2010
@@ -13,6 +13,7 @@


 TEST(VirtualMemory) {
+  OS::Setup();
   VirtualMemory* vm = new VirtualMemory(1 * MB);
   CHECK(vm->IsReserved());
   void* block_addr = vm->address();

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to