| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/debug/debug.h" | 5 #include "src/debug/debug.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 746 |
| 747 // Call IsBreakPointTriggered. | 747 // Call IsBreakPointTriggered. |
| 748 Handle<Object> argv[] = { break_id, break_point_object }; | 748 Handle<Object> argv[] = { break_id, break_point_object }; |
| 749 Handle<Object> result; | 749 Handle<Object> result; |
| 750 if (!CallFunction("IsBreakPointTriggered", arraysize(argv), argv) | 750 if (!CallFunction("IsBreakPointTriggered", arraysize(argv), argv) |
| 751 .ToHandle(&result)) { | 751 .ToHandle(&result)) { |
| 752 return false; | 752 return false; |
| 753 } | 753 } |
| 754 | 754 |
| 755 // Return whether the break point is triggered. | 755 // Return whether the break point is triggered. |
| 756 return result->IsTrue(isolate_); | 756 return result->IsTrue(); |
| 757 } | 757 } |
| 758 | 758 |
| 759 | 759 |
| 760 bool Debug::SetBreakPoint(Handle<JSFunction> function, | 760 bool Debug::SetBreakPoint(Handle<JSFunction> function, |
| 761 Handle<Object> break_point_object, | 761 Handle<Object> break_point_object, |
| 762 int* source_position) { | 762 int* source_position) { |
| 763 HandleScope scope(isolate_); | 763 HandleScope scope(isolate_); |
| 764 | 764 |
| 765 // Make sure the function is compiled and has set up the debug info. | 765 // Make sure the function is compiled and has set up the debug info. |
| 766 Handle<SharedFunctionInfo> shared(function->shared()); | 766 Handle<SharedFunctionInfo> shared(function->shared()); |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 if (promise->IsJSObject()) { | 1766 if (promise->IsJSObject()) { |
| 1767 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); | 1767 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
| 1768 // Mark the promise as already having triggered a message. | 1768 // Mark the promise as already having triggered a message. |
| 1769 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1769 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
| 1770 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); | 1770 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); |
| 1771 // Check whether the promise reject is considered an uncaught exception. | 1771 // Check whether the promise reject is considered an uncaught exception. |
| 1772 Handle<Object> has_reject_handler; | 1772 Handle<Object> has_reject_handler; |
| 1773 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1773 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 1774 isolate_, has_reject_handler, | 1774 isolate_, has_reject_handler, |
| 1775 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); | 1775 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); |
| 1776 uncaught = has_reject_handler->IsFalse(isolate_); | 1776 uncaught = has_reject_handler->IsFalse(); |
| 1777 } | 1777 } |
| 1778 // Bail out if exception breaks are not active | 1778 // Bail out if exception breaks are not active |
| 1779 if (uncaught) { | 1779 if (uncaught) { |
| 1780 // Uncaught exceptions are reported by either flags. | 1780 // Uncaught exceptions are reported by either flags. |
| 1781 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; | 1781 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; |
| 1782 } else { | 1782 } else { |
| 1783 // Caught exceptions are reported is activated. | 1783 // Caught exceptions are reported is activated. |
| 1784 if (!break_on_exception_) return; | 1784 if (!break_on_exception_) return; |
| 1785 } | 1785 } |
| 1786 | 1786 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 if (FLAG_trace_debug_json) { | 2082 if (FLAG_trace_debug_json) { |
| 2083 PrintF("%s\n", request_text->ToCString().get()); | 2083 PrintF("%s\n", request_text->ToCString().get()); |
| 2084 PrintF("%s\n", answer->ToCString().get()); | 2084 PrintF("%s\n", answer->ToCString().get()); |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 Handle<Object> is_running_args[] = { answer }; | 2087 Handle<Object> is_running_args[] = { answer }; |
| 2088 maybe_result = Execution::Call( | 2088 maybe_result = Execution::Call( |
| 2089 isolate_, is_running, cmd_processor, 1, is_running_args); | 2089 isolate_, is_running, cmd_processor, 1, is_running_args); |
| 2090 Handle<Object> result; | 2090 Handle<Object> result; |
| 2091 if (!maybe_result.ToHandle(&result)) break; | 2091 if (!maybe_result.ToHandle(&result)) break; |
| 2092 running = result->IsTrue(isolate_); | 2092 running = result->IsTrue(); |
| 2093 } else { | 2093 } else { |
| 2094 Handle<Object> exception; | 2094 Handle<Object> exception; |
| 2095 if (!maybe_exception.ToHandle(&exception)) break; | 2095 if (!maybe_exception.ToHandle(&exception)) break; |
| 2096 Handle<Object> result; | 2096 Handle<Object> result; |
| 2097 if (!Object::ToString(isolate_, exception).ToHandle(&result)) break; | 2097 if (!Object::ToString(isolate_, exception).ToHandle(&result)) break; |
| 2098 answer = Handle<String>::cast(result); | 2098 answer = Handle<String>::cast(result); |
| 2099 } | 2099 } |
| 2100 | 2100 |
| 2101 // Return the result. | 2101 // Return the result. |
| 2102 MessageImpl message = MessageImpl::NewResponse( | 2102 MessageImpl message = MessageImpl::NewResponse( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2116 Handle<Object> data) { | 2116 Handle<Object> data) { |
| 2117 GlobalHandles* global_handles = isolate_->global_handles(); | 2117 GlobalHandles* global_handles = isolate_->global_handles(); |
| 2118 | 2118 |
| 2119 // Remove existing entry. | 2119 // Remove existing entry. |
| 2120 GlobalHandles::Destroy(event_listener_.location()); | 2120 GlobalHandles::Destroy(event_listener_.location()); |
| 2121 event_listener_ = Handle<Object>(); | 2121 event_listener_ = Handle<Object>(); |
| 2122 GlobalHandles::Destroy(event_listener_data_.location()); | 2122 GlobalHandles::Destroy(event_listener_data_.location()); |
| 2123 event_listener_data_ = Handle<Object>(); | 2123 event_listener_data_ = Handle<Object>(); |
| 2124 | 2124 |
| 2125 // Set new entry. | 2125 // Set new entry. |
| 2126 if (!callback->IsUndefined(isolate_) && !callback->IsNull(isolate_)) { | 2126 if (!callback->IsUndefined(isolate_) && !callback->IsNull()) { |
| 2127 event_listener_ = global_handles->Create(*callback); | 2127 event_listener_ = global_handles->Create(*callback); |
| 2128 if (data.is_null()) data = isolate_->factory()->undefined_value(); | 2128 if (data.is_null()) data = isolate_->factory()->undefined_value(); |
| 2129 event_listener_data_ = global_handles->Create(*data); | 2129 event_listener_data_ = global_handles->Create(*data); |
| 2130 } | 2130 } |
| 2131 | 2131 |
| 2132 UpdateState(); | 2132 UpdateState(); |
| 2133 } | 2133 } |
| 2134 | 2134 |
| 2135 | 2135 |
| 2136 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { | 2136 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2610 } | 2610 } |
| 2611 | 2611 |
| 2612 | 2612 |
| 2613 void LockingCommandMessageQueue::Clear() { | 2613 void LockingCommandMessageQueue::Clear() { |
| 2614 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2614 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2615 queue_.Clear(); | 2615 queue_.Clear(); |
| 2616 } | 2616 } |
| 2617 | 2617 |
| 2618 } // namespace internal | 2618 } // namespace internal |
| 2619 } // namespace v8 | 2619 } // namespace v8 |
| OLD | NEW |