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

Side by Side Diff: src/top.cc

Issue 8101: Posponed the setting of "external_caught_exception" to when leaving JavaScrip... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 thread_local_.c_entry_fp_ = 0; 94 thread_local_.c_entry_fp_ = 0;
95 thread_local_.handler_ = 0; 95 thread_local_.handler_ = 0;
96 thread_local_.stack_is_cooked_ = false; 96 thread_local_.stack_is_cooked_ = false;
97 thread_local_.try_catch_handler_ = NULL; 97 thread_local_.try_catch_handler_ = NULL;
98 thread_local_.context_ = NULL; 98 thread_local_.context_ = NULL;
99 thread_local_.external_caught_exception_ = false; 99 thread_local_.external_caught_exception_ = false;
100 thread_local_.failed_access_check_callback_ = NULL; 100 thread_local_.failed_access_check_callback_ = NULL;
101 clear_pending_exception(); 101 clear_pending_exception();
102 clear_scheduled_exception(); 102 clear_scheduled_exception();
103 thread_local_.save_context_ = NULL; 103 thread_local_.save_context_ = NULL;
104 thread_local_.catcher_ = NULL;
104 } 105 }
105 106
106 107
107 // Create a dummy thread that will wait forever on a semaphore. The only 108 // Create a dummy thread that will wait forever on a semaphore. The only
108 // purpose for this thread is to have some stack area to save essential data 109 // purpose for this thread is to have some stack area to save essential data
109 // into for use by a stacks only core dump (aka minidump). 110 // into for use by a stacks only core dump (aka minidump).
110 class PreallocatedMemoryThread: public Thread { 111 class PreallocatedMemoryThread: public Thread {
111 public: 112 public:
112 PreallocatedMemoryThread() : keep_running_(true) { 113 PreallocatedMemoryThread() : keep_running_(true) {
113 wait_for_ever_semaphore_ = OS::CreateSemaphore(0); 114 wait_for_ever_semaphore_ = OS::CreateSemaphore(0);
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 } 600 }
600 601
601 602
602 Failure* Top::Throw(Object* exception, MessageLocation* location) { 603 Failure* Top::Throw(Object* exception, MessageLocation* location) {
603 DoThrow(exception, location, NULL); 604 DoThrow(exception, location, NULL);
604 return Failure::Exception(); 605 return Failure::Exception();
605 } 606 }
606 607
607 608
608 Failure* Top::ReThrow(Object* exception, MessageLocation* location) { 609 Failure* Top::ReThrow(Object* exception, MessageLocation* location) {
609 // Check is this exception is externally caught.
610 bool is_caught_externally = false;
611 ShouldReportException(&is_caught_externally);
612 thread_local_.external_caught_exception_ = is_caught_externally;
613
614 // Set the exception beeing re-thrown. 610 // Set the exception beeing re-thrown.
Kasper Lund 2008/10/23 12:52:43 beeing sb. being
615 set_pending_exception(exception); 611 set_pending_exception(exception);
616 return Failure::Exception(); 612 return Failure::Exception();
617 } 613 }
618 614
619 615
620 void Top::ScheduleThrow(Object* exception) { 616 void Top::ScheduleThrow(Object* exception) {
621 // When scheduling a throw we first throw the exception to get the 617 // When scheduling a throw we first throw the exception to get the
622 // error reporting if it is uncaught before rescheduling it. 618 // error reporting if it is uncaught before rescheduling it.
623 Throw(exception); 619 Throw(exception);
624 thread_local_.scheduled_exception_ = pending_exception(); 620 thread_local_.scheduled_exception_ = pending_exception();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } 782 }
787 Handle<String> stack_trace; 783 Handle<String> stack_trace;
788 if (FLAG_trace_exception) stack_trace = StackTrace(); 784 if (FLAG_trace_exception) stack_trace = StackTrace();
789 message_obj = MessageHandler::MakeMessageObject("uncaught_exception", 785 message_obj = MessageHandler::MakeMessageObject("uncaught_exception",
790 location, HandleVector<Object>(&exception_handle, 1), stack_trace); 786 location, HandleVector<Object>(&exception_handle, 1), stack_trace);
791 } 787 }
792 788
793 // If the exception is caught externally, we store it in the 789 // If the exception is caught externally, we store it in the
794 // try/catch handler. The C code can find it later and process it if 790 // try/catch handler. The C code can find it later and process it if
795 // necessary. 791 // necessary.
792 thread_local_.catcher_ = NULL;
796 if (is_caught_externally) { 793 if (is_caught_externally) {
794 thread_local_.catcher_ = thread_local_.try_catch_handler_;
797 thread_local_.try_catch_handler_->exception_ = 795 thread_local_.try_catch_handler_->exception_ =
798 reinterpret_cast<void*>(*exception_handle); 796 reinterpret_cast<void*>(*exception_handle);
799 if (!message_obj.is_null()) { 797 if (!message_obj.is_null()) {
800 thread_local_.try_catch_handler_->message_ = 798 thread_local_.try_catch_handler_->message_ =
801 reinterpret_cast<void*>(*message_obj); 799 reinterpret_cast<void*>(*message_obj);
802 } 800 }
803 } 801 }
804 802
805 // Notify debugger of exception. 803 // Notify debugger of exception.
806 Debugger::OnException(exception_handle, report_exception); 804 Debugger::OnException(exception_handle, report_exception);
807 805
808 if (report_exception) { 806 if (report_exception) {
809 if (message != NULL) { 807 if (message != NULL) {
810 MessageHandler::ReportMessage(message); 808 MessageHandler::ReportMessage(message);
811 } else { 809 } else {
812 MessageHandler::ReportMessage(location, message_obj); 810 MessageHandler::ReportMessage(location, message_obj);
813 } 811 }
814 } 812 }
815 thread_local_.external_caught_exception_ = is_caught_externally;
816 813
817 // NOTE: Notifying the debugger or reporting the exception may have caused 814 // NOTE: Notifying the debugger or reporting the exception may have caused
818 // new exceptions. For now, we just ignore that and set the pending exception 815 // new exceptions. For now, we just ignore that and set the pending exception
819 // to the original one. 816 // to the original one.
820 set_pending_exception(*exception_handle); 817 set_pending_exception(*exception_handle);
821 } 818 }
822 819
823 820
824 void Top::TraceException(bool flag) { 821 void Top::TraceException(bool flag) {
825 FLAG_trace_exception = flag; 822 FLAG_trace_exception = flag;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 Top::break_access_->Lock(); 893 Top::break_access_->Lock();
897 } 894 }
898 895
899 896
900 ExecutionAccess::~ExecutionAccess() { 897 ExecutionAccess::~ExecutionAccess() {
901 Top::break_access_->Unlock(); 898 Top::break_access_->Unlock();
902 } 899 }
903 900
904 901
905 } } // namespace v8::internal 902 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698