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(); | 756 return result->IsTrue(isolate_); |
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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 if (promise->IsJSObject()) { | 1765 if (promise->IsJSObject()) { |
1766 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); | 1766 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
1767 // Mark the promise as already having triggered a message. | 1767 // Mark the promise as already having triggered a message. |
1768 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1768 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
1769 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); | 1769 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); |
1770 // Check whether the promise reject is considered an uncaught exception. | 1770 // Check whether the promise reject is considered an uncaught exception. |
1771 Handle<Object> has_reject_handler; | 1771 Handle<Object> has_reject_handler; |
1772 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1772 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
1773 isolate_, has_reject_handler, | 1773 isolate_, has_reject_handler, |
1774 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); | 1774 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); |
1775 uncaught = has_reject_handler->IsFalse(); | 1775 uncaught = has_reject_handler->IsFalse(isolate_); |
1776 } | 1776 } |
1777 // Bail out if exception breaks are not active | 1777 // Bail out if exception breaks are not active |
1778 if (uncaught) { | 1778 if (uncaught) { |
1779 // Uncaught exceptions are reported by either flags. | 1779 // Uncaught exceptions are reported by either flags. |
1780 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; | 1780 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; |
1781 } else { | 1781 } else { |
1782 // Caught exceptions are reported is activated. | 1782 // Caught exceptions are reported is activated. |
1783 if (!break_on_exception_) return; | 1783 if (!break_on_exception_) return; |
1784 } | 1784 } |
1785 | 1785 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 if (FLAG_trace_debug_json) { | 2081 if (FLAG_trace_debug_json) { |
2082 PrintF("%s\n", request_text->ToCString().get()); | 2082 PrintF("%s\n", request_text->ToCString().get()); |
2083 PrintF("%s\n", answer->ToCString().get()); | 2083 PrintF("%s\n", answer->ToCString().get()); |
2084 } | 2084 } |
2085 | 2085 |
2086 Handle<Object> is_running_args[] = { answer }; | 2086 Handle<Object> is_running_args[] = { answer }; |
2087 maybe_result = Execution::Call( | 2087 maybe_result = Execution::Call( |
2088 isolate_, is_running, cmd_processor, 1, is_running_args); | 2088 isolate_, is_running, cmd_processor, 1, is_running_args); |
2089 Handle<Object> result; | 2089 Handle<Object> result; |
2090 if (!maybe_result.ToHandle(&result)) break; | 2090 if (!maybe_result.ToHandle(&result)) break; |
2091 running = result->IsTrue(); | 2091 running = result->IsTrue(isolate_); |
2092 } else { | 2092 } else { |
2093 Handle<Object> exception; | 2093 Handle<Object> exception; |
2094 if (!maybe_exception.ToHandle(&exception)) break; | 2094 if (!maybe_exception.ToHandle(&exception)) break; |
2095 Handle<Object> result; | 2095 Handle<Object> result; |
2096 if (!Object::ToString(isolate_, exception).ToHandle(&result)) break; | 2096 if (!Object::ToString(isolate_, exception).ToHandle(&result)) break; |
2097 answer = Handle<String>::cast(result); | 2097 answer = Handle<String>::cast(result); |
2098 } | 2098 } |
2099 | 2099 |
2100 // Return the result. | 2100 // Return the result. |
2101 MessageImpl message = MessageImpl::NewResponse( | 2101 MessageImpl message = MessageImpl::NewResponse( |
(...skipping 13 matching lines...) Expand all Loading... |
2115 Handle<Object> data) { | 2115 Handle<Object> data) { |
2116 GlobalHandles* global_handles = isolate_->global_handles(); | 2116 GlobalHandles* global_handles = isolate_->global_handles(); |
2117 | 2117 |
2118 // Remove existing entry. | 2118 // Remove existing entry. |
2119 GlobalHandles::Destroy(event_listener_.location()); | 2119 GlobalHandles::Destroy(event_listener_.location()); |
2120 event_listener_ = Handle<Object>(); | 2120 event_listener_ = Handle<Object>(); |
2121 GlobalHandles::Destroy(event_listener_data_.location()); | 2121 GlobalHandles::Destroy(event_listener_data_.location()); |
2122 event_listener_data_ = Handle<Object>(); | 2122 event_listener_data_ = Handle<Object>(); |
2123 | 2123 |
2124 // Set new entry. | 2124 // Set new entry. |
2125 if (!callback->IsUndefined(isolate_) && !callback->IsNull()) { | 2125 if (!callback->IsUndefined(isolate_) && !callback->IsNull(isolate_)) { |
2126 event_listener_ = global_handles->Create(*callback); | 2126 event_listener_ = global_handles->Create(*callback); |
2127 if (data.is_null()) data = isolate_->factory()->undefined_value(); | 2127 if (data.is_null()) data = isolate_->factory()->undefined_value(); |
2128 event_listener_data_ = global_handles->Create(*data); | 2128 event_listener_data_ = global_handles->Create(*data); |
2129 } | 2129 } |
2130 | 2130 |
2131 UpdateState(); | 2131 UpdateState(); |
2132 } | 2132 } |
2133 | 2133 |
2134 | 2134 |
2135 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { | 2135 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 } | 2609 } |
2610 | 2610 |
2611 | 2611 |
2612 void LockingCommandMessageQueue::Clear() { | 2612 void LockingCommandMessageQueue::Clear() { |
2613 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2613 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2614 queue_.Clear(); | 2614 queue_.Clear(); |
2615 } | 2615 } |
2616 | 2616 |
2617 } // namespace internal | 2617 } // namespace internal |
2618 } // namespace v8 | 2618 } // namespace v8 |
OLD | NEW |