| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 active_listener = !listeners.get(i)->IsUndefined(); | 1643 active_listener = !listeners.get(i)->IsUndefined(); |
| 1644 } | 1644 } |
| 1645 set_debugger_active((Debugger::message_thread_ != NULL && | 1645 set_debugger_active((Debugger::message_thread_ != NULL && |
| 1646 Debugger::debug_message_handler_ != NULL) || | 1646 Debugger::debug_message_handler_ != NULL) || |
| 1647 active_listener); | 1647 active_listener); |
| 1648 if (!debugger_active() && message_thread_) | 1648 if (!debugger_active() && message_thread_) |
| 1649 message_thread_->OnDebuggerInactive(); | 1649 message_thread_->OnDebuggerInactive(); |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 | 1652 |
| 1653 Handle<Object> Debugger::Call(Handle<JSFunction> fun, |
| 1654 Handle<Object> data, |
| 1655 bool* pending_exception) { |
| 1656 // Enter the debugger. |
| 1657 EnterDebugger debugger; |
| 1658 if (debugger.FailedToEnter() || !debugger.HasJavaScriptFrames()) { |
| 1659 return Factory::undefined_value(); |
| 1660 } |
| 1661 |
| 1662 // Create the execution state. |
| 1663 bool caught_exception = false; |
| 1664 Handle<Object> exec_state = MakeExecutionState(&caught_exception); |
| 1665 if (caught_exception) { |
| 1666 return Factory::undefined_value(); |
| 1667 } |
| 1668 |
| 1669 static const int kArgc = 2; |
| 1670 Object** argv[kArgc] = { exec_state.location(), data.location() }; |
| 1671 Handle<Object> result = Execution::Call(fun, Factory::undefined_value(), |
| 1672 kArgc, argv, pending_exception); |
| 1673 return result; |
| 1674 } |
| 1675 |
| 1676 |
| 1653 DebugMessageThread::DebugMessageThread() | 1677 DebugMessageThread::DebugMessageThread() |
| 1654 : host_running_(true), | 1678 : host_running_(true), |
| 1655 command_queue_(kQueueInitialSize), | 1679 command_queue_(kQueueInitialSize), |
| 1656 message_queue_(kQueueInitialSize) { | 1680 message_queue_(kQueueInitialSize) { |
| 1657 command_received_ = OS::CreateSemaphore(0); | 1681 command_received_ = OS::CreateSemaphore(0); |
| 1658 message_received_ = OS::CreateSemaphore(0); | 1682 message_received_ = OS::CreateSemaphore(0); |
| 1659 } | 1683 } |
| 1660 | 1684 |
| 1661 // Does not free resources held by DebugMessageThread | 1685 // Does not free resources held by DebugMessageThread |
| 1662 // because this cannot be done thread-safely. | 1686 // because this cannot be done thread-safely. |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 } | 1960 } |
| 1937 | 1961 |
| 1938 | 1962 |
| 1939 void LockingMessageQueue::Clear() { | 1963 void LockingMessageQueue::Clear() { |
| 1940 ScopedLock sl(lock_); | 1964 ScopedLock sl(lock_); |
| 1941 queue_.Clear(); | 1965 queue_.Clear(); |
| 1942 } | 1966 } |
| 1943 | 1967 |
| 1944 | 1968 |
| 1945 } } // namespace v8::internal | 1969 } } // namespace v8::internal |
| OLD | NEW |