Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: src/debug.cc

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.h ('k') | src/debug-agent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
===================================================================
--- src/debug.cc (revision 8618)
+++ src/debug.cc (working copy)
@@ -797,7 +797,6 @@
// Return if debugger is already loaded.
if (IsLoaded()) return true;
- ASSERT(Isolate::Current() == isolate_);
Debugger* debugger = isolate_->debugger();
// Bail out if we're already in the process of compiling the native
@@ -1049,7 +1048,6 @@
// Check whether a single break point object is triggered.
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
- ASSERT(Isolate::Current() == isolate_);
Factory* factory = isolate_->factory();
HandleScope scope(isolate_);
@@ -1235,7 +1233,6 @@
void Debug::PrepareStep(StepAction step_action, int step_count) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
ASSERT(Debug::InDebugger());
@@ -1740,7 +1737,6 @@
void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
// Get the executing function in which the debug break occurred.
@@ -1826,6 +1822,13 @@
bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
HandleScope scope(isolate_);
+ // If there are no break points this cannot be break at return, as
+ // the debugger statement and stack guard bebug break cannot be at
+ // return.
+ if (!has_break_points_) {
+ return false;
+ }
+
// Get the executing function in which the debug break occurred.
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
@@ -1873,7 +1876,6 @@
void Debug::ClearMirrorCache() {
- ASSERT(Isolate::Current() == isolate_);
PostponeInterruptsScope postpone(isolate_);
HandleScope scope(isolate_);
ASSERT(isolate_->context() == *Debug::debug_context());
@@ -1893,7 +1895,6 @@
void Debug::CreateScriptCache() {
- ASSERT(Isolate::Current() == isolate_);
Heap* heap = isolate_->heap();
HandleScope scope(isolate_);
@@ -1938,7 +1939,6 @@
Handle<FixedArray> Debug::GetLoadedScripts() {
- ASSERT(Isolate::Current() == isolate_);
// Create and fill the script cache when the loaded scripts is requested for
// the first time.
if (script_cache_ == NULL) {
@@ -1968,7 +1968,7 @@
}
-Debugger::Debugger()
+Debugger::Debugger(Isolate* isolate)
: debugger_access_(OS::CreateMutex()),
event_listener_(Handle<Object>()),
event_listener_data_(Handle<Object>()),
@@ -1983,9 +1983,10 @@
message_dispatch_helper_thread_(NULL),
host_dispatch_micros_(100 * 1000),
agent_(NULL),
- command_queue_(kQueueInitialSize),
+ command_queue_(isolate->logger(), kQueueInitialSize),
command_received_(OS::CreateSemaphore(0)),
- event_command_queue_(kQueueInitialSize) {
+ event_command_queue_(isolate->logger(), kQueueInitialSize),
+ isolate_(isolate) {
}
@@ -2002,7 +2003,6 @@
Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
int argc, Object*** argv,
bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
// Create the execution state object.
@@ -2024,7 +2024,6 @@
Handle<Object> Debugger::MakeExecutionState(bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
// Create the execution state object.
Handle<Object> break_id = isolate_->factory()->NewNumberFromInt(
isolate_->debug()->break_id());
@@ -2038,7 +2037,6 @@
Handle<Object> Debugger::MakeBreakEvent(Handle<Object> exec_state,
Handle<Object> break_points_hit,
bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
// Create the new break event object.
const int argc = 2;
Object** argv[argc] = { exec_state.location(),
@@ -2054,7 +2052,6 @@
Handle<Object> exception,
bool uncaught,
bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
Factory* factory = isolate_->factory();
// Create the new exception event object.
const int argc = 3;
@@ -2069,7 +2066,6 @@
Handle<Object> Debugger::MakeNewFunctionEvent(Handle<Object> function,
bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
// Create the new function event object.
const int argc = 1;
Object** argv[argc] = { function.location() };
@@ -2081,7 +2077,6 @@
Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script,
bool before,
bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
Factory* factory = isolate_->factory();
// Create the compile event object.
Handle<Object> exec_state = MakeExecutionState(caught_exception);
@@ -2101,7 +2096,6 @@
Handle<Object> Debugger::MakeScriptCollectedEvent(int id,
bool* caught_exception) {
- ASSERT(Isolate::Current() == isolate_);
// Create the script collected event object.
Handle<Object> exec_state = MakeExecutionState(caught_exception);
Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id));
@@ -2116,7 +2110,6 @@
void Debugger::OnException(Handle<Object> exception, bool uncaught) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
Debug* debug = isolate_->debug();
@@ -2161,7 +2154,6 @@
void Debugger::OnDebugBreak(Handle<Object> break_points_hit,
bool auto_continue) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
// Debugger has already been entered by caller.
@@ -2171,7 +2163,7 @@
if (!Debugger::EventActive(v8::Break)) return;
// Debugger must be entered in advance.
- ASSERT(Isolate::Current()->context() == *isolate_->debug()->debug_context());
+ ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
// Create the event data object.
bool caught_exception = false;
@@ -2194,7 +2186,6 @@
void Debugger::OnBeforeCompile(Handle<Script> script) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
// Bail out based on state or if there is no listener for this event
@@ -2224,7 +2215,6 @@
// Handle debugger actions when a new script is compiled.
void Debugger::OnAfterCompile(Handle<Script> script,
AfterCompileFlags after_compile_flags) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
Debug* debug = isolate_->debug();
@@ -2293,7 +2283,6 @@
void Debugger::OnScriptCollected(int id) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
// No more to do if not debugging.
@@ -2323,7 +2312,6 @@
void Debugger::ProcessDebugEvent(v8::DebugEvent event,
Handle<JSObject> event_data,
bool auto_continue) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
// Clear any pending debug break if this is a real break.
@@ -2399,7 +2387,6 @@
Handle<Object> exec_state,
Handle<Object> event_data) {
ASSERT(event_listener_->IsJSFunction());
- ASSERT(Isolate::Current() == isolate_);
Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_));
// Invoke the JavaScript debug event listener.
@@ -2415,7 +2402,6 @@
Handle<Context> Debugger::GetDebugContext() {
- ASSERT(Isolate::Current() == isolate_);
never_unload_debugger_ = true;
EnterDebugger debugger;
return isolate_->debug()->debug_context();
@@ -2423,7 +2409,6 @@
void Debugger::UnloadDebugger() {
- ASSERT(Isolate::Current() == isolate_);
Debug* debug = isolate_->debug();
// Make sure that there are no breakpoints left.
@@ -2443,7 +2428,6 @@
Handle<JSObject> exec_state,
Handle<JSObject> event_data,
bool auto_continue) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
if (!isolate_->debug()->Load()) return;
@@ -2539,7 +2523,8 @@
// Get the command from the queue.
CommandMessage command = command_queue_.Get();
- LOGGER->DebugTag("Got request from command queue, in interactive loop.");
+ isolate_->logger()->DebugTag(
+ "Got request from command queue, in interactive loop.");
if (!Debugger::IsDebuggerActive()) {
// Delete command text and user data.
command.Dispose();
@@ -2613,7 +2598,6 @@
void Debugger::SetEventListener(Handle<Object> callback,
Handle<Object> data) {
- ASSERT(Isolate::Current() == isolate_);
HandleScope scope(isolate_);
GlobalHandles* global_handles = isolate_->global_handles();
@@ -2647,7 +2631,6 @@
void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
- ASSERT(Isolate::Current() == isolate_);
ScopedLock with(debugger_access_);
message_handler_ = handler;
@@ -2663,7 +2646,6 @@
void Debugger::ListenersChanged() {
- ASSERT(Isolate::Current() == isolate_);
if (IsDebuggerActive()) {
// Disable the compilation cache when the debugger is active.
isolate_->compilation_cache()->Disable();
@@ -2679,7 +2661,6 @@
void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
int period) {
- ASSERT(Isolate::Current() == isolate_);
host_dispatch_handler_ = handler;
host_dispatch_micros_ = period * 1000;
}
@@ -2687,7 +2668,6 @@
void Debugger::SetDebugMessageDispatchHandler(
v8::Debug::DebugMessageDispatchHandler handler, bool provide_locker) {
- ASSERT(Isolate::Current() == isolate_);
ScopedLock with(dispatch_handler_access_);
debug_message_dispatch_handler_ = handler;
@@ -2701,7 +2681,6 @@
// Calls the registered debug message handler. This callback is part of the
// public API.
void Debugger::InvokeMessageHandler(MessageImpl message) {
- ASSERT(Isolate::Current() == isolate_);
ScopedLock with(debugger_access_);
if (message_handler_ != NULL) {
@@ -2716,13 +2695,12 @@
// by the API client thread.
void Debugger::ProcessCommand(Vector<const uint16_t> command,
v8::Debug::ClientData* client_data) {
- ASSERT(Isolate::Current() == isolate_);
// Need to cast away const.
CommandMessage message = CommandMessage::New(
Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
command.length()),
client_data);
- LOGGER->DebugTag("Put command on command_queue.");
+ isolate_->logger()->DebugTag("Put command on command_queue.");
command_queue_.Put(message);
command_received_->Signal();
@@ -2746,13 +2724,11 @@
bool Debugger::HasCommands() {
- ASSERT(Isolate::Current() == isolate_);
return !command_queue_.IsEmpty();
}
void Debugger::EnqueueDebugCommand(v8::Debug::ClientData* client_data) {
- ASSERT(Isolate::Current() == isolate_);
CommandMessage message = CommandMessage::New(Vector<uint16_t>(), client_data);
event_command_queue_.Put(message);
@@ -2764,7 +2740,6 @@
bool Debugger::IsDebuggerActive() {
- ASSERT(Isolate::Current() == isolate_);
ScopedLock with(debugger_access_);
return message_handler_ != NULL || !event_listener_.is_null();
@@ -2774,7 +2749,6 @@
Handle<Object> Debugger::Call(Handle<JSFunction> fun,
Handle<Object> data,
bool* pending_exception) {
- ASSERT(Isolate::Current() == isolate_);
// When calling functions in the debugger prevent it from beeing unloaded.
Debugger::never_unload_debugger_ = true;
@@ -2824,7 +2798,7 @@
if (Socket::Setup()) {
if (agent_ == NULL) {
- agent_ = new DebuggerAgent(isolate_, name, port);
+ agent_ = new DebuggerAgent(name, port);
agent_->Start();
}
return true;
@@ -2853,7 +2827,6 @@
void Debugger::CallMessageDispatchHandler() {
- ASSERT(Isolate::Current() == isolate_);
v8::Debug::DebugMessageDispatchHandler handler;
{
ScopedLock with(dispatch_handler_access_);
@@ -3087,8 +3060,8 @@
}
-LockingCommandMessageQueue::LockingCommandMessageQueue(int size)
- : queue_(size) {
+LockingCommandMessageQueue::LockingCommandMessageQueue(Logger* logger, int size)
+ : logger_(logger), queue_(size) {
lock_ = OS::CreateMutex();
}
@@ -3107,7 +3080,7 @@
CommandMessage LockingCommandMessageQueue::Get() {
ScopedLock sl(lock_);
CommandMessage result = queue_.Get();
- LOGGER->DebugEvent("Get", result.text());
+ logger_->DebugEvent("Get", result.text());
return result;
}
@@ -3115,7 +3088,7 @@
void LockingCommandMessageQueue::Put(const CommandMessage& message) {
ScopedLock sl(lock_);
queue_.Put(message);
- LOGGER->DebugEvent("Put", message.text());
+ logger_->DebugEvent("Put", message.text());
}
@@ -3126,7 +3099,7 @@
MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate)
- : Thread(isolate, "v8:MsgDispHelpr"),
+ : Thread("v8:MsgDispHelpr"),
sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
already_signalled_(false) {
}
« no previous file with comments | « src/debug.h ('k') | src/debug-agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698