Revision: 20747
Author:   [email protected]
Date:     Tue Apr 15 07:47:33 2014 UTC
Log:      Removed GetDefaultIsolate{Debugger,ForLocking,StackGuard}.

Some first steps towards removing the default Isolate. Fixed argument
order on the way, incl. temporary helpers.

BUG=359977
LOG=y
[email protected]

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

Modified:
 /branches/bleeding_edge/include/v8-debug.h
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/debug-agent.cc
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h

=======================================
--- /branches/bleeding_edge/include/v8-debug.h  Tue Apr  1 11:23:23 2014 UTC
+++ /branches/bleeding_edge/include/v8-debug.h  Tue Apr 15 07:47:33 2014 UTC
@@ -190,32 +190,28 @@
                                     Handle<Value> data = Handle<Value>());

   // Schedule a debugger break to happen when JavaScript code is run
-  // in the given isolate. If no isolate is provided the default
-  // isolate is used.
-  static void DebugBreak(Isolate* isolate = NULL);
+  // in the given isolate.
+  static void DebugBreak(Isolate* isolate);

   // Remove scheduled debugger break in given isolate if it has not
-  // happened yet. If no isolate is provided the default isolate is
-  // used.
-  static void CancelDebugBreak(Isolate* isolate = NULL);
+  // happened yet.
+  static void CancelDebugBreak(Isolate* isolate);

   // Break execution of JavaScript in the given isolate (this method
   // can be invoked from a non-VM thread) for further client command
   // execution on a VM thread. Client data is then passed in
   // EventDetails to EventCallback2 at the moment when the VM actually
-  // stops. If no isolate is provided the default isolate is used.
-  static void DebugBreakForCommand(ClientData* data = NULL,
-                                   Isolate* isolate = NULL);
+  // stops.
+  static void DebugBreakForCommand(Isolate* isolate, ClientData* data);
+
+  // TODO(svenpanne) Remove this when Chrome is updated.
+  static void DebugBreakForCommand(ClientData* data, Isolate* isolate) {
+    DebugBreakForCommand(isolate, data);
+  }

   // Message based interface. The message protocol is JSON.
   static void SetMessageHandler2(MessageHandler2 handler);

-  // If no isolate is provided the default isolate is
-  // used.
-  // TODO(dcarney): remove
-  static void SendCommand(const uint16_t* command, int length,
-                          ClientData* client_data = NULL,
-                          Isolate* isolate = NULL);
   static void SendCommand(Isolate* isolate,
                           const uint16_t* command, int length,
                           ClientData* client_data = NULL);
@@ -331,7 +327,12 @@
    * (default Isolate if not provided). V8 will abort if LiveEdit is
    * unexpectedly used. LiveEdit is enabled by default.
    */
-  static void SetLiveEditEnabled(bool enable, Isolate* isolate = NULL);
+  static void SetLiveEditEnabled(Isolate* isolate, bool enable);
+
+  // TODO(svenpanne) Remove this when Chrome is updated.
+  static void SetLiveEditEnabled(bool enable, Isolate* isolate) {
+    SetLiveEditEnabled(isolate, enable);
+  }
 };


=======================================
--- /branches/bleeding_edge/include/v8.h        Mon Apr 14 19:34:32 2014 UTC
+++ /branches/bleeding_edge/include/v8.h        Tue Apr 15 07:47:33 2014 UTC
@@ -4840,15 +4840,14 @@

   /**
    * Forcefully terminate the current thread of JavaScript execution
-   * in the given isolate. If no isolate is provided, the default
-   * isolate is used.
+   * in the given isolate.
    *
    * This method can be used by any thread even if that thread has not
    * acquired the V8 lock with a Locker object.
    *
* \param isolate The isolate in which to terminate the current JS execution.
    */
-  static void TerminateExecution(Isolate* isolate = NULL);
+  static void TerminateExecution(Isolate* isolate);

   /**
    * Is V8 terminating JavaScript execution.
=======================================
--- /branches/bleeding_edge/src/api.cc  Mon Apr 14 09:19:09 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Tue Apr 15 07:47:33 2014 UTC
@@ -6522,12 +6522,7 @@


 void V8::TerminateExecution(Isolate* isolate) {
-  // If no isolate is supplied, use the default isolate.
-  if (isolate != NULL) {
- reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution();
-  } else {
-    i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution();
-  }
+ reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution();
 }


@@ -6844,34 +6839,19 @@


 void Debug::DebugBreak(Isolate* isolate) {
-  // If no isolate is supplied, use the default isolate.
-  if (isolate != NULL) {
-    reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak();
-  } else {
-    i::Isolate::GetDefaultIsolateStackGuard()->DebugBreak();
-  }
+  reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak();
 }


 void Debug::CancelDebugBreak(Isolate* isolate) {
-  // If no isolate is supplied, use the default isolate.
-  if (isolate != NULL) {
-    i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
-    internal_isolate->stack_guard()->Continue(i::DEBUGBREAK);
-  } else {
-    i::Isolate::GetDefaultIsolateStackGuard()->Continue(i::DEBUGBREAK);
-  }
+  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+  internal_isolate->stack_guard()->Continue(i::DEBUGBREAK);
 }


-void Debug::DebugBreakForCommand(ClientData* data, Isolate* isolate) {
-  // If no isolate is supplied, use the default isolate.
-  if (isolate != NULL) {
-    i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
-    internal_isolate->debugger()->EnqueueDebugCommand(data);
-  } else {
-    i::Isolate::GetDefaultIsolateDebugger()->EnqueueDebugCommand(data);
-  }
+void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) {
+  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+  internal_isolate->debugger()->EnqueueDebugCommand(data);
 }


@@ -6891,21 +6871,6 @@
   internal_isolate->debugger()->ProcessCommand(
       i::Vector<const uint16_t>(command, length), client_data);
 }
-
-
-void Debug::SendCommand(const uint16_t* command, int length,
-                        ClientData* client_data,
-                        Isolate* isolate) {
-  // If no isolate is supplied, use the default isolate.
-  if (isolate != NULL) {
-    i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
-    internal_isolate->debugger()->ProcessCommand(
-        i::Vector<const uint16_t>(command, length), client_data);
-  } else {
-    i::Isolate::GetDefaultIsolateDebugger()->ProcessCommand(
-        i::Vector<const uint16_t>(command, length), client_data);
-  }
-}


 void Debug::SetHostDispatchHandler(HostDispatchHandler handler,
@@ -7004,16 +6969,9 @@
 }


-void Debug::SetLiveEditEnabled(bool enable, Isolate* isolate) {
-  // If no isolate is supplied, use the default isolate.
-  i::Debugger* debugger;
-  if (isolate != NULL) {
-    i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
-    debugger = internal_isolate->debugger();
-  } else {
-    debugger = i::Isolate::GetDefaultIsolateDebugger();
-  }
-  debugger->set_live_edit_enabled(enable);
+void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
+  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+  internal_isolate->debugger()->set_live_edit_enabled(enable);
 }


=======================================
--- /branches/bleeding_edge/src/debug-agent.cc  Thu Feb  6 12:09:08 2014 UTC
+++ /branches/bleeding_edge/src/debug-agent.cc  Tue Apr 15 07:47:33 2014 UTC
@@ -229,10 +229,10 @@
     decoder.WriteUtf16(temp.start(), utf16_length);

     // Send the request received to the debugger.
-    v8::Debug::SendCommand(temp.start(),
+ v8::Debug::SendCommand(reinterpret_cast<v8::Isolate*>(agent_->isolate()),
+                           temp.start(),
                            utf16_length,
-                           NULL,
- reinterpret_cast<v8::Isolate*>(agent_->isolate()));
+                           NULL);

     if (is_closing_session) {
       // Session is closed.
=======================================
--- /branches/bleeding_edge/src/debug.cc        Fri Apr 11 12:47:34 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Tue Apr 15 07:47:33 2014 UTC
@@ -3333,7 +3333,7 @@
// Once become suspended, V8 will stay so indefinitely long, until remote
     // debugger connects and issues "continue" command.
     Debugger::message_handler_ = StubMessageHandler2;
-    v8::Debug::DebugBreak();
+    v8::Debug::DebugBreak(reinterpret_cast<v8::Isolate*>(isolate_));
   }

   if (agent_ == NULL) {
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Mon Apr 14 14:03:20 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Tue Apr 15 07:47:33 2014 UTC
@@ -212,19 +212,6 @@
   }
 } static_initializer;

-#ifdef ENABLE_DEBUGGER_SUPPORT
-Debugger* Isolate::GetDefaultIsolateDebugger() {
-  EnsureDefaultIsolate();
-  return default_isolate_->debugger();
-}
-#endif
-
-
-StackGuard* Isolate::GetDefaultIsolateStackGuard() {
-  EnsureDefaultIsolate();
-  return default_isolate_->stack_guard();
-}
-

 void Isolate::EnterDefaultIsolate() {
   EnsureDefaultIsolate();
@@ -236,12 +223,6 @@
     default_isolate_->Enter();
   }
 }
-
-
-v8::Isolate* Isolate::GetDefaultIsolateForLocking() {
-  EnsureDefaultIsolate();
-  return reinterpret_cast<v8::Isolate*>(default_isolate_);
-}


 Address Isolate::get_address_from_id(Isolate::AddressId id) {
=======================================
--- /branches/bleeding_edge/src/isolate.h       Mon Apr 14 14:03:20 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h       Tue Apr 15 07:47:33 2014 UTC
@@ -556,16 +556,6 @@
   // If one does not yet exist, return null.
   PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id);

-#ifdef ENABLE_DEBUGGER_SUPPORT
-  // Get the debugger from the default isolate. Preinitializes the
-  // default isolate if needed.
-  static Debugger* GetDefaultIsolateDebugger();
-#endif
-
-  // Get the stack guard from the default isolate. Preinitializes the
-  // default isolate if needed.
-  static StackGuard* GetDefaultIsolateStackGuard();
-
   // Returns the key used to store the pointer to the current isolate.
// Used internally for V8 threads that do not execute JavaScript but still
   // are part of the domain of an isolate (like the context switcher).
@@ -1123,11 +1113,6 @@
   SweeperThread** sweeper_threads() {
     return sweeper_thread_;
   }
-
-  // PreInits and returns a default isolate. Needed when a new thread tries
- // to create a Locker for the first time (the lock itself is in the isolate).
-  // TODO(svenpanne) This method is on death row...
-  static v8::Isolate* GetDefaultIsolateForLocking();

   int id() const { return static_cast<int>(id_); }

--
--
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/d/optout.

Reply via email to