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

Side by Side Diff: src/top.cc

Issue 13173: Fixing exception reporting so that a verbose TryCatch handler works again. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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/top.h ('k') | test/cctest/test-api.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 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 ComputeLocation(&potential_computed_location); 815 ComputeLocation(&potential_computed_location);
816 location = &potential_computed_location; 816 location = &potential_computed_location;
817 } 817 }
818 Handle<String> stack_trace; 818 Handle<String> stack_trace;
819 if (FLAG_trace_exception) stack_trace = StackTrace(); 819 if (FLAG_trace_exception) stack_trace = StackTrace();
820 message_obj = MessageHandler::MakeMessageObject("uncaught_exception", 820 message_obj = MessageHandler::MakeMessageObject("uncaught_exception",
821 location, HandleVector<Object>(&exception_handle, 1), stack_trace); 821 location, HandleVector<Object>(&exception_handle, 1), stack_trace);
822 } 822 }
823 823
824 // Save the message for reporting if the the exception remains uncaught. 824 // Save the message for reporting if the the exception remains uncaught.
825 thread_local_.has_pending_message_ = report_exception;
825 thread_local_.pending_message_ = message; 826 thread_local_.pending_message_ = message;
826 if (!message_obj.is_null()) { 827 if (!message_obj.is_null()) {
827 thread_local_.pending_message_obj_ = *message_obj; 828 thread_local_.pending_message_obj_ = *message_obj;
828 if (location != NULL) { 829 if (location != NULL) {
829 thread_local_.pending_message_script_ = *location->script(); 830 thread_local_.pending_message_script_ = *location->script();
830 thread_local_.pending_message_start_pos_ = location->start_pos(); 831 thread_local_.pending_message_start_pos_ = location->start_pos();
831 thread_local_.pending_message_end_pos_ = location->end_pos(); 832 thread_local_.pending_message_end_pos_ = location->end_pos();
832 } 833 }
833 } 834 }
834 835
(...skipping 13 matching lines...) Expand all
848 setup_external_caught(); 849 setup_external_caught();
849 // If the pending exception is OutOfMemoryException set out_of_memory in 850 // If the pending exception is OutOfMemoryException set out_of_memory in
850 // the global context. Note: We have to mark the global context here 851 // the global context. Note: We have to mark the global context here
851 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to 852 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to
852 // set it. 853 // set it.
853 HandleScope scope; 854 HandleScope scope;
854 if (thread_local_.pending_exception_ == Failure::OutOfMemoryException()) { 855 if (thread_local_.pending_exception_ == Failure::OutOfMemoryException()) {
855 context()->mark_out_of_memory(); 856 context()->mark_out_of_memory();
856 } else { 857 } else {
857 Handle<Object> exception(pending_exception()); 858 Handle<Object> exception(pending_exception());
858 if (thread_local_.external_caught_exception_) { 859 bool external_caught = thread_local_.external_caught_exception_;
860 thread_local_.external_caught_exception_ = false;
861 if (external_caught) {
859 thread_local_.try_catch_handler_->exception_ = 862 thread_local_.try_catch_handler_->exception_ =
860 thread_local_.pending_exception_; 863 thread_local_.pending_exception_;
861 if (!thread_local_.pending_message_obj_->IsTheHole()) { 864 if (!thread_local_.pending_message_obj_->IsTheHole()) {
862 try_catch_handler()->message_ = thread_local_.pending_message_obj_; 865 try_catch_handler()->message_ = thread_local_.pending_message_obj_;
863 } 866 }
864 } else if (thread_local_.pending_message_ != NULL) { 867 }
865 MessageHandler::ReportMessage(thread_local_.pending_message_); 868 if (thread_local_.has_pending_message_) {
866 } else if (!thread_local_.pending_message_obj_->IsTheHole()) { 869 thread_local_.has_pending_message_ = false;
867 Handle<Object> message_obj(thread_local_.pending_message_obj_); 870 if (thread_local_.pending_message_ != NULL) {
868 if (thread_local_.pending_message_script_ != NULL) { 871 MessageHandler::ReportMessage(thread_local_.pending_message_);
869 Handle<Script> script(thread_local_.pending_message_script_); 872 } else if (!thread_local_.pending_message_obj_->IsTheHole()) {
870 int start_pos = thread_local_.pending_message_start_pos_; 873 Handle<Object> message_obj(thread_local_.pending_message_obj_);
871 int end_pos = thread_local_.pending_message_end_pos_; 874 if (thread_local_.pending_message_script_ != NULL) {
872 MessageLocation location(script, start_pos, end_pos); 875 Handle<Script> script(thread_local_.pending_message_script_);
873 MessageHandler::ReportMessage(&location, message_obj); 876 int start_pos = thread_local_.pending_message_start_pos_;
874 } else { 877 int end_pos = thread_local_.pending_message_end_pos_;
875 MessageHandler::ReportMessage(NULL, message_obj); 878 MessageLocation location(script, start_pos, end_pos);
879 MessageHandler::ReportMessage(&location, message_obj);
880 } else {
881 MessageHandler::ReportMessage(NULL, message_obj);
882 }
876 } 883 }
877 } 884 }
885 thread_local_.external_caught_exception_ = external_caught;
878 set_pending_exception(*exception); 886 set_pending_exception(*exception);
879 } 887 }
880 clear_pending_message(); 888 clear_pending_message();
881 } 889 }
882 890
883 891
884 void Top::TraceException(bool flag) { 892 void Top::TraceException(bool flag) {
885 FLAG_trace_exception = flag; 893 FLAG_trace_exception = flag;
886 } 894 }
887 895
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 Top::break_access_->Lock(); 964 Top::break_access_->Lock();
957 } 965 }
958 966
959 967
960 ExecutionAccess::~ExecutionAccess() { 968 ExecutionAccess::~ExecutionAccess() {
961 Top::break_access_->Unlock(); 969 Top::break_access_->Unlock();
962 } 970 }
963 971
964 972
965 } } // namespace v8::internal 973 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/top.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698