Revision: 16988
Author:   [email protected]
Date:     Fri Sep 27 11:32:13 2013 UTC
Log:      make v8::Locker not use Isolate::GetCurrent()

[email protected]
BUG=

Review URL: https://codereview.chromium.org/25002004
http://code.google.com/p/v8/source/detail?r=16988

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/d8.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/v8threads.cc
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-threads.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Fri Sep 27 10:53:07 2013 UTC
+++ /branches/bleeding_edge/include/v8.h        Fri Sep 27 11:32:13 2013 UTC
@@ -5202,9 +5202,6 @@
    * Initialize Unlocker for a given Isolate.
    */
   V8_INLINE explicit Unlocker(Isolate* isolate) { Initialize(isolate); }
-
-  /** Deprecated. Use Isolate version instead. */
-  V8_DEPRECATED(Unlocker());

   ~Unlocker();
  private:
@@ -5220,9 +5217,6 @@
    * Initialize Locker for a given Isolate.
    */
   V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); }
-
-  /** Deprecated. Use Isolate version instead. */
-  V8_DEPRECATED(Locker());

   ~Locker();

@@ -5233,12 +5227,12 @@
    * that will switch between multiple threads that are in contention
    * for the V8 lock.
    */
-  static void StartPreemption(int every_n_ms);
+  static void StartPreemption(Isolate* isolate, int every_n_ms);

   /**
    * Stop preemption.
    */
-  static void StopPreemption();
+  static void StopPreemption(Isolate* isolate);

   /**
* Returns whether or not the locker for a given isolate, is locked by the
=======================================
--- /branches/bleeding_edge/src/d8.cc   Fri Sep 27 10:53:07 2013 UTC
+++ /branches/bleeding_edge/src/d8.cc   Fri Sep 27 11:32:13 2013 UTC
@@ -1528,7 +1528,7 @@
// Start preemption if threads have been created and preemption is enabled.
     if (threads.length() > 0
         && options.use_preemption) {
-      Locker::StartPreemption(options.preemption_interval);
+      Locker::StartPreemption(isolate, options.preemption_interval);
     }
 #endif  // V8_SHARED
   }
@@ -1546,7 +1546,7 @@

   if (threads.length() > 0 && options.use_preemption) {
     Locker lock(isolate);
-    Locker::StopPreemption();
+    Locker::StopPreemption(isolate);
   }
 #endif  // V8_SHARED
   return 0;
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Thu Sep 26 09:40:13 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Fri Sep 27 11:32:13 2013 UTC
@@ -1929,7 +1929,7 @@
     deoptimizer_data_ = NULL;
     if (FLAG_preemption) {
       v8::Locker locker(reinterpret_cast<v8::Isolate*>(this));
-      v8::Locker::StopPreemption();
+      v8::Locker::StopPreemption(reinterpret_cast<v8::Isolate*>(this));
     }
     builtins_.TearDown();
     bootstrapper_->TearDown();
@@ -2271,7 +2271,7 @@

   if (FLAG_preemption) {
     v8::Locker locker(reinterpret_cast<v8::Isolate*>(this));
-    v8::Locker::StartPreemption(100);
+    v8::Locker::StartPreemption(reinterpret_cast<v8::Isolate*>(this), 100);
   }

 #ifdef ENABLE_DEBUGGER_SUPPORT
=======================================
--- /branches/bleeding_edge/src/v8threads.cc    Thu Sep 19 07:33:45 2013 UTC
+++ /branches/bleeding_edge/src/v8threads.cc    Fri Sep 27 11:32:13 2013 UTC
@@ -42,11 +42,6 @@
 bool Locker::active_ = false;


-Locker::Locker() {
-  Initialize(i::Isolate::GetDefaultIsolateForLocking());
-}
-
-
// Once the Locker is initialized, the current thread will be guaranteed to have
 // the lock for a given isolate.
 void Locker::Initialize(v8::Isolate* isolate) {
@@ -114,11 +109,6 @@
     isolate_->thread_manager()->Unlock();
   }
 }
-
-
-Unlocker::Unlocker() {
-  Initialize(i::Isolate::GetDefaultIsolateForLocking());
-}


 void Unlocker::Initialize(v8::Isolate* isolate) {
@@ -143,14 +133,15 @@
 }


-void Locker::StartPreemption(int every_n_ms) {
+void Locker::StartPreemption(v8::Isolate* isolate, int every_n_ms) {
   v8::internal::ContextSwitcher::StartPreemption(
-      i::Isolate::Current(), every_n_ms);
+      reinterpret_cast<i::Isolate*>(isolate), every_n_ms);
 }


-void Locker::StopPreemption() {
-  v8::internal::ContextSwitcher::StopPreemption(i::Isolate::Current());
+void Locker::StopPreemption(v8::Isolate* isolate) {
+  v8::internal::ContextSwitcher::StopPreemption(
+      reinterpret_cast<i::Isolate*>(isolate));
 }


=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri Sep 27 07:04:02 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Fri Sep 27 11:32:13 2013 UTC
@@ -14218,14 +14218,15 @@
     gc_success_ = false;
     GCThread gc_thread(this);
     gc_thread.Start();
-    v8::Locker::StartPreemption(1);
+    v8::Isolate* isolate = CcTest::isolate();
+    v8::Locker::StartPreemption(isolate, 1);

     LongRunningRegExp();
     {
-      v8::Unlocker unlock(CcTest::isolate());
+      v8::Unlocker unlock(isolate);
       gc_thread.Join();
     }
-    v8::Locker::StopPreemption();
+    v8::Locker::StopPreemption(isolate);
     CHECK(regexp_success_);
     CHECK(gc_success_);
   }
@@ -14340,14 +14341,15 @@
     gc_success_ = false;
     GCThread gc_thread(this);
     gc_thread.Start();
-    v8::Locker::StartPreemption(1);
+    v8::Isolate* isolate = CcTest::isolate();
+    v8::Locker::StartPreemption(isolate, 1);

     LongRunningApply();
     {
-      v8::Unlocker unlock(CcTest::isolate());
+      v8::Unlocker unlock(isolate);
       gc_thread.Join();
     }
-    v8::Locker::StopPreemption();
+    v8::Locker::StopPreemption(isolate);
     CHECK(apply_success_);
     CHECK(gc_success_);
   }
@@ -14627,6 +14629,7 @@
         uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {}
   ~RegExpStringModificationTest() {}
   void RunTest() {
+    v8::Isolate* isolate = CcTest::isolate();
     i::Factory* factory = CcTest::i_isolate()->factory();

     regexp_success_ = false;
@@ -14655,13 +14658,13 @@

     MorphThread morph_thread(this);
     morph_thread.Start();
-    v8::Locker::StartPreemption(1);
+    v8::Locker::StartPreemption(isolate, 1);
     LongRunningRegExp();
     {
-      v8::Unlocker unlock(CcTest::isolate());
+      v8::Unlocker unlock(isolate);
       morph_thread.Join();
     }
-    v8::Locker::StopPreemption();
+    v8::Locker::StopPreemption(isolate);
     CHECK(regexp_success_);
     CHECK(morph_success_);
   }
=======================================
--- /branches/bleeding_edge/test/cctest/test-threads.cc Fri Sep 20 10:52:20 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-threads.cc Fri Sep 27 11:32:13 2013 UTC
@@ -41,14 +41,14 @@
   v8::Handle<v8::Context> context = v8::Context::New(isolate);
   v8::Context::Scope context_scope(context);

-  v8::Locker::StartPreemption(100);
+  v8::Locker::StartPreemption(isolate, 100);

   v8::Handle<v8::Script> script = v8::Script::Compile(
v8::String::New("var count = 0; var obj = new Object(); count++;\n"));

   script->Run();

-  v8::Locker::StopPreemption();
+  v8::Locker::StopPreemption(isolate);
   v8::internal::OS::Sleep(500);  // Make sure the timer fires.

   script->Run();

--
--
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