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
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/238803002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20747 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6b4d4b72
...@@ -190,32 +190,28 @@ class V8_EXPORT Debug { ...@@ -190,32 +190,28 @@ class V8_EXPORT Debug {
Handle<Value> data = Handle<Value>()); Handle<Value> data = Handle<Value>());
// Schedule a debugger break to happen when JavaScript code is run // Schedule a debugger break to happen when JavaScript code is run
// in the given isolate. If no isolate is provided the default // in the given isolate.
// isolate is used. static void DebugBreak(Isolate* isolate);
static void DebugBreak(Isolate* isolate = NULL);
// Remove scheduled debugger break in given isolate if it has not // Remove scheduled debugger break in given isolate if it has not
// happened yet. If no isolate is provided the default isolate is // happened yet.
// used. static void CancelDebugBreak(Isolate* isolate);
static void CancelDebugBreak(Isolate* isolate = NULL);
// Break execution of JavaScript in the given isolate (this method // Break execution of JavaScript in the given isolate (this method
// can be invoked from a non-VM thread) for further client command // can be invoked from a non-VM thread) for further client command
// execution on a VM thread. Client data is then passed in // execution on a VM thread. Client data is then passed in
// EventDetails to EventCallback2 at the moment when the VM actually // EventDetails to EventCallback2 at the moment when the VM actually
// stops. If no isolate is provided the default isolate is used. // stops.
static void DebugBreakForCommand(ClientData* data = NULL, static void DebugBreakForCommand(Isolate* isolate, ClientData* data);
Isolate* isolate = NULL);
// 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. // Message based interface. The message protocol is JSON.
static void SetMessageHandler2(MessageHandler2 handler); 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, static void SendCommand(Isolate* isolate,
const uint16_t* command, int length, const uint16_t* command, int length,
ClientData* client_data = NULL); ClientData* client_data = NULL);
...@@ -331,7 +327,12 @@ class V8_EXPORT Debug { ...@@ -331,7 +327,12 @@ class V8_EXPORT Debug {
* (default Isolate if not provided). V8 will abort if LiveEdit is * (default Isolate if not provided). V8 will abort if LiveEdit is
* unexpectedly used. LiveEdit is enabled by default. * 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);
}
}; };
......
...@@ -4840,15 +4840,14 @@ class V8_EXPORT V8 { ...@@ -4840,15 +4840,14 @@ class V8_EXPORT V8 {
/** /**
* Forcefully terminate the current thread of JavaScript execution * Forcefully terminate the current thread of JavaScript execution
* in the given isolate. If no isolate is provided, the default * in the given isolate.
* isolate is used.
* *
* This method can be used by any thread even if that thread has not * This method can be used by any thread even if that thread has not
* acquired the V8 lock with a Locker object. * acquired the V8 lock with a Locker object.
* *
* \param isolate The isolate in which to terminate the current JS execution. * \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. * Is V8 terminating JavaScript execution.
......
...@@ -6522,12 +6522,7 @@ void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { ...@@ -6522,12 +6522,7 @@ void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) {
void V8::TerminateExecution(Isolate* isolate) { void V8::TerminateExecution(Isolate* isolate) {
// If no isolate is supplied, use the default isolate. reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution();
if (isolate != NULL) {
reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution();
} else {
i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution();
}
} }
...@@ -6844,34 +6839,19 @@ bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that, ...@@ -6844,34 +6839,19 @@ bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that,
void Debug::DebugBreak(Isolate* isolate) { void Debug::DebugBreak(Isolate* isolate) {
// If no isolate is supplied, use the default isolate. reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak();
if (isolate != NULL) {
reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak();
} else {
i::Isolate::GetDefaultIsolateStackGuard()->DebugBreak();
}
} }
void Debug::CancelDebugBreak(Isolate* isolate) { void Debug::CancelDebugBreak(Isolate* isolate) {
// If no isolate is supplied, use the default isolate. i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (isolate != NULL) { internal_isolate->stack_guard()->Continue(i::DEBUGBREAK);
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
internal_isolate->stack_guard()->Continue(i::DEBUGBREAK);
} else {
i::Isolate::GetDefaultIsolateStackGuard()->Continue(i::DEBUGBREAK);
}
} }
void Debug::DebugBreakForCommand(ClientData* data, Isolate* isolate) { void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) {
// If no isolate is supplied, use the default isolate. i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (isolate != NULL) { internal_isolate->debugger()->EnqueueDebugCommand(data);
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
internal_isolate->debugger()->EnqueueDebugCommand(data);
} else {
i::Isolate::GetDefaultIsolateDebugger()->EnqueueDebugCommand(data);
}
} }
...@@ -6893,21 +6873,6 @@ void Debug::SendCommand(Isolate* isolate, ...@@ -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<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, void Debug::SetHostDispatchHandler(HostDispatchHandler handler,
int period) { int period) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
...@@ -7004,16 +6969,9 @@ Local<Context> Debug::GetDebugContext() { ...@@ -7004,16 +6969,9 @@ Local<Context> Debug::GetDebugContext() {
} }
void Debug::SetLiveEditEnabled(bool enable, Isolate* isolate) { void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
// If no isolate is supplied, use the default isolate. i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Debugger* debugger; internal_isolate->debugger()->set_live_edit_enabled(enable);
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);
} }
......
...@@ -229,10 +229,10 @@ void DebuggerAgentSession::Run() { ...@@ -229,10 +229,10 @@ void DebuggerAgentSession::Run() {
decoder.WriteUtf16(temp.start(), utf16_length); decoder.WriteUtf16(temp.start(), utf16_length);
// Send the request received to the debugger. // 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, utf16_length,
NULL, NULL);
reinterpret_cast<v8::Isolate*>(agent_->isolate()));
if (is_closing_session) { if (is_closing_session) {
// Session is closed. // Session is closed.
......
...@@ -3333,7 +3333,7 @@ bool Debugger::StartAgent(const char* name, int port, ...@@ -3333,7 +3333,7 @@ bool Debugger::StartAgent(const char* name, int port,
// Once become suspended, V8 will stay so indefinitely long, until remote // Once become suspended, V8 will stay so indefinitely long, until remote
// debugger connects and issues "continue" command. // debugger connects and issues "continue" command.
Debugger::message_handler_ = StubMessageHandler2; Debugger::message_handler_ = StubMessageHandler2;
v8::Debug::DebugBreak(); v8::Debug::DebugBreak(reinterpret_cast<v8::Isolate*>(isolate_));
} }
if (agent_ == NULL) { if (agent_ == NULL) {
......
...@@ -212,19 +212,6 @@ struct StaticInitializer { ...@@ -212,19 +212,6 @@ struct StaticInitializer {
} }
} static_initializer; } 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() { void Isolate::EnterDefaultIsolate() {
EnsureDefaultIsolate(); EnsureDefaultIsolate();
...@@ -238,12 +225,6 @@ void Isolate::EnterDefaultIsolate() { ...@@ -238,12 +225,6 @@ void Isolate::EnterDefaultIsolate() {
} }
v8::Isolate* Isolate::GetDefaultIsolateForLocking() {
EnsureDefaultIsolate();
return reinterpret_cast<v8::Isolate*>(default_isolate_);
}
Address Isolate::get_address_from_id(Isolate::AddressId id) { Address Isolate::get_address_from_id(Isolate::AddressId id) {
return isolate_addresses_[id]; return isolate_addresses_[id];
} }
......
...@@ -556,16 +556,6 @@ class Isolate { ...@@ -556,16 +556,6 @@ class Isolate {
// If one does not yet exist, return null. // If one does not yet exist, return null.
PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id); 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. // Returns the key used to store the pointer to the current isolate.
// Used internally for V8 threads that do not execute JavaScript but still // Used internally for V8 threads that do not execute JavaScript but still
// are part of the domain of an isolate (like the context switcher). // are part of the domain of an isolate (like the context switcher).
...@@ -1124,11 +1114,6 @@ class Isolate { ...@@ -1124,11 +1114,6 @@ class Isolate {
return sweeper_thread_; 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_); } int id() const { return static_cast<int>(id_); }
HStatistics* GetHStatistics(); HStatistics* GetHStatistics();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment