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

Side by Side Diff: src/debug.cc

Issue 516913003: Do not expose termination exceptions to the Exception API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comment Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/elements.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 if (function_info.is_null()) { 750 if (function_info.is_null()) {
751 DCHECK(isolate->has_pending_exception()); 751 DCHECK(isolate->has_pending_exception());
752 isolate->clear_pending_exception(); 752 isolate->clear_pending_exception();
753 return false; 753 return false;
754 } 754 }
755 755
756 // Execute the shared function in the debugger context. 756 // Execute the shared function in the debugger context.
757 Handle<JSFunction> function = 757 Handle<JSFunction> function =
758 factory->NewFunctionFromSharedFunctionInfo(function_info, context); 758 factory->NewFunctionFromSharedFunctionInfo(function_info, context);
759 759
760 Handle<Object> exception; 760 MaybeHandle<Object> maybe_exception;
761 MaybeHandle<Object> result = 761 MaybeHandle<Object> result = Execution::TryCall(
762 Execution::TryCall(function, 762 function, handle(context->global_proxy()), 0, NULL, &maybe_exception);
763 handle(context->global_proxy()),
764 0,
765 NULL,
766 &exception);
767 763
768 // Check for caught exceptions. 764 // Check for caught exceptions.
769 if (result.is_null()) { 765 if (result.is_null()) {
770 DCHECK(!isolate->has_pending_exception()); 766 DCHECK(!isolate->has_pending_exception());
771 MessageLocation computed_location; 767 MessageLocation computed_location;
772 isolate->ComputeLocation(&computed_location); 768 isolate->ComputeLocation(&computed_location);
773 Handle<Object> message = MessageHandler::MakeMessageObject( 769 Handle<Object> message = MessageHandler::MakeMessageObject(
774 isolate, "error_loading_debugger", &computed_location, 770 isolate, "error_loading_debugger", &computed_location,
775 Vector<Handle<Object> >::empty(), Handle<JSArray>()); 771 Vector<Handle<Object> >::empty(), Handle<JSArray>());
776 DCHECK(!isolate->has_pending_exception()); 772 DCHECK(!isolate->has_pending_exception());
777 if (!exception.is_null()) { 773 Handle<Object> exception;
774 if (maybe_exception.ToHandle(&exception)) {
778 isolate->set_pending_exception(*exception); 775 isolate->set_pending_exception(*exception);
779 MessageHandler::ReportMessage(isolate, NULL, message); 776 MessageHandler::ReportMessage(isolate, NULL, message);
780 isolate->clear_pending_exception(); 777 isolate->clear_pending_exception();
781 } 778 }
782 return false; 779 return false;
783 } 780 }
784 781
785 // Mark this script as native and return successfully. 782 // Mark this script as native and return successfully.
786 Handle<Script> script(Script::cast(function->shared()->script())); 783 Handle<Script> script(Script::cast(function->shared()->script()));
787 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 784 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 command.Dispose(); 2855 command.Dispose();
2859 return; 2856 return;
2860 } 2857 }
2861 2858
2862 Vector<const uc16> command_text( 2859 Vector<const uc16> command_text(
2863 const_cast<const uc16*>(command.text().start()), 2860 const_cast<const uc16*>(command.text().start()),
2864 command.text().length()); 2861 command.text().length());
2865 Handle<String> request_text = isolate_->factory()->NewStringFromTwoByte( 2862 Handle<String> request_text = isolate_->factory()->NewStringFromTwoByte(
2866 command_text).ToHandleChecked(); 2863 command_text).ToHandleChecked();
2867 Handle<Object> request_args[] = { request_text }; 2864 Handle<Object> request_args[] = { request_text };
2868 Handle<Object> exception;
2869 Handle<Object> answer_value; 2865 Handle<Object> answer_value;
2870 Handle<String> answer; 2866 Handle<String> answer;
2871 MaybeHandle<Object> maybe_result = Execution::TryCall( 2867 MaybeHandle<Object> maybe_exception;
2872 process_debug_request, cmd_processor, 1, request_args, &exception); 2868 MaybeHandle<Object> maybe_result =
2869 Execution::TryCall(process_debug_request, cmd_processor, 1,
2870 request_args, &maybe_exception);
2873 2871
2874 if (maybe_result.ToHandle(&answer_value)) { 2872 if (maybe_result.ToHandle(&answer_value)) {
2875 if (answer_value->IsUndefined()) { 2873 if (answer_value->IsUndefined()) {
2876 answer = isolate_->factory()->empty_string(); 2874 answer = isolate_->factory()->empty_string();
2877 } else { 2875 } else {
2878 answer = Handle<String>::cast(answer_value); 2876 answer = Handle<String>::cast(answer_value);
2879 } 2877 }
2880 2878
2881 // Log the JSON request/response. 2879 // Log the JSON request/response.
2882 if (FLAG_trace_debug_json) { 2880 if (FLAG_trace_debug_json) {
2883 PrintF("%s\n", request_text->ToCString().get()); 2881 PrintF("%s\n", request_text->ToCString().get());
2884 PrintF("%s\n", answer->ToCString().get()); 2882 PrintF("%s\n", answer->ToCString().get());
2885 } 2883 }
2886 2884
2887 Handle<Object> is_running_args[] = { answer }; 2885 Handle<Object> is_running_args[] = { answer };
2888 maybe_result = Execution::Call( 2886 maybe_result = Execution::Call(
2889 isolate_, is_running, cmd_processor, 1, is_running_args); 2887 isolate_, is_running, cmd_processor, 1, is_running_args);
2890 running = maybe_result.ToHandleChecked()->IsTrue(); 2888 Handle<Object> result;
2889 if (!maybe_result.ToHandle(&result)) break;
2890 running = result->IsTrue();
2891 } else { 2891 } else {
2892 answer = Handle<String>::cast( 2892 Handle<Object> exception;
2893 Execution::ToString(isolate_, exception).ToHandleChecked()); 2893 if (!maybe_exception.ToHandle(&exception)) break;
2894 Handle<Object> result;
2895 if (!Execution::ToString(isolate_, exception).ToHandle(&result)) break;
2896 answer = Handle<String>::cast(result);
2894 } 2897 }
2895 2898
2896 // Return the result. 2899 // Return the result.
2897 MessageImpl message = MessageImpl::NewResponse( 2900 MessageImpl message = MessageImpl::NewResponse(
2898 event, running, exec_state, event_data, answer, command.client_data()); 2901 event, running, exec_state, event_data, answer, command.client_data());
2899 InvokeMessageHandler(message); 2902 InvokeMessageHandler(message);
2900 command.Dispose(); 2903 command.Dispose();
2901 2904
2902 // Return from debug event processing if either the VM is put into the 2905 // Return from debug event processing if either the VM is put into the
2903 // running state (through a continue command) or auto continue is active 2906 // running state (through a continue command) or auto continue is active
2904 // and there are no more commands queued. 2907 // and there are no more commands queued.
2905 } while (!running || has_commands()); 2908 } while (!running || has_commands());
2909 command_queue_.Clear();
2906 } 2910 }
2907 2911
2908 2912
2909 void Debug::SetEventListener(Handle<Object> callback, 2913 void Debug::SetEventListener(Handle<Object> callback,
2910 Handle<Object> data) { 2914 Handle<Object> data) {
2911 GlobalHandles* global_handles = isolate_->global_handles(); 2915 GlobalHandles* global_handles = isolate_->global_handles();
2912 2916
2913 // Remove existing entry. 2917 // Remove existing entry.
2914 GlobalHandles::Destroy(event_listener_.location()); 2918 GlobalHandles::Destroy(event_listener_.location());
2915 event_listener_ = Handle<Object>(); 2919 event_listener_ = Handle<Object>();
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
3358 logger_->DebugEvent("Put", message.text()); 3362 logger_->DebugEvent("Put", message.text());
3359 } 3363 }
3360 3364
3361 3365
3362 void LockingCommandMessageQueue::Clear() { 3366 void LockingCommandMessageQueue::Clear() {
3363 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3367 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3364 queue_.Clear(); 3368 queue_.Clear();
3365 } 3369 }
3366 3370
3367 } } // namespace v8::internal 3371 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698