diff --git a/include/v8-debug.h b/include/v8-debug.h index 0199cd2a01..49916fed66 100644 --- a/include/v8-debug.h +++ b/include/v8-debug.h @@ -190,32 +190,28 @@ class V8_EXPORT Debug { Handle data = Handle()); // 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 @@ class V8_EXPORT Debug { * (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); + } }; diff --git a/include/v8.h b/include/v8.h index fe020819c0..4d99d15152 100644 --- a/include/v8.h +++ b/include/v8.h @@ -4840,15 +4840,14 @@ class V8_EXPORT V8 { /** * 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. diff --git a/src/api.cc b/src/api.cc index bdc0c4f45e..0a827cef08 100644 --- a/src/api.cc +++ b/src/api.cc @@ -6522,12 +6522,7 @@ void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { void V8::TerminateExecution(Isolate* isolate) { - // If no isolate is supplied, use the default isolate. - if (isolate != NULL) { - reinterpret_cast(isolate)->stack_guard()->TerminateExecution(); - } else { - i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution(); - } + reinterpret_cast(isolate)->stack_guard()->TerminateExecution(); } @@ -6844,34 +6839,19 @@ bool Debug::SetDebugEventListener(v8::Handle that, void Debug::DebugBreak(Isolate* isolate) { - // If no isolate is supplied, use the default isolate. - if (isolate != NULL) { - reinterpret_cast(isolate)->stack_guard()->DebugBreak(); - } else { - i::Isolate::GetDefaultIsolateStackGuard()->DebugBreak(); - } + reinterpret_cast(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(isolate); - internal_isolate->stack_guard()->Continue(i::DEBUGBREAK); - } else { - i::Isolate::GetDefaultIsolateStackGuard()->Continue(i::DEBUGBREAK); - } + i::Isolate* internal_isolate = reinterpret_cast(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(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(isolate); + internal_isolate->debugger()->EnqueueDebugCommand(data); } @@ -6893,21 +6873,6 @@ void Debug::SendCommand(Isolate* isolate, } -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(isolate); - internal_isolate->debugger()->ProcessCommand( - i::Vector(command, length), client_data); - } else { - i::Isolate::GetDefaultIsolateDebugger()->ProcessCommand( - i::Vector(command, length), client_data); - } -} - - void Debug::SetHostDispatchHandler(HostDispatchHandler handler, int period) { i::Isolate* isolate = i::Isolate::Current(); @@ -7004,16 +6969,9 @@ Local Debug::GetDebugContext() { } -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(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(isolate); + internal_isolate->debugger()->set_live_edit_enabled(enable); } diff --git a/src/debug-agent.cc b/src/debug-agent.cc index 49790cee99..3410d6f41f 100644 --- a/src/debug-agent.cc +++ b/src/debug-agent.cc @@ -229,10 +229,10 @@ void DebuggerAgentSession::Run() { decoder.WriteUtf16(temp.start(), utf16_length); // Send the request received to the debugger. - v8::Debug::SendCommand(temp.start(), + v8::Debug::SendCommand(reinterpret_cast(agent_->isolate()), + temp.start(), utf16_length, - NULL, - reinterpret_cast(agent_->isolate())); + NULL); if (is_closing_session) { // Session is closed. diff --git a/src/debug.cc b/src/debug.cc index 41c608a021..e64806999b 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -3333,7 +3333,7 @@ bool Debugger::StartAgent(const char* name, int port, // 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(isolate_)); } if (agent_ == NULL) { diff --git a/src/isolate.cc b/src/isolate.cc index 0c108fbc4d..03e52679d8 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -212,19 +212,6 @@ struct StaticInitializer { } } 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(); @@ -238,12 +225,6 @@ void Isolate::EnterDefaultIsolate() { } -v8::Isolate* Isolate::GetDefaultIsolateForLocking() { - EnsureDefaultIsolate(); - return reinterpret_cast(default_isolate_); -} - - Address Isolate::get_address_from_id(Isolate::AddressId id) { return isolate_addresses_[id]; } diff --git a/src/isolate.h b/src/isolate.h index 3801901307..62665f98ab 100644 --- a/src/isolate.h +++ b/src/isolate.h @@ -556,16 +556,6 @@ class Isolate { // 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). @@ -1124,11 +1114,6 @@ class Isolate { 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(id_); } HStatistics* GetHStatistics();